private void hLinesWPreprocessingToolStripMenuItem_Click(object sender, EventArgs e) { if (img == null) { return; } float angleSpacing = 1; float minAngle = 0; float maxAngle = 180; InputBox Threshold = new InputBox(); Threshold.ShowDialog(); int T = Convert.ToInt32(Threshold.ValueTextBox.Text); imgUndo = img.Copy(); ImageClass.sobelfilter(imgUndo, img, 3); ImageClass.otsu(imgUndo, img); Image <Gray, float> houghImg = ImageClass.HoughTransform(img.Convert <Gray, byte>(), angleSpacing, minAngle, maxAngle); Image <Bgr, byte> lines = ImageClass.ShowHoughLines(img, imgOri, T); ShowIMG.ShowIMGStatic(img, lines); }
private void otsuToolStripMenuItem_Click(object sender, EventArgs e) { if (img == null) // protege de executar a função sem ainda ter aberto a imagem { return; } //histogramToolStripMenuItem_Click(sender, e); Cursor = Cursors.WaitCursor; // cursor relogio imgUndo = img.Copy(); //copy Undo Image DateTime d1 = DateTime.Now; ImageClass.otsu(imgUndo, img); ImageViewer.Refresh(); // atualiza imagem no ecrã DateTime d2 = DateTime.Now; Cursor = Cursors.Default; // cursor normal MessageBox.Show((d2 - d1).ToString()); }