I am looking for a great C++ library for doing basic image manipulation. What I need done is to be able to convert an image to grayscale and have access to read the pixels of the image.
I have looked at OpenCV, GIL, CImg and Magick++, but either they were not too great, or I couldn't figure out how to convert an image to grayscale with the library.
If you're going to convert color to greyscale on your own, you don't normally want to give equal weight to the three channels. The usual conversion is something like:
grey = 0.3 * R + 0.6 * G + 0.1 * B;
Obviously those factors aren't written in stone, but they should be reasonably close.
You can simulate different colors of filters by changing the factors -- by far the most common filter in B&W photography is red, which would mean increasing the red and decreasing the other two to maintain a total factor of 1.0 (but keep the G:B ratio around 6:1 or so).
CImg is probably easiest to use, no install it's just a header file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With