user2758580 user2758580 - 6 months ago 22
Linux Question

OpenCV: where can I find CV_WINDOW_AUTOSIZE constants?

I have tried to build the sample program from OpenCV documentation, but i have encountered a problem:


error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope


Source of program:

#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( argv[1], 1 );

if( argc != 2 || !image.data )
{
printf( "No image data \n" );
return -1;
}

namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
imshow( "Display Image", image );

waitKey(0);

return 0;
}


I think that
CV_WINDOW_AUTOSIZE
constants have been contained in a certain header file, but I can't find the necessary header file.

Answer

since all the windowing stuff is in the highgui module, you'll need

#include <opencv2/highgui/highgui.hpp>

also, you'll need to link against the opencv_highgui library later

Comments