Example #1
0
        public ImageProcessing(string filePath, int tasksCount)
        {
            TasksCount = tasksCount;
            LoadImageAsBitmap(filePath);

            Ratios = new ColorRatios {
                RedRatio   = 0.2126,
                GreenRatio = 0.7152,
                BlueRatio  = 0.0722,
            };
        }
        public RawDataConverter(Bitmap processedImage, ColorRatios ratios)
        {
            OriginalBitmap = processedImage;
            Rectangle bounds = new Rectangle(Point.Empty, processedImage.Size);

            RawData   = processedImage.LockBits(bounds, ImageLockMode.ReadWrite, processedImage.PixelFormat);
            Locked    = true;
            PixelData = (byte *)RawData.Scan0.ToPointer();

            Depth         = Image.GetPixelFormatSize(RawData.PixelFormat) / 8;
            RowBytesCount = bounds.Width * Depth;
            if (RowBytesCount % 4 != 0)
            {
                RowBytesCount = 4 * ((RowBytesCount / 4) + 1);
            }
            Ratios = ratios;
        }