Reputation: 277
With the function
cvMeanShift(&backproj, trackWindow,cvTermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 15, 1 ),&track_comp);
I can obtain a rectangle, aux=track_comp.rect;
But with this
RotatedRect trackBox = CamShift(backproj, trackWindow,TermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1 ));
How can I obtain a rectangle? not a rotated rectangle.
Upvotes: 1
Views: 750
Reputation: 767
The documentation is unclear, but the CamShift
function modifies trackWindow
to the latest position of the object. (trackWindow
is passed by reference). You should use the same trackWindow
variable for initialization of tracking for the next frame.
trackbox.boundingRect()
turns out to not give the same Rect
as the one written to trackWindow
. trackbox.boundingRect()
is bigger than the Rect
written to trackWindow
.
This answer is for opencv 2.4.5.0 and above. It probably holds for all opencv 2.0 and above though, but I have not verified this.
Upvotes: 1