Ask Your Question

Pietro's profile - activity

2014-03-25 06:53:14 -0600 commented question First Program OpenCV 2.4.8 with VS2012 not working

@berak thanks I work at debug mode and 32 bit processor.

2014-03-25 05:54:46 -0600 asked a question First Program OpenCV 2.4.8 with VS2012 not working

Hi all,

I'm trying to run my first project with OpenCV 2.4.8 and VS 2012. This is the code:

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

cv::Mat image = cv::imread("c:\\img.jpg");
//std::cout << cv::imread("C:\\img.jpg") << std::endl; --> this print out []
cv::namedWindow("MyImage");
cv::imshow("MyImage",image);
cv::waitKey(10000);
return 1;

}

And I have this error:

Opencv error assertion failed (size.width 0 && size.height 0) in cv::imshow, file C:\builds\2_4_PackSlave-win32-vc11-shared\opencv\modules\highgui\scr\window.cpp,line 261

In addition, if I run this code, instead the previous code, I have no errors:

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

IplImage* iplImage = cvLoadImage("c:\\img.jpg");
cv::Mat image(iplImage,false);
cv::namedWindow("MyImage");
cv::imshow("MyImage",image);
cv::waitKey(10000);
return 1;

}

Can you help me please?