is image1==image2 ??

- i have got 2 photos
- i would like to compare them to see if they are the same

eg:
- the webcam is looking at an empty table and takes photo 1
- i placed a pile of books on the table and the webcam takes photo 2
- now, the output should be something like this:
"there is 21% difference"

i have done some research via google and seen things like imagemagicks magick++, libjpeg, cimg,...but i can't figure out what or how to do things.

could you guys help me with this plz...
This can be accomplished in opencv. It is what is called a histogram. Basically this finds similar areas in photo's based on a somewhat greyscale or color altered image. From there you can find changes between multiple frames of a photo. Here is a link. http://dasl.mem.drexel.edu/~noahKuntz/openCVTut9.html

the above link is somewhat different then what we were originally discussing but i figured you would find it useful later on. Here is the page on histograms. It finds similar areas between multiple images. This is getting in around the concept of photostitching also.
http://dasl.mem.drexel.edu/~noahKuntz/openCVTut6.html
Last edited on
thanks. i have installed vc++ 2010 and opencv and i got everything working now.

but why do they say in every tuturial to include cv.h while it works as good if you dont include it??
it's really strange because i still need to include things like highgui.h if i want things working...
why is my program ignoring the key input wich i use to exit the program?
the program should stop running when i press ESC (key 27)??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include "cv.h"
#include "highgui.h"

using namespace std;

int main()
{
    CvCapture *capture = cvCaptureFromCAM( CV_CAP_ANY );
    IplImage *frame;
    int i = 1, key = 0;
    char fname[11];

    cout << "Running...";

    while (key != 27) {
        frame = cvQueryFrame(capture);
	key = cvWaitKey(1);
	cout << key;

	sprintf(fname, "photo%d.jpg", i);
        cvSaveImage(fname, frame);
        i++;
    }
    cvReleaseCapture(&capture);

    return 0;
}
Topic archived. No new replies allowed.