reyasmohammed / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

8-bit images (LevelsLinear filter) #289

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

 var img = AForge.Imaging.Image.FromFile(fullPathToImage);
 var filter = new LevelsLinear();
 const int minRGB = 0, maxRGB = 254;
 filter.InRed = new IntRange(minRGB, maxRGB);
 filter.InGreen = new IntRange(minRGB, maxRGB);
 filter.InBlue = new IntRange(minRGB, maxRGB);
 filter.OutBlue = new IntRange(3 * maxRGB / 4, maxRGB);
 filter.ApplyInPlace(img);
 img.Save(fullPathToImage + ".blue");

What is the expected output?

 "Dial up the blue" in an 8-bit black+white image (eg. test-8.png attached).

What do you see instead?

 The image remained black+white, with color levels unchanged.

What version of the product are you using?

 2.2.3.0

Please provide any additional information below.

 This use of the LevelsLinear filter works for 24-bit and 32-bit images (eg. test-24.png). I'm not at all certain where the problem is, but when I use the 8-bit image, the output image is the same as the input when I compare color values per-pixel. My guess is that this problem is a feature of .NET. I was hoping I could adjust the parameters to the Save call to force saving as 24-bit, but I already noticed this did not solve the problem for 8-bit JPEGs so I'm not holding out much hope.

 Thanks for your hard work on this project. I understand if you feel this is not really your problem; I am going to dig into using the approach given in the following link to see if I can save the image this way: http://forums.asp.net/t/1069104.aspx/1

 It might be nice to document this .NET issue prominently in your documentation if you have not already done so. I appreciated the thoroughness of your tutorials.

Original issue reported on code.google.com by JedSpr...@mkgcs.com on 27 Feb 2012 at 10:27

Attachments:

GoogleCodeExporter commented 8 years ago
LevelsLinear is not supposed to change pixel format of source image, so it will 
never change 8 bpp image to 24 bpp. You need to do it manually first (see 
GrayscaleToRGB) and then apply LevelsLinear.

Original comment by andrew.k...@gmail.com on 28 Feb 2012 at 5:32