错误:imread 不是 cv 的成员
问题描述:
我使用 OpenCV 3.0 和 Ubuntu 14.04.我正在尝试使用 opencv 在 ubuntu 上编译一些代码.我收到错误
I use OpenCV 3.0 and Ubuntu 14.04. I'm trying to compile a few codes on ubuntu using opencv. I get error
"错误:'imread' 不是 'cv' 的成员"
"error: 'imread' is not a member of 'cv'"
由于我之前的搜索知识,我尝试通过添加highgui.h"来编译.
Due to my previous search knowledge, I tried compiling by adding "highgui.h".
我使用:
$g++ main.cpp HOG.cpp HOGFeaturesOfBlock.cpp -I/usr/local/include/opencv -lml -lcvaux -highgui -lcv -lcxcore -o featureExtractor
在终端上编译.
有什么建议吗?问候.可以.
Any suggest? Regards. Can.
答
以下命令应该可以工作.如果它不起作用,您应该检查是否正确设置了包含/lib 文件.
The following commands should work. If it doesn't work you should check if you set the include/lib files correctly.
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\core\core.hpp>
#include <opencv\cv.hpp>
using namespace cv;
Mat image = imread(filename, CV_LOAD_IMAGE_COLOR);