The openCV tutorial installation notes at OpenCV: OpenCV installation overview indicate that one could use a pre-built binary installation like Anaconda. It works, but it is a bit awkward. You can do:
conda create -n opencv_comp opencv pkg-config
conda activate opencv_comp
and then something like:
g++ -o tutorial_charuco_create_detect `pkg-config --cflags --libs opencv` tutorial_charuco_create_detect.cpp
LD_LIBRARY_PATH=`pkg-config --variable=libdir opencv` ./tutorial_charuco_create_detect -c=1 # create a charuco pattern in BoardImg.jpg
Anaconda environments allow you to set a LD_LIBRARY_PATH variable for the environment:
conda env config vars set LD_LIBRARY_PATH=`pkg-config --variable=libdir opencv
# then...
conda deactivate
conda activate opencv_comp
# get hello_world_opencv.cpp from gist
g++ -o hello_world `pkg-config --cflags --libs opencv` hello_world_opencv.cpp
./hello_world_opencv
The pkg-config
features enable folks to use a binary distribution for opencv experimentation without installing a full source installation. I imagine other third-party binary installs besides Anaconda have similar features.
I opened an issue at Compiling tutorial_charuco_create_detect.cpp using opencv_contrib in Anaconda · Issue #2948 · opencv/opencv_contrib · GitHub since the Third-party binary installs seemed at least suggested in the docs
Is there a place to raise an issue with the tutorial doc specifically? It might be nice to add a couple lines under the Third-party Packages ‘Conda’ bullet point with hints on how to use it:
# Anaconda Example:
conda create -n opencv_comp opencv pkg-config
conda activate opencv_comp
# get hello_world_opencv.cpp from gist
g++ -o hello_world `pkg-config --cflags --libs opencv` hello_world_opencv.cp
LD_LIBRARY_PATH=`pkg-config --variable=libdir opencv` ./hello_world_opencv