How to create an infrared filter effect in C #

I recently came across some very interesting photos from Google's image search for infrared, and I would like to try some pixel manipulation to create this effect. I have experience working with pixel manipulations, usually only from the beginning to the end of the image, extracting argb values, manipulating them, then recreating the pixel and putting it back into the image or copy. I suppose my question is: how can I find out how to manipulate rgb values ​​to create such an effect from a regular image?

I would probably use one of the following to extract the argb values ​​from the pixel data while passing through the pixels of the image.

for (int x = 0; x < width; ++x, ++index)
            {
                uint currentPixel = sourcePixels[index]; // get the current pixel

                uint alpha = (currentPixel & 0xff000000) >> 24; // alpha component
                uint red = (currentPixel & 0x00ff0000) >> 16; // red color component
                uint green = (currentPixel & 0x0000ff00) >> 8; // green color component
                uint blue = currentPixel & 0x000000ff; // blue color component

                //Modify pixel values

                uint newPixel = (alpha << 24) | (red << 16) | (green << 8) | blue; // reassembling each component back into a pixel

                targetPixels[index] = newPixel; // assign the newPixel to the equivalent location in the output image

            }

Edit: Example image below

enter image description here

OR

enter image description here

+4
1

, , , . , . . , , . , ( , ).

AForge.Imaging - .NET , . filters, , . , . - Codeproject. , , .

public static class ImageProcessing
{
     public static Bitmap Process(Bitmap image, IFilter filter)
     {
         return filter.Apply(image);
     }

     public static Bitmap Process(string path, IFilter filter)
     {
         var image = (Bitmap)Image.FromFile(path);
         return filter.Apply(image);
     }

     public static Bitmap Process(string path, IEnumerable<IFilter> filters)
     {
         var image = (Bitmap)Image.FromFile(path);
         foreach (var filter in filters)
         {
             Bitmap tempImage = filter.Apply(image);
             image.Dispose();
             image = tempImage;
         }
         return image;
     }
}

(test.jpg)

enter image description here

ImageProcessing.Process("test.jpg", new HueModifier(30))
               .Save("result_1.jpg");

(result_1.jpg)

enter image description here

ImageProcessing.Process("test.jpg", new SaturationCorrection(0.35f))
               .Save("result_2.jpg");

(result_2.jpg)

enter image description here

ImageProcessing.Process("test.jpg"
            ,new List<IFilter>() {
                                  new BrightnessCorrection(), 
                                  new SaturationCorrection(0.1f), 
                                  new HueModifier(300)})
            .Save("result_3.jpg");

(result_3.jpg)

enter image description here

+2

All Articles