private void MstQtButton_Click(object sender, EventArgs e) { Stopwatch sw = new Stopwatch(); sw.Start(); reduceColors = ReduceColorsBox.Checked; imageQuantizer = new ImageQuantizer(ImageMatrix); if (ClustersNumber.Text.ToString().Length > 0) { K = int.Parse(ClustersNumber.Text); } else { K = -1; } imageQuantizer.MstQuantiztion(); ClustersNumber.Text = K.ToString(); distinctColorsBox2.Text = imageQuantizer.distinctColorsCount.ToString(); ImageOperations.DisplayImage(imageQuantizer.quantizedImageMatrix, pictureBox2); MstBox.Text = mstVal.ToString(); sw.Stop(); txttime.Text = sw.Elapsed.ToString(); }
private void MstQtButton_Click(object sender, EventArgs e) { reduceColors = ReduceColorsBox.Checked; if (ClustersNumber.Text.ToString().Length > 0) { K = int.Parse(ClustersNumber.Text); imageQuantizer = new ImageQuantizer(ImageMatrix); imageQuantizer.MstQuantiztion(); distinctColorsBox2.Text = imageQuantizer.distinctColorsCount.ToString(); ImageOperations.DisplayImage(imageQuantizer.quantizedImageMatrix, pictureBox2); MstBox.Text = mstVal.ToString(); } else { imageQuantizer = new ImageQuantizer(ImageMatrix); imageQuantizer.MstQuantiztionWithAutoKdetection(); distinctColorsBox2.Text = imageQuantizer.distinctColorsCount.ToString(); ImageOperations.DisplayImage(imageQuantizer.quantizedImageMatrix, pictureBox2); MstBox.Text = mstVal.ToString(); ClustersNumber.Text = K.ToString(); } }