Exemple #1
0
        private void GrayScaleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            temp_image = new Bitmap(pictureBox1.Image);

            Filters filter = new GrayScaleFilter();

            backgroundWorker1.RunWorkerAsync(filter);
        }
Exemple #2
0
        private void тиснениеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Filters filter   = new GrayScaleFilter();
            Bitmap  newImage = (filter.processImage(image));

            image = newImage;

            filter   = new EmbossingFilter(newImage);
            newImage = (filter.processImage(image));
            image    = newImage;


            backgroundWorker1.RunWorkerAsync(filter);
        }
Exemple #3
0
        private void bWГистограммаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Filters filter   = new GrayScaleFilter();
            Bitmap  palImage = filter.processImage(image);

            int[] histogram = new int[256];
            for (int x = 0; x < image.Width; x++)
            {
                for (int y = 0; y < image.Height; y++)
                {
                    histogram[palImage.GetPixel(x, y).R]++;
                }
            }
            HistogramWindowcs histogramView = new HistogramWindowcs();

            histogramView.ShowIntensityHistogram(histogram);
        }
Exemple #4
0
        public override Bitmap proccessImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            GrayScaleFilter gray         = new GrayScaleFilter();
            Bitmap          sourceImage1 = gray.proccessImage(sourceImage, worker);

            bool[,] binaryImage = new bool[sourceImage.Width, sourceImage.Height];
            Bitmap resultImage = new Bitmap(sourceImage1);

            for (int i = 0; i < sourceImage.Width; ++i)
            {
                worker.ReportProgress((int)((float)i / resultImage.Width * 50));
                if (worker.CancellationPending)
                {
                    return(null);
                }
                for (int j = 0; j < sourceImage.Height; ++j)
                {
                    binaryImage[i, j] = makeBinary(sourceImage1, i, j);
                }
            }
            int height = structureElement.GetLength(0) / 2;
            int width  = structureElement.GetLength(1) / 2;

            for (int i = width; i < sourceImage.Width - width; ++i)
            {
                worker.ReportProgress((int)((float)(resultImage.Width + i) / resultImage.Width * 50));
                if (worker.CancellationPending)
                {
                    return(null);
                }
                for (int j = height; j < sourceImage.Height - height; ++j)
                {
                    bool pos = calculateNewPos(binaryImage, i, j);
                    if (pos)
                    {
                        resultImage.SetPixel(i, j, Color.Black);
                    }
                    else
                    {
                        resultImage.SetPixel(i, j, Color.White);
                    }
                }
            }
            return(resultImage);
        }
Exemple #5
0
        public override Bitmap proccessImage(Bitmap sourceImage, BackgroundWorker worker)
        {
            Bitmap          resultImage    = new Bitmap(sourceImage.Width, sourceImage.Height);
            GrayScaleFilter gray           = new GrayScaleFilter();
            Bitmap          newSourceImage = gray.proccessImage(sourceImage, worker);

            for (int i = 0; i < newSourceImage.Width; ++i)
            {
                worker.ReportProgress((int)((float)i / resultImage.Width * 100));
                if (worker.CancellationPending)
                {
                    return(null);
                }
                for (int j = 0; j < newSourceImage.Height; ++j)
                {
                    resultImage.SetPixel(i, j, calculateNewPixelColor(newSourceImage, i, j));
                }
            }
            return(resultImage);
        }
Exemple #6
0
        private void rgbhistogramToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _ = new GrayScaleFilter();
            int[][] histogram = new int[3][];
            histogram[0] = new int[256];
            histogram[1] = new int[256];
            histogram[2] = new int[256];
            for (int x = 0; x < image.Width; x++)
            {
                for (int y = 0; y < image.Height; y++)
                {
                    Color sourceColor = image.GetPixel(x, y);
                    histogram[0][sourceColor.R]++;
                    histogram[1][sourceColor.G]++;
                    histogram[2][sourceColor.B]++;
                }
            }
            HistogramWindowcs histogramView = new HistogramWindowcs();

            histogramView.ShowRGBHistogram(histogram);
        }
Exemple #7
0
        private void grayScaleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Filters filter = new GrayScaleFilter();

            backgroundWorker1.RunWorkerAsync(filter);
        }