Exemplo n.º 1
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            int.TryParse(ClustorBox.Text, out K);

            if (string.IsNullOrWhiteSpace(ClustorBox.Text))
            {
                MessageBox.Show("Please enter number of cluster !");
            }
            else if (int.Parse(ClustorBox.Text) > distinct_colors || int.Parse(ClustorBox.Text) < 1)
            {
                MessageBox.Show("Invalid number of clusters !");
            }
            else
            {
                List <List <RGBPixel> > groups = new List <List <RGBPixel> >();
                RGBPixel[, ,] Update = new RGBPixel[256, 256, 256];
                double sigma    = double.Parse(txtGaussSigma.Text);
                int    maskSize = (int)nudMaskSize.Value;
                ALL_FUNCTIONS.Build_tree();
                ALL_FUNCTIONS.buildAdjacencyList();
                ALL_FUNCTIONS.CutEdges(K);
                groups = ALL_FUNCTIONS.cluster(K);
                ALL_FUNCTIONS.GetPalette(ref groups);
                Update = ALL_FUNCTIONS.UpdateColor(ref groups);
                ALL_FUNCTIONS.UpdatedMatrix(Update, ImageMatrix);
                ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
                ImageOperations.DisplayImage(ImageMatrix, pictureBox2);
                // Get the original image after make edition on it ..
                ImageMatrix = ImageMatrix_Tmp.Clone() as RGBPixel[, ];
            }
        }
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            double sigma    = double.Parse(txtGaussSigma.Text);
            int    maskSize = (int)nudMaskSize.Value;

            ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
            ImageOperations.DisplayImage(ImageMatrix, pictureBox2);
        }
Exemplo n.º 3
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            double sigma    = double.Parse(txtGaussSigma.Text);                                          // -> O(1)
            int    maskSize = (int)nudMaskSize.Value;                                                    // -> O(1)

            RGBPixel[,] ImageFilltered = ImageMatrix;                                                    // -> O(1)
            ImageFilltered             = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma); //->  O(W*H)
            ImageOperations.DisplayImage(ImageFilltered, pictureBox2, 0);                                //->  O(W*H)
        }
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            double sigma     = (double)factor.Value;                                                      // -> O(1)
            int    maskSize_ = (int)maskSize.Value;                                                       // -> O(1)

            RGBPixel[,] ImageFilltered = ImageMatrix;                                                     // -> O(1)
            ImageFilltered             = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize_, sigma); //->  O(W*H)
            ImageOperations.DisplayImage(ImageFilltered, PostImage, 0);                                   //->  O(W*H)
        }
Exemplo n.º 5
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            double sigma    = double.Parse(Seed.Text);
            int    maskSize = (int)nudMaskSize.Value;

            ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
            RGBPixel asd = ImageMatrix[1, 1];

            txtWidth.Text  = asd.red.ToString();
            txtHeight.Text = asd.green.ToString();
            ImageOperations.DisplayImage(ImageMatrix, pictureBox2);
        }
Exemplo n.º 6
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            int     K = int.Parse(ClusterNumber.Text);
            Cluster c = new Cluster(colors, ImageMatrix);

            c.getClusters(edges, colors.Count, K);
            ImageMatrix = c.replace();
            double sigma    = double.Parse(txtGaussSigma.Text);
            int    maskSize = (int)nudMaskSize.Value;

            ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
            ImageOperations.DisplayImage(ImageMatrix, pictureBox2);
        }
Exemplo n.º 7
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            Stopwatch stopwatch = new Stopwatch();

            double sigma    = double.Parse(txtGaussSigma.Text);
            int    maskSize = (int)nudMaskSize.Value;

            stopwatch.Start();
            ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);

            stopwatch.Stop();
            Console.WriteLine("time taken " + stopwatch.Elapsed + "\t");
            ImageOperations.DisplayImage(ImageMatrix, pictureBox2, 0);
        }
Exemplo n.º 8
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            if (ImageMatrix != null)
            {
                double sigma    = double.Parse(txtGaussSigma.Text);
                int    maskSize = (int)nudMaskSize.Value;
                ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
                ImageOperations.DisplayImage(ImageMatrix, pictureBox2);
            }

            else
            {
                MessageBox.Show("Please Select An Image First!");
            }
        }
Exemplo n.º 9
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            double sigma    = double.Parse(txtGaussSigma.Text);
            int    maskSize = (int)nudMaskSize.Value;

            ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
            //  ImageOperations.Average();

            ImageOperations.Split_KCluster(Convert.ToInt32(k.Text));
            ImageOperations.avg();
            ImageOperations.replace();
            ImageOperations.DisplayImage(ImageOperations.Buffer, pictureBox2);
            //  ttt.Text = Program.time.ToString();
            st.Stop();
            ttt.Text = st.ElapsedMilliseconds.ToString();
        }
Exemplo n.º 10
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            long timeBefore = System.Environment.TickCount;

            Clusters = ImageOperations.Clustering(NewEdges, ImageOperations.Globals.distinct, k);

            Colors      = ImageOperations.Pallete(Clusters, k, Nodes);
            ImageMatrix = ImageOperations.ImageQuantization(ImageMatrix, Colors, Nodes);
            long timeAfter = System.Environment.TickCount;

            ImageOperations.Globals.Time += timeAfter - timeBefore;
            TimeBoxS.Text  = (ImageOperations.Globals.Time / 1000).ToString();
            TimeBoxMS.Text = (ImageOperations.Globals.Time % 1000).ToString();
            double sigma    = double.Parse(txtGaussSigma.Text);
            int    maskSize = (int)nudMaskSize.Value;

            ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
            ImageOperations.DisplayImage(ImageMatrix, pictureBox2);
        }
Exemplo n.º 11
0
        private void btnGaussSmooth_Click(object sender, EventArgs e)
        {
            int distinc = construct.distinctColor(ImageMatrix);

            textBoxK.Text = distinc.ToString();
            double mst = DistanceCalculators.DistanceCalculator(construct.distinct);

            textBoxMST.Text = mst.ToString();
            clustering.phaseOne(DistanceCalculators.distances, k);
            clustering.phaseTwo(DistanceCalculators.parent, clustering.disconnected);
            int[] arr = clustering.phaseTwo(DistanceCalculators.parent, clustering.disconnected);
            clustering.graph(arr, clustering.disconnected);
            clustering.phaseThree(clustering.g, k);
            clustering.AVG(k);
            clustering.Gausssmooth(ImageMatrix);
            double sigma    = double.Parse(txtGaussSigma.Text);
            int    maskSize = (int)nudMaskSize.Value;

            ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma);
            ImageOperations.DisplayImage(ImageMatrix, pictureBox2);
        }