示例#1
0
        public void BinarizationOperation(int threshold)
        {
            outBitmap = new WriteableBitmap(originalBitmap);
            outBitmap.Lock();
            byte MAX_COLOR = 0xFF;

            byte[] LUT = new byte[MAX_COLOR + 1];

            for (int i = threshold; i < MAX_COLOR + 1; i++)
            {
                LUT[i] = MAX_COLOR;
            }

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    RGBPixel pixel = pixelMatrix[x, y];
                    pixel.ToGrayscale2();
                    pixel.ChangeColors(LUT[pixel.Red]);
                    DrawPixel(pixel);
                }
            }
            UpdateImage();
        }
示例#2
0
 public void ApplyLUT(int[] rLUT, int[] gLUT, int[] bLUT)
 {
     outBitmap = new WriteableBitmap(originalBitmap);
     outBitmap.Lock();
     for (int x = 0; x < width; x++)
     {
         for (int y = 0; y < height; y++)
         {
             RGBPixel pixel = pixelMatrix[x, y];
             pixel.ChangeColors(rLUT[pixel.Red], gLUT[pixel.Green], bLUT[pixel.Blue]);
             DrawPixel(pixel);
         }
     }
     UpdateImage();
     UpdatePixelMatrix();
 }