How do i subtract one image from another using C++
Please, anyone, how do i subtract one PNG image from another PNG image. The images are of the same scene, but with just some additional few differences in one of them. The result of the subtraction will be stored in another PNG image.
There are lots (hundreds) of such pair of images popping up every now and then, So i can't do them manually. Not even on the command line. I have got to do it using C++, but my seach so far has yeilded nothing, not even in the magick++ forum. Has anyone got any clues please, with some c++ (or preferably magick++ so i would know how to actually access the pixels/bytes in order to do the subtraction)?
Hi,
Well first you would need to load the png in to get their bitmap data (using pnglib for instance). Then iterate over the bits and substract as you go. Write that to some other png file.
Greetings
EDIT: that would be libpng btw... www.libpng.org
Here you can get an api to get the bitmap data of a png
Well first you would need to load the png in to get their bitmap data (using pnglib for instance). Then iterate over the bits and substract as you go. Write that to some other png file.
Greetings
EDIT: that would be libpng btw... www.libpng.org
Here you can get an api to get the bitmap data of a png
http://www.libpng.org/pub/png/libpng-1.2.5-manual.html
it includes a code example + walkthrough on accessing bytes
it includes a code example + walkthrough on accessing bytes
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement