I am trying to run C ++ OpenCV programs in the Eclipse IDE on an Ubuntu 12.04 LTS. They work fine when I use the terminal as shown here: https://help.ubuntu.com/community/OpenCV .
But when I create the same code in Eclipse, I get the following error
Error Description -
opengl support available OpenCV error: approval failed (size.width> 0 & size.height> 0) in imshow, file / home / akash / OpenCV / opencv -2.4.7 / modules / highgui / src / window.cpp, line 269 terminate call after calling 'cv :: Exception' what (): / home / akash / OpenCV / opencv-2.4.7 / modules / highgui / src / window.cpp: 269: error: (-215) size.width > 0 && & size.height> 0 in the imshow function
My code
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img=imread("image.jpg");
namedWindow("win",WINDOW_AUTOSIZE);
imshow("win",img);
waitKey(0);
return 1;
}
I took care of the following -
- saved image.jpg in src and all other project folders.
- double checked library names in / usr / local / lib
- Only one include path has been added for OpenCV header files.
I still can not start it.
Please, help.
Akash source
share