Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on building OpenCV (C++)

Building my code (below) returns error 'imread' is not a member of 'cv'.

I am using:

  • Ubuntu 11.04.
  • libcv is at 2.1.0-3ubuntu1
  • CMake as a build system (with only project(foo) and add_executable(foo main.cpp) in it.)

main.cpp:

#include <opencv/cv.h>
int main(int argc, char **argv) {
     cv::Mat src = cv::imread("frame_original.png", 0);
     return 0;
 }`

What do I need to include to get cv::imread to work?

imread is part of OpenCV 2.1: http://opencv.willowgarage.com/documentation/cpp/highgui_reading_and_writing_images_and_video.html?highlight=imread#imread But where is it on my system? What do I need to include? Where can I find the documentation that tells me which header file I need from OpenCV to use a specific function?

like image 529
Unapiedra Avatar asked Aug 09 '26 18:08

Unapiedra


1 Answers

You should include opencv/highgui.h.

like image 58
stefano Avatar answered Aug 12 '26 06:08

stefano