コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        private void btnQuantize_Click(object sender, EventArgs e)
        {
            int K = (int)ClusterK.Value;                                                         // -> O(1)

            txtDisColor.Text = ImageAnalytics.Find_Distinct_Color(ImageMatrix).ToString();       // -> O(W*H)
            txtMST.Text      = (Math.Round(ImageAnalytics.MinimumSpanningTree(), 2)).ToString(); // -> O(E Log V)
            DetectNumOfClusters x = new DetectNumOfClusters(ImageAnalytics.edges);               // -> O(E*V)

            if (K == 0)
            {
                K = x.k;                                             // -> O(1)
            }
            QuantizeImage.Extract_K_Cluster(K);                      // -> O(K*D)
            QuantizeImage.Find_K_Cluster();                          // -> O(D)
            ImageOperations.DisplayImage(ImageMatrix, PostImage, 1); //O(N^2) where N is the height or the weight of image
            ClusterK.Value = K;                                      // print the number of cluster if changed // -> O(1)
        }
コード例 #2
0
        private void btnQuantize_Click(object sender, EventArgs e)
        {
            long before = System.Environment.TickCount;                                          // get the current time in miliseconds  // -> O(1)
            int  K      = (int)ClusterK.Value;                                                   // -> O(1)

            txtDisColor.Text = ImageAnalytics.Find_Distinct_Color(ImageMatrix).ToString();       // -> O(W*H)
            txtMST.Text      = (Math.Round(ImageAnalytics.MinimumSpanningTree(), 2)).ToString(); // -> O(E Log V)
            DetectNumOfClusters x = new DetectNumOfClusters(ImageAnalytics.edges);               // -> O(E*V)

            if (K == 0)
            {
                K = x.k;                                               // -> O(1)
            }
            QuantizeImage.Extract_K_Cluster(K);                        // -> O(K*D)
            QuantizeImage.Find_K_Cluster();                            // -> O(D)
            ImageOperations.DisplayImage(ImageMatrix, pictureBox2, 1); //O(N^2) where N is the height or the weight of image
            ClusterK.Value = K;                                        // print the number of cluster if changed // -> O(1)
            long   after = System.Environment.TickCount;               // get the current time // -> O(1)
            double total = after - before;                             // Calculate the taken time // -> O(1)

            total         /= 60000;                                    // convert miliseconds to minutes // -> O(1)
            total          = Math.Round(total, 3);                     // Round the Minutes to three decimal digits // -> O(1)
            TimeLable.Text = total.ToString() + " M (s)";              // -> O(1)
        }