Hi
I’m trying to learn tracker using C++.
I have created code as shown in picture but the compilation showed failed in tracker->update(frame,bbox). I’m not sure what I’ve done wrong. I’m trying to find similar topic in this forum but found nothing. Please help.
And this is the compilation message
g++ $(pkg-config opencv4 --cflags --libs) -o g++ $(pkg-config raspicam --cflags --libs) -o TestTracking TestTracking.cpp (in directory: /home/pi/Desktop/OpenCV_Work)
TestTracking.cpp: In function ‘int main()’:
TestTracking.cpp:23:35: error: cannot bind non-const lvalue reference of type ‘cv::Rect&’ {aka ‘cv::Rect_<int>&’} to an rvalue of type ‘cv::Rect_<int>’
bool ok = tracker->update(frame,trackingBox);
^~~~~~~~~~~
In file included from /usr/local/include/opencv4/opencv2/core.hpp:57,
from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
from TestTracking.cpp:1:
/usr/local/include/opencv4/opencv2/core/types.hpp:1848:1: note: after user-defined conversion: ‘cv::Rect_<_Tp>::operator cv::Rect_<_Tp2>() const [with _Tp2 = int; _Tp = double]’
Rect_<_Tp>::operator Rect_<_Tp2>() const
^~~~~~~~~~
In file included from /usr/local/include/opencv4/opencv2/video.hpp:56,
from /usr/local/include/opencv4/opencv2/opencv.hpp:89,
from TestTracking.cpp:1:
/usr/local/include/opencv4/opencv2/video/tracking.hpp:737:10: note: initializing argument 2 of ‘virtual bool cv::Tracker::update(cv::InputArray, cv::Rect&)’
bool update(InputArray image, CV_OUT Rect& boundingBox) = 0;
^~~~~~
Compilation failed.
I’m using opencv 4.5.5 in raspberry pi with C++
Thank you very much
Best regard
acjoker