converting a coloured image to a black/white

Hi guys,
I want to write a program that it takes a colour image and converts it to a black/white image!
my problem is that i dont know what function must i use to insert the image to the code
PLEASE HELP
You have to look for a library that supports image loading and editing.
For example http://cimg.eu/
Last edited on
*greyscale* single byte image conversion is simple, simply average the red/green/blue components and use that value.

actual black and white (1 bit image) is actually more complex, as you usually want to have a moving target threshold based of local regions based off the actual image content. It is nonttrivial.

an easy way to get images is to save them in RAW format (RGB flat binary file) from an image editor that supports it (many do). Then you can simply read the data into an unsigned char* directly with a file.read(...) command. Other formats require the library approach, but you can get started this way.

Last edited on
Topic archived. No new replies allowed.