Error: cannot convert ‘cv::Mat::channels’ from type ‘int (cv::Mat::)() const’ to type ‘int’

Continuing the discussion from Object Detection on a Webcam with Yolo:

[Uploading: 164a33d0b7ebcfcd0c6c93e469bf6c9.png…](我按照这个方法在jetpack4.6上卡住了

N -c ./src/image_opencv.cpp -o obj/image_opencv.o
./src/image_opencv.cpp: In function ‘image mat_to_image(cv::Mat)’:
./src/image_opencv.cpp:46:12: error: cannot convert ‘cv::Mat::channels’ from type ‘int (cv::Mat::)() const’ to type ‘int’
int c = m.channels;
^~~~~~~~
compilation terminated due to -Wfatal-errors.
Makefile:84: recipe for target ‘obj/image_opencv.o’ failed
make: *** [obj/image_opencv.o] Error 1

Hi,

./src/image_opencv.cpp:46:12: error: cannot convert ‘cv::Mat::channels’ from type ‘int (cv::Mat::)() const’ to type ‘int’

Based on the error message, the image is a const variable.
This indicates the variable is immutable.

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.