Ask Your Question

#include "opencv2/photo.hpp" returns No such file or directory [closed]

asked 2020-03-20 13:04:30 -0500

andrei186 gravatar image

updated 2020-03-20 13:08:34 -0500

freshly installed Ubuntu 18 and openCV C++

pkg-config --modversion opencv returns: 3.4.10

g++ --version returns: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Yet compiling the sample decolor.cpp with

g++ -std=c++11 decolor.cpp -o fish -I /home/a/Downloads/installation/OpenCV-3.4/include/opencv2  -L /home/a/Downloads/installation/OpenCV-3.4/lib -lopencv_core -lopencv_highgui


decolor.cpp:18:10: fatal error: opencv2/photo.hpp: No such file or directory

Indeed line 18 is:

 #include "opencv2/photo.hpp"


 dir /home/a/Downloads/installation/OpenCV-3.4/include/opencv2

shows photo.hpp sitting there

What am am I doing wrong? Perhaps some environment variables want change?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by andrei186
close date 2020-03-22 05:48:41.926812


I use windows but on windows it is /home/a/Downloads/installation/OpenCV-3.4/include

LBerger gravatar imageLBerger ( 2020-03-20 13:43:59 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-03-20 13:53:57 -0500

mvuori gravatar image

Your -I already points to the opencv2 subdir, so drop that in the #include

edit flag offensive delete link more



Stupid me! Thank you, this helped

andrei186 gravatar imageandrei186 ( 2020-03-21 01:52:57 -0500 )edit

Question Tools

1 follower


Asked: 2020-03-20 13:04:30 -0500

Seen: 49 times

Last updated: Mar 20