From b9cdde69911289b45c3686d2eee223f814380c97 Mon Sep 17 00:00:00 2001 From: yash Date: Tue, 18 Mar 2014 08:44:33 +0530 Subject: [PATCH] edited sample code for mean/cam sihft and fixed an error --- doc/py_tutorials/py_video/py_meanshift/py_meanshift.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/py_tutorials/py_video/py_meanshift/py_meanshift.rst b/doc/py_tutorials/py_video/py_meanshift/py_meanshift.rst index a111311af3..87ece69350 100644 --- a/doc/py_tutorials/py_video/py_meanshift/py_meanshift.rst +++ b/doc/py_tutorials/py_video/py_meanshift/py_meanshift.rst @@ -52,7 +52,7 @@ To use meanshift in OpenCV, first we need to setup the target, find its histogra # set up the ROI for tracking roi = frame[r:r+h, c:c+w] - hsv_roi = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) + hsv_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv_roi, np.array((0., 60.,32.)), np.array((180.,255.,255.))) roi_hist = cv2.calcHist([hsv_roi],[0],mask,[180],[0,180]) cv2.normalize(roi_hist,roi_hist,0,255,cv2.NORM_MINMAX) @@ -127,7 +127,7 @@ It is almost same as meanshift, but it returns a rotated rectangle (that is our # set up the ROI for tracking roi = frame[r:r+h, c:c+w] - hsv_roi = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) + hsv_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv_roi, np.array((0., 60.,32.)), np.array((180.,255.,255.))) roi_hist = cv2.calcHist([hsv_roi],[0],mask,[180],[0,180]) cv2.normalize(roi_hist,roi_hist,0,255,cv2.NORM_MINMAX)