cu-ecen-aeld / final-project-abbottwhitley

final-project-abbottwhitley created by GitHub Classroom
0 stars 0 forks source link

Initial OpenCV setup and unit-test with Buildroot #7

Closed abbottwhitley closed 3 years ago

abbottwhitley commented 3 years ago

Install all necessary packages and verify functionality of OpenCV setup for Buildroot on RPI4. Utilize previous course material noted below.

DoD: Successfully capture an image using OpenCV libraries and camera module

abbottwhitley commented 3 years ago

Successfully captured image using Buildroot/RPI setup and Logitech C270 camera module as described by OpenCV for Buildroot

abbottwhitley commented 3 years ago

Buildroot documentation notes the following opencv3 version.

OPENCV3_VERSION = 3.4.13

buildroot/package/opencv3/opencv3.mk

abbottwhitley commented 3 years ago

OpenCV Host machine setup trouble shooting

abbottjc@abbottjc-VirtualBox:~/CU_Boulder/opencv/samples/cpp/example_cmake$ pkg-config --cflags opencv
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found

https://stackoverflow.com/questions/15320267/package-opencv-was-not-found-in-the-pkg-config-search-path

Need to add opencv.pc to the PKG_CONFIG_PATH environment variable https://askubuntu.com/questions/210210/pkg-config-path-environment-variable

abbottjc@abbottjc-VirtualBox:~/CU_Boulder/opencv$ find -name opencv.pc
./build/unix-install/opencv.pc
$ OPENCV_PC=/home/abbottjc/CU_Boulder/opencv/build/unix-install/
$ export PKG_CONFIG_PATH=$OPENCV_PC

Also had issues finding the libopencv_highgui.so.3.4 lib

abbottjc@abbottjc-VirtualBox:~/CU_Boulder/opencv/samples/cpp/example_cmake$ ./opencv_example
./opencv_example: error while loading shared libraries: libopencv_highgui.so.3.4: cannot open shared object file: No such file or directory

Need to add libopencv_highgui.so.3.4 to the LD_LIBRARY_PATH environment variable https://stackoverflow.com/questions/61624400/libopencv-highgui-so-3-4-cannot-open-shared-object-file-no-such-file-or-direct

abbottjc@abbottjc-VirtualBox:~/CU_Boulder/opencv$ find -name libopencv_highgui.so.3.4
./build/lib/libopencv_highgui.so.3.4
$ OPENCV_LIB=/home/abbottjc/CU_Boulder/opencv/build/lib
$ export LD_LIBRARY_PATH=$OPENCV_LIB

Outputs now show as follows

abbottjc@abbottjc-VirtualBox:~/CU_Boulder/opencv$ pkg-config --cflags opencv
-I/installation/OpenCV-/include/opencv -I/installation/OpenCV-/include

abbottjc@abbottjc-VirtualBox:~/CU_Boulder/opencv$ pkg-config --libs opencv -L/installation/OpenCV-/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_cvv -lopencv_dnn_objdetect -lopencv_dpm -lopencv_highgui -lopencv_videoio -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_sfm -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ml -lopencv_ximgproc -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core

The following lines were added to the ~/.bashrc file to make the above changes permanent

#Add opencv library dir to PATH
export PATH="/home/abbottjc/CU_Boulder/opencv/modules/core/include:$PATH"
export PATH="/home/abbottjc/CU_Boulder/opencv/modules/objdetect/include/:$PATH"
#Add opencv.pc to the PKG_CONFIG_PATH environment variable
export PKG_CONFIG_PATH=/home/abbottjc/CU_Boulder/opencv/build/unix-install/
#Add libopencv_highgui.so.3.4 to the LD_LIBRARY_PATH environment variable
export LD_LIBRARY_PATH=/home/abbottjc/CU_Boulder/opencv/build/lib
#Set environment OpenCV_DIR variable equal to path containing OpenCVConfig.cmake
export OpenCV_DIR=/home/abbottjc/CU_Boulder/opencv/build/
abbottwhitley commented 3 years ago

Met requirements for this issues DOD. Still trouble shooting issues with OpenCV Facedetection libraries, to be managed in another issue. Closing issue. See status commits below.

Buildroot Repo Commit Application Code Repo