コード例 #1
0
        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);
                }
            }
        }