I have a dual camera hardware module for my raspberry pi zero. It requires some software to get working though. I have cloned the required repo from, as seen here:
pi@luna:~/RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 $ ls
arducam_multi_adapter_uc444.cpp Makefile obj readme.md shell
When I try to make, I get the following error:
pi@luna:~/RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 $ sudo make
g++ -c -o obj/arducam_multi_adapter_uc444.o arducam_multi_adapter_uc444.cpp `pkg-config --cflags --libs opencv`
arducam_multi_adapter_uc444.cpp:4:10: fatal error: opencv2/opencv.hpp: No such file or directory
4 | #include <opencv2/opencv.hpp>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:10: obj/arducam_multi_adapter_uc444.o] Error 1
Looking at /usr/include/opencv4/opencv2
I see the file this script wants.
pi@luna:~/RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 $ ls /usr/include/opencv4/opencv2
alphamat.hpp ccalib dnn_superres.hpp freetype.hpp imgcodecs line_descriptor.hpp opencv_modules.hpp quality shape superres video ximgproc
aruco ccalib.hpp dpm.hpp fuzzy imgcodecs.hpp mcc optflow quality.hpp shape.hpp superres.hpp video.hpp ximgproc.hpp
aruco.hpp core face fuzzy.hpp img_hash mcc.hpp optflow.hpp rapid.hpp stereo surface_matching videoio xobjdetect.hpp
bgsegm.hpp core_detect.hpp face.hpp hdf img_hash.hpp ml phase_unwrapping reg stereo.hpp surface_matching.hpp videoio.hpp xphoto
bioinspired core.hpp features2d hdf.hpp imgproc ml.hpp phase_unwrapping.hpp rgbd stitching text videostab xphoto.hpp
bioinspired.hpp datasets features2d.hpp hfs.hpp imgproc.hpp objdetect photo rgbd.hpp stitching.hpp text.hpp videostab.hpp
calib3d dnn flann highgui intensity_transform.hpp objdetect.hpp photo.hpp saliency structured_light tracking viz
calib3d.hpp dnn.hpp flann.hpp highgui.hpp line_descriptor opencv.hpp plot.hpp saliency.hpp structured_light.hpp tracking.hpp viz.hpp
I tried to create an opencv.pc as described in this earlier question, but the opencv.hpp is still not being found.
pi@luna:~/RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 $ cat /usr/local/lib/pkgconfig/opencv.pc
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: opencv
Description: The opencv library
Version: 2.x.x
Cflags: -I${includedir}/opencv -I${includedir}/opencv2
Libs: -L${libdir} -lopencv_calib3d -lopencv_imgproc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -lopencv_video -lopencv_highgui
I felt like that opencv.pc is not point to the right place as it resolves to /usr/include/opencv2
and on my pi, I have the files in /usr/include/opencv4/opencv2
, though even with tinkering with where the opencv.pc file points, I'm still running into the error above. I have since returned it to its original state and have modified my .bashrc
as they suggested.
pi@luna:~/RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 $ pkg-config --cflags --libs opencv
-I/usr/include/opencv -I/usr/include/opencv2 -lopencv_calib3d -lopencv_imgproc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -lopencv_video -lopencv_highgui
pi@luna:~/RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 $ echo $PKG_CONFIG_PATH
:/usr/local/lib/pkgconfig
I feel like something needs to be linked or pointed to somewhere to get make to see that opencv.hpp
file. If I go in and manually edit arducam_multi_adapter_uc444.cpp
's 4th line to the absolute path of the opencv.hpp
, I no longer get an error in arducam_multi_adapter_uc444.cpp
, but in opencv.hpp
as it then is included and starts looking for core.hpp
and other .hpp
s in /usr/include/opencv4/opencv2
. How can I fix this, I feel close, I just don't know how to tell make where to look.