The CamShift tracker
The CamShift
(Continuously Adaptive Mean Shift) algorithm is an image segmentation method that was introduced by Gary Bradski of OpenCV fame in 1998. It differs from MeanShift
in that a search window adjusts itself in size. If we have a well-segmented distribution (for example, face features that stay compact), this method will automatically adjust itself to the face sizes as the person moves closer or farther from the camera.
Note
We can find a CamShift
reference at http://docs.opencv.org/trunk/doc/py_tutorials/py_video/py_meanshift/py_meanshift.html.
We will now see the following example (trackingCamShift
) using this method:
void trackingCamShift(Mat& img, Rect search_window) { //1-Criteria to CamShift function TermCriteria criteria(TermCriteria::COUNT | TermCriteria::EPS, 10, 1); //2-Tracking using CamShift RotatedRect found_object = CamShift(img, search_window, criteria); //3-Bounding rectangle and show the result Rect found_rect = found_object...