Ask Your Question
0

How to include the correct directory for OpenCV on raspberry?

asked 2020-07-16 06:11:12 -0500

updated 2020-07-16 06:20:43 -0500

berak gravatar image

I installed the openCV to my Raspberry following this tutorial but the files went to directory: usr/local/include/opencv4/opencv2 instead of usr/local/include/opencv2

And now compilation fail even if I use

#include <opencv4/opencv2/opencv.hpp>
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
-1

answered 2020-07-16 06:19:27 -0500

berak gravatar image

updated 2020-07-17 04:14:44 -0500

both are wrong (you have to drop the "opencv2" part).

for opencv4 please use:

/usr/local/include/opencv4

as "Include path" and

#include "opencv2/opencv.hpp"

in your cpp code

edit flag offensive delete link more

Comments

I'm telling you that this is my problem I have the error: openCV.cpp:1:10: fatal error: opencv2/opencv.hpp: No such file or directory

zisosak gravatar imagezisosak ( 2020-07-17 04:07:39 -0500 )edit

and, is there anything in /usr/local/include/opencv4/opencv2 ? go and have a look ... !!

did you run a proper make install before ?

berak gravatar imageberak ( 2020-07-17 04:13:18 -0500 )edit

Yes for both, and if I type: pkg-config --modversion opencv4 I have the output 4.2.0

zisosak gravatar imagezisosak ( 2020-07-17 04:31:03 -0500 )edit

it may sound silly but i forgot the leading / in /usr/local/include/opencv4 before (so did you above....)

berak gravatar imageberak ( 2020-07-17 04:50:50 -0500 )edit

Sorry I did understand where I have to use this path: /usr/local/include/opencv4

zisosak gravatar imagezisosak ( 2020-07-17 05:11:53 -0500 )edit

how do you compile your program ? (there must be some kind of cmdline)

berak gravatar imageberak ( 2020-07-17 05:13:30 -0500 )edit

no is not compiling because the files are in the directory usr/local/include/opencv4/opencv2 instead of usr/local/include/opencv2

zisosak gravatar imagezisosak ( 2020-07-17 12:43:24 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-07-16 06:11:12 -0500

Seen: 81 times

Last updated: Jul 17