I hope you already learned how to lock bitmap in memory and work with raw image data to get reasonable performance? If not, see the code sample here:
http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx[
^]. First thing to know: never use
GetPixel
/
SetPixel
for this is similar purposes, due to performance issues. Be careful with possibly different pixel formats, see the property
System.Drawing.Bitmap.PixelFormat
. In principle, you can compare different formats, just see the description of each to interpret them correctly — you work on the low level in all such processing.
Now, what to do with that?
The naive question if to subtract one image from another per component and optionally normalize the result. It will work.
One problem is: some values are lower in one image, some are lower on the other one. One approach is: it you have two images,
I1
and
I2
, subtract using signed result type and change negative values to zero; create two differential images
I1-I2
and
I2-I1
; alternatively, subtract and get the absolute value.
For more sophisticated processing, use AForge.NET:
http://www.aforgenet.com/[
^].
—SA