コード例 #1
0
        //* TrackBar _ Erode *//
        private void trackBar_Erode_Scroll(object sender, EventArgs e)
        {
            IplConvKernel element = new IplConvKernel(3, 3, 1, 1, ElementShape.Rect, null);

            if (checkBox_isNegative.Checked == false)
            {
                if (trackBar_Bold.Value == 1)
                {
                    beforeErode.Erode(imgBox, element, 1);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 2)
                {
                    beforeErode.Erode(imgBox, element, 2);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 3)
                {
                    beforeErode.Erode(imgBox, element, 3);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 4)
                {
                    beforeErode.Erode(imgBox, element, 4);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 5)
                {
                    beforeErode.Erode(imgBox, element, 5);
                    pictureBox.ImageIpl = imgBox;
                }
                else
                {
                    beforeErode.Copy(imgBox);
                    pictureBox.ImageIpl = imgBox;
                }
            }
            else if (checkBox_isNegative.Checked == true)
            {
                if (trackBar_Bold.Value == 1)
                {
                    beforeErode.Dilate(imgBox, element, 1);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 2)
                {
                    beforeErode.Dilate(imgBox, element, 2);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 3)
                {
                    beforeErode.Dilate(imgBox, element, 3);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 4)
                {
                    beforeErode.Dilate(imgBox, element, 4);
                    pictureBox.ImageIpl = imgBox;
                }
                else if (trackBar_Bold.Value == 5)
                {
                    beforeErode.Dilate(imgBox, element, 5);
                    pictureBox.ImageIpl = imgBox;
                }
                else
                {
                    beforeErode.Copy(imgBox);
                    pictureBox.ImageIpl = imgBox;
                }
            }
        }