Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: imread is not a member of cv

I use OpenCV 3.0 and Ubuntu 14.04. I'm trying to compile a few codes on ubuntu using opencv. I get error

"error: 'imread' is not a member of 'cv'"

Due to my previous search knowledge, I tried compiling by adding "highgui.h".

I use:

$g++ main.cpp HOG.cpp HOGFeaturesOfBlock.cpp -I/usr/local/include/opencv -lml -lcvaux -highgui -lcv -lcxcore -o featureExtractor

on terminal to compile.

Any suggest? Regards. Can.

like image 408
CanCam Avatar asked Nov 14 '15 10:11

CanCam


2 Answers

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);
like image 70
mask Avatar answered Sep 25 '22 04:09

mask


#include <opencv2/imgcodecs.hpp> 

solved the problem which contains the imread function

like image 41
letsdev-cwack Avatar answered Sep 23 '22 04:09

letsdev-cwack