Quesion on OpenCV used in Eclipse Linux
With my eclipse, I have configured environment for opencv, but it appears always the problem like:
Building file: ../HelloWorld.cpp Invoking: Cross G++ Compiler arm-linux-gnueabihf-g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"HelloWorld.d" -MT"HelloWorld.d" -o "HelloWorld.o" "../HelloWorld.cpp" ../HelloWorld.cpp:1:30: fatal error: opencv2/opencv.hpp: No such file or directory compilation terminated. make: * [HelloWorld.o] Error 1
I have inserted /usr/local/include dans include paths and /usr/local/lib dans libraries paths.
And Here is my programme:
#include <opencv2/opencv.hpp>
#include<iostream>
#include<vector>
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
cv::Mat frame;
cv::Mat back;
cv::Mat fore;
cv::VideoCapture cap(0);
cv::BackgroundSubtractorMOG2 bg;
bg.nmixtures = 3;
bg.bShadowDetection = false;
std::vector<std::vector<cv::Point> > contours;
cv::namedWindow("Frame");
cv::namedWindow("Background");
for(;;)
{
cap >> frame; bg.operator ()(frame,fore);
bg.getBackgroundImage(back);
cv::erode(fore,fore,cv::Mat());
cv::dilate(fore,fore,cv::Mat());
cv::findContours(fore,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE);
cv::drawContours(frame,contours,-1,cv::Scalar(0,0,255),2);
cv::imshow("Frame",frame);
cv::imshow("Background",back);
if(cv::waitKey(30) >= 0)
break;
}
return 0;
}
g++ -I /path/to/opencv/build/include ... // <-- big i there
sorry, I don't understand!!!
you need to add /path/to/opencv/build/include to your include path in eclipse.
or, if you compile from cmdline, add -I /path/to/opencv/build/include there
I have insert /usr/local/include/opencv2 in include paths and /usr/local/lib in libraries paths, but the eclipse cannot also find the opencv.hpp which just in file opencv2