private void button8_Click(object sender, EventArgs e) { SetLabelVisibel(10, false); SetLabelVisibel(11, false); SetLabelVisibel(12, false); SetPictureBoxVisibel(2, false); SetPictureBoxVisibel(3, false); SetPictureBoxVisibel(4, false); SetChartVisibel(1, false); SetChartVisibel(2, false); if (openImg != null) { Bitmap combineImg = new Bitmap(openImg); Bitmap thresholdImg = new Bitmap(openImg); Bitmap overlapImg = new Bitmap(openImg); Sobel_Edge_Detect detect = new Sobel_Edge_Detect(); Overlap trans = new Overlap(); combineImg = detect.Combine(openImg); thresholdImg = trans.Threshold(combineImg, hScrollBar2.Value); overlapImg = trans.Overlapping(openImg, thresholdImg); //show image if (thresholdImg != null) { SetLabel(10, "threshold"); SetPictureBox(2, thresholdImg); SetLabelVisibel(10, true); SetPictureBoxVisibel(2, true); } else { SetLabelVisibel(10, false); SetPictureBoxVisibel(2, false); } if (combineImg != null) { SetLabel(11, "combine"); SetPictureBox(3, combineImg); SetLabelVisibel(11, true); SetPictureBoxVisibel(3, true); } else { SetLabelVisibel(11, false); SetPictureBoxVisibel(3, false); } if (overlapImg != null) { SetLabel(12, "overlap"); SetPictureBox(4, overlapImg); SetLabelVisibel(12, true); SetPictureBoxVisibel(4, true); } else { SetLabelVisibel(12, false); SetPictureBoxVisibel(4, false); } } }
private void button7_Click(object sender, EventArgs e) { SetLabelVisibel(10, false); SetLabelVisibel(11, false); SetLabelVisibel(12, false); SetPictureBoxVisibel(2, false); SetPictureBoxVisibel(3, false); SetPictureBoxVisibel(4, false); SetChartVisibel(1, false); SetChartVisibel(2, false); if (openImg != null) { Sobel_Edge_Detect detect = new Sobel_Edge_Detect(); Bitmap verticalImg = new Bitmap(openImg); Bitmap horizontalImg = new Bitmap(openImg); Bitmap combineImg = new Bitmap(openImg); // do edge detect verticalImg = detect.Vertical(openImg); horizontalImg = detect.Horizontal(openImg); combineImg = detect.Combine(openImg); if (verticalImg != null) { SetLabel(10, "vertical"); SetPictureBox(2, verticalImg); SetLabelVisibel(10, true); SetPictureBoxVisibel(2, true); } else { SetLabelVisibel(10, false); SetPictureBoxVisibel(2, false); } if (horizontalImg != null) { SetLabel(11, "horizontal"); SetPictureBox(3, horizontalImg); SetLabelVisibel(11, true); SetPictureBoxVisibel(3, true); } else { SetLabelVisibel(11, false); SetPictureBoxVisibel(3, false); } if (combineImg != null) { SetLabel(12, "combine"); SetPictureBox(4, combineImg); SetLabelVisibel(12, true); SetPictureBoxVisibel(4, true); } else { SetLabelVisibel(12, false); SetPictureBoxVisibel(4, false); } } }