-1

I am new in openCV. I have a c++ code like below.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, const char *argv[])
{
    Mat img(480,640,CV_8UC3,Scalar(255,0,0));
    if(img.empty())
    {
        cout<<"Picture can not load..."<<endl;
        return -1;
    }
    nameWindow("test",CV_WINDOW_AUTOSIZE);
    imshow("test",img);
    waitKey(0);
    destroyWindow("test");
    return 0;
} 

I try to compile this code in ubuntu 14.04. But when i do

g++ resimac.cpp  

it gives an error:

error: ‘nameWindow’ was not declared in this scope
  nameWindow("test",CV_WINDOW_AUTOSIZE);
                                      ^

What is the problem? How to solve it?

namco
  • 6,208
  • 20
  • 59
  • 83

1 Answers1

0

nameWindow("test",CV_WINDOW_AUTOSIZE);

You are missing the 'd'. The correct format should be namedWindow("test",CV_WINDOW_AUTOSIZE);

http://docs.opencv.org/modules/highgui/doc/user_interface.html#namedwindow

Jeff S
  • 250
  • 6
  • 13