BOOST- Compare Images using OpevCV

Other topics

OpenCV code to read Images and compare

#include <opencv2/opencv.hpp> #include

using namespace cv; using namespace std;

int main(int argc, char** argv) { Mat image; image = imread("C:\Users\Development\Documents\Visual Studio 2013\Projects\ImageIn.bmp", CV_LOAD_IMAGE_GRAYSCALE); // Read the file

if (!image.data)                              // Check for invalid input
{
    cout << "Could not open or find the image" << std::endl;
    return -1;
}



Mat witout = imread("C:\\Users\\Development\\Documents\\Visual Studio 2013\\Projects\\ImageWitOut.bmp", CV_LOAD_IMAGE_GRAYSCALE);;
Mat cvout = Mat(image.size(), image.type(), Scalar(255));

imshow("witout", witout);
imshow("cvout", cvout);

Mat diff = (witout == cvout);

namedWindow("Difference", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Difference", diff);                   // Show our image inside it.

waitKey(0);                                          // Wait for a keystroke in the window
return 0;

}

Contributors

Topic Id: 10703

Example Ids: 32109

This site is not affiliated with any of the contributors.