RSS

Image Difference with OpenCV

12 Feb
First Image

First Image

Second Image

Second Image

Image Difference

Image Difference

 #include "stdafx.h"
 #include<opencv\cv.h>
 #include<opencv\cxcore.h>
 #include<opencv\highgui.h>

int _tmain(int argc, _TCHAR* argv[])
 {

IplImage *first = cvLoadImage("C:\\Users\\first.jpg");
 IplImage *second = cvLoadImage("C:\\Users\\second.jpg");

IplImage *subImage;
 subImage = cvCloneImage(first);

cvAbsDiff(first,second,subImage);
 cvNamedWindow("Original:");
 cvShowImage("Original:", first);

cvNamedWindow("Modified:");
 cvShowImage("Modified:", second);

cvNamedWindow("Diff:");
 cvShowImage("Diff:", subImage);

cvWaitKey(0);
 cvDestroyWindow("Original:");
 cvReleaseImage(&first);
 cvDestroyWindow("Modified:");
 cvReleaseImage(&second);
 cvDestroyWindow("Diff:");
 cvReleaseImage(&subImage);
 return 0;

}

Advertisements
 
Leave a comment

Posted by on February 12, 2013 in C

 

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: