Ask Your Question

fatal error: opencv2/aruco.hpp: No such file or directory

asked 2020-05-30 12:40:35 -0600

Pigeon gravatar image

updated 2020-05-30 12:40:52 -0600


I installed Opencv and it worked just fine when I was working on QR Codes but now that i'm trying to use Aruco Markers I get this error.

Is there something I'm missing? My OpenCV version is the 4.1.0, it says "Compatibility: > OpenCV 3.0" here.

What should I do to fix that?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-05-30 12:56:46 -0600

berak gravatar image

updated 2020-05-30 13:06:09 -0600

My OpenCV version is the 4.1.0,

outdated, we're at 4.3 now, please update (else part 2 below won't work...)

I installed Opencv

but you did not download/compile with opencv_contrib, where the actual aruco code lives

please see there for further build instructions

edit flag offensive delete link more


I just tried to install the 4.3 version with opencv_contrib but i got this error: here (sorry for the image, the forum wouldn't let me paste the error text)

full message just in case : here

Pigeon gravatar imagePigeon ( 2020-05-30 15:28:30 -0600 )edit

you need exactly the same version for opencv main and contrib (SIFT was moved back into main, license expired)

the contrib modules are on the master branch by default, so either get master branch for main, too, or

cd opencv_contrib
git checkout 4.3

if you don't need them, you also could disable the tests for now


(then re-run cmake && make install)

berak gravatar imageberak ( 2020-05-31 01:49:53 -0600 )edit

I had the correct versions, but I had previously built opencv in the same path. Someone told me this:

As for why the error occurred, my hunch is that it's related to precompiled headers. Perhaps precompiled headers are already generated in that build directory and later some flags were changed that affected them but the precompiled headers were not regenerated. Was this directory previously used for another build, perhaps with the previous version, and not cleaned up?

It works now. I ran a small test program for opencv and for aruco marker. Thx for your help.

Pigeon gravatar imagePigeon ( 2020-05-31 09:04:55 -0600 )edit

Question Tools

1 follower


Asked: 2020-05-30 12:40:35 -0600

Seen: 6,349 times

Last updated: May 30 '20