Ask Your Question
0

Quesion on OpenCV used in Eclipse Linux

asked 2014-02-20 05:33:56 -0600

yyyyazj gravatar image

updated 2014-02-20 05:43:08 -0600

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;

}

edit retag flag offensive close merge delete

Comments

g++ -I /path/to/opencv/build/include ... // <-- big i there

berak gravatar imageberak ( 2014-02-20 05:54:06 -0600 )edit

sorry, I don't understand!!!

yyyyazj gravatar imageyyyyazj ( 2014-02-21 04:50:22 -0600 )edit

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

berak gravatar imageberak ( 2014-02-21 06:42:15 -0600 )edit

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

yyyyazj gravatar imageyyyyazj ( 2014-03-06 02:19:45 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-02-20 10:03:40 -0600

shiv.butekar gravatar image

have u used cmake for ur opencv

edit flag offensive delete link more

Comments

yes, I used cmake to create the include and lib files in /usr, there I can find all libraries.

yyyyazj gravatar imageyyyyazj ( 2014-02-21 04:48:52 -0600 )edit

@shiv.butekar probably asked : have you used cmake to generate your current project ?

(as this would probably get the include path right)

berak gravatar imageberak ( 2014-02-21 06:41:14 -0600 )edit

You mean in order to use eclipse to find the libraries in opencv I have to also generate my project first?

yyyyazj gravatar imageyyyyazj ( 2014-03-06 02:21:21 -0600 )edit

Question Tools

Stats

Asked: 2014-02-20 05:33:56 -0600

Seen: 274 times

Last updated: Feb 20 '14