Unapiedra
Unapiedra

Reputation: 16218

Error on building OpenCV (C++)

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

I am using:

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?

Upvotes: 3

Views: 3972

Answers (2)

stefano
stefano

Reputation: 609

You should include opencv/highgui.h.

Upvotes: 6

Tim Meyer
Tim Meyer

Reputation: 12600

You might have to actually include the OpenCV library and the headers in your CMake configuration file. Especially looking at include_directories for the header files and target_link_libraries for the library itself

Upvotes: 0

Related Questions