92es / Thermal-Camera-Redux

Topdon TC001 (and clone) thermal camera app to read and display live and offline thermal data
62 stars 13 forks source link

tc001.cpp Error #3

Closed pprahlada closed 1 month ago

pprahlada commented 7 months ago

Hello,

I have a TOPDON TC001 camera connected to my Raspberry Pi 4. I downloaded the code and am attempting to run the tc001.cpp file. However when I build, I am met with multiple errors. Is there a step I am missing or are there additional files I need?

`g++ -Wall -o "tc001" "tc001.cpp" -std=c++11 -w (in directory: /home/pi/Downloads/Thermal-Camera-Redux-main/src)

tc001.cpp: In function ‘int openCamera(cv::VideoCapture&, char*, int)’: tc001.cpp:4935:29: error: ‘class cv::VideoCapture’ has no member named ‘getBackendName’ cout << "Backend: " << cap.getBackendName() << endl; ^ tc001.cpp:4940:11: error: ‘CAP_PROP_BITRATE’ was not declared in this scope cap.get(CAP_PROP_BITRATE), ^ tc001.cpp:4941:11: error: ‘CAP_PROP_CODEC_PIXEL_FORMAT’ was not declared in this scope cap.get(CAP_PROP_CODEC_PIXEL_FORMAT), ^ Compilation failed. `

There are more errors but I am omitting them for the sake of not flooding this issue. Thank you.

92es commented 7 months ago

pprahlada,

It looks like you do not have the proper OpenCV libraries installed or they are not being found by your compile/link line.

Did you follow the RPi install and build instructions from the link below to install the relevant libraries and header files ?

RPi Build Instructions

Install: sudo apt update && sudo apt install libopencv-dev

What OS and version are you using on the RPi ?

What version of the OpenCV libraries are you using ?

Are you using the build_redux_rpi shell script (from the link above) to build with the following compile and link line ?

g++ -Wall -Wextra -O3 -ffast-math ${DEFAULT_FLAGS} ${CFLAGS} -DUSE_ASSERT=0 -I/usr/include/opencv4 tc001.cpp thread.cpp -o redux -lpthread pkg-config --cflags --libs opencv4

You should build from the same directory you installed the source code in.

92es commented 7 months ago

pprahlada,

If your version of OpenCV is too old, it will not have these functions.

I am using OpenCV V4.51 on Debian Linux and RPi Desktop.

Here is a link to the OpenCV VideoCapture Class listing the methods based on specific version of the library:

cv::VideoCapture Class Reference

pprahlada commented 7 months ago

Thank you very much for the prompt response. My RPi uses Raspbian GNU/Linux 10. I have followed your steps and the sudo apt install libopencv-dev command installs version 3.2.0.

92es commented 7 months ago

Unfortunately, the OpenCV Link for version 3.2.0 indicates many API methods are missing for the Thermal Camera Redux app.

OpenCV 3.2.0 API Docs

Can you update your OS to a newer version based off of Debian 11 (Bullseye) or 12 (Bookworm) ?

Newer should be better.

11 (Bullseye) is listed as (Legacy) on RPi's OS URL, so 10 (Buster) is getting long in the tooth.

RPi OS versions

The tester (Amish Technician) that did most of the RPi testing did it on the latest versions of RPi on his various SBCs.

pprahlada commented 7 months ago

Hi, apologies for the delayed responses, I have limited access to my raspberry pi. I don't think I am able to upgrade my OS. When I install libopencv-dev, it tells me that 3.2.0 is the latest version. Is it possible for me to install a specific version? I get the following errors when I try to build:

rm: cannot remove './redux': No such file or directory Package opencv4 was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv4.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv4' found

I have also installed OpenCV 4.9 from their official github and have encountered similar issues.

92es commented 7 months ago

From what I understand, OpenCV relies on the OS's back end to support a lot of functions. If the OS/Graphics system does not support the features, neither does OpenCV. This app requires the CAP_V4L (Video for Linux) back end.

I do not know if OpenCV 4.9 is compatible with RPi based on Buster(10), or if it is and omits unsupported backend features.

I don't believe anyone has tried it on Buster (10).

I have never had to touch pkg-config from an application/build perspective. Installing opencv handled everything.

I only had to add the "-I/usr/include/opencv4" include path.

It looks like your build (assume after installing 4.9 ???) has gone backwards from the initial attempt (unless you were using a different build command than what is in build_redux_rpi.

https://github.com/92es/Thermal-Camera-Redux/blob/main/src/build_redux_rpi

Is your install in this "-I/usr/include/opencv4" directory, or has it been renamed or installed else where ?

You might need to change the "-I" include line if your installation is different.

FWIW, my PKG_CONFIG_PATH environment variable is empty.

Here is the contents of my opencv4.pc (for version 4.5.1) from my Debian 11 install.

I have never had to alter, nor directly reference it either from Debian or RPi desktop.

/usr/lib/x86_64-linux-gnu/pkgconfig/opencv4.pc

Package Information for pkg-config

prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib/x86_64-linux-gnu includedir=${prefix}/include/opencv4

Name: OpenCV Description: Open Source Computer Vision Library Version: 4.5.1 Libs: -L${exec_prefix}/lib/x86_64-linux-gnu -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_dnn -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core Libs.private: -ldl -lm -lpthread -lrt Cflags: -I${includedir}

Here is the same information from my RPi Desktop install:

/usr/lib/i386-linux-gnu/pkgconfig/opencv4.pc

Package Information for pkg-config

prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib/i386-linux-gnu includedir=${prefix}/include/opencv4

Name: OpenCV Description: Open Source Computer Vision Library Version: 4.5.1 Libs: -L${exec_prefix}/lib/i386-linux-gnu -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_dnn -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core Libs.private: -ldl -lm -lpthread -lrt Cflags: -I${includedir}

92es commented 1 month ago

Need to install current version of RPi OS. Issue closed.