示例#1
0
        void im_Click(object sender, EventArgs e)
        {
            ImageMagnifier.ImageMagnifier im = (ImageMagnifier.ImageMagnifier)sender;
            this.imNNState.ImageToMagnify = im.ImageToMagnify;

            frmAddDistortion frmaddDistortion = new frmAddDistortion();

            frmaddDistortion.ShowDialog();

            Random r = new Random();
            int    p = 0;
            int    k = 0;

            for (int i = 0; i < frmaddDistortion.DistortionLevel; i++)
            {
                p = r.Next(imageDim);
                k = r.Next(imageDim);
                if (imNNState.pixels[k, p] == Color.Black.ToArgb())
                {
                    imNNState.pixels[k, p] = Color.White.ToArgb();
                }
                else if (imNNState.pixels[k, p] == Color.White.ToArgb())
                {
                    imNNState.pixels[k, p] = Color.Black.ToArgb();
                }
            }
            lblEnergy.Text  = "0";
            patternSelected = true;
            imNNState.Invalidate();
        }
示例#2
0
        void im_Click(object sender, EventArgs e)
        {
            ImageMagnifier.ImageMagnifier im = (ImageMagnifier.ImageMagnifier)sender;
            this.imNNState.ImageToMagnify = im.ImageToMagnify;

            frmAddDistortion frmaddDistortion = new frmAddDistortion();
            frmaddDistortion.ShowDialog();
            
            Random r = new Random();
            int p=0;
            int k=0;
            for (int i = 0; i < frmaddDistortion.DistortionLevel; i++)
            {
                p = r.Next(imageDim);
                k = r.Next(imageDim);
                if (imNNState.pixels[k, p] == Color.Black.ToArgb()) imNNState.pixels[k, p] = Color.White.ToArgb();
                else if (imNNState.pixels[k, p] == Color.White.ToArgb()) imNNState.pixels[k, p] = Color.Black.ToArgb();
            }
            lblEnergy.Text = "0";
            patternSelected = true;
            imNNState.Invalidate();
        }