http://blog.csdn.net/merlin_q/article/details/7024798
Let 's get a fault. Two image subtraction other good implementations? Tags: imageinclude2011-11-29 20:29 4701 People read Comments (2) favorite reports Classification:OPENCV Study (+)C + + (+)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace CV;
int main ()
{
Mat IMG1 = Imread ("d:\\image\\img1.jpg");
Mat Img2 = Imread ("d:\\image\\img2.jpg");//Two images must be of the same size
Mat img_result1, IMG_RESULT2, Img_result;
Subtract (Img1,img2, IMG_RESULT1);
Subtract (IMG2,IMG1, IMG_RESULT2);
Add (IMG_RESULT1, IMG_RESULT2, IMG_RESULT1);
Imwrite ("D:\\image\\result.jpg", IMG_RESULT1);
Imshow ("result", IMG_RESULT1);
Waitkey ();
return 0;
}
can also be used Img_result = 2*abs (IMG1-IMG2);
Multiply by 2 to make the difference a bit more obvious.
The result is the third picture, where the 3,5,6,7,12 is five different places. What better and more robust way to do without the image size exactly the same?
Let's get a fault. Two image subtraction other good implementations? Beauty Finding fault