I have this nasty problem with opencv 2.4.2.
I use VS 2012 to compile this short test programm.
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
using namespace cv;
int main()
{
Mat sudoku = imread("sudoku.jpg",0);
namedWindow("Lines", CV_WINDOW_AUTOSIZE);
imshow("Lines", sudoku);
}
Imshow is the problem. When I remove it, it runs without any problem. I found a tip here which said to use debug libs instead but it didn’t help.
First of all, you have to check if image is loaded correctly. To do this just check if
image.dataisNULLor not.Secondly, after calling
imshowyou have to callwaitKeyto show image:http://opencv.willowgarage.com/documentation/cpp/user_interface.html#cv-waitkey
Here’s the whole code: