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 开发者_StackOverflow中文版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?
You should include opencv/highgui.h
.
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
精彩评论