Ejemplo n.º 1
0
        public HistogramData generateHistogramHSV()
        {
            histogramData = new HistogramData();

            if (this.Bitmap.PixelFormat == PixelFormat.Format16bppGrayScale)
            {
                histogramData.isMonochromatic = true;
            }

            HSVBit hsvBitHelp;
            int    helperValue = 0;

            for (int x = 0; x < Bitmap.Width; ++x)
            {
                for (int y = 0; y < Bitmap.Height; ++y)
                {
                    hsvBitHelp = this.GetPixelHSV(x, y);
                    //someDictionary.TryGetValue(id, out var currentCount);
                    //someDictionary[id] = currentCount + 1;
                    histogramData.HSV_HHisto.TryGetValue(hsvBitHelp.HUE, out helperValue);
                    histogramData.HSV_HHisto[hsvBitHelp.HUE] = helperValue + 1;

                    histogramData.HSV_SHisto.TryGetValue(hsvBitHelp.saturation, out helperValue);
                    histogramData.HSV_SHisto[hsvBitHelp.saturation] = helperValue + 1;

                    histogramData.HSV_VHisto.TryGetValue(hsvBitHelp.value, out helperValue);
                    histogramData.HSV_VHisto[hsvBitHelp.value] = helperValue + 1;
                }
            }

            return(histogramData);
        }
        public ImageProcessingEngine(Stream stream)
        {
            image = Image.FromStream(stream);
            Bitmap innerBitmap = new Bitmap(image);

            directBitmapPre  = new DirectBitmap(innerBitmap);
            directBitmapPost = new DirectBitmap(innerBitmap);

            hitogramsData = new HistogramData();

            pixelAmount = directBitmapPre.Height * directBitmapPre.Width;
        }
Ejemplo n.º 3
0
        public HistogramData generateHistogram()
        {
            histogramData = new HistogramData();

            if (this.Bitmap.PixelFormat == PixelFormat.Format16bppGrayScale)
            {
                histogramData.isMonochromatic = true;
            }

            Color helpPixel;

            for (int x = 0; x < Bitmap.Width; ++x)
            {
                for (int y = 0; y < Bitmap.Height; ++y)
                {
                    helpPixel = Bitmap.GetPixel(x, y);
                    histogramData.redHisto[helpPixel.R]++;
                    histogramData.blueHisto[helpPixel.B]++;
                    histogramData.greenHisto[helpPixel.G]++;
                }
            }

            return(histogramData);
        }