def paintbestp(self, frame, num, color): p = self.p[0] x, y, h, w = p rot_box = (x, y), (h, w), 0 box = cv2.cv.BoxPoints(rot_box) box = np.int0(box) cv2.drawContours(frame, [box], 0, color, 2) cv2.putText(frame, str(num), (int(x), int(y)), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 2)
def paintbestp(self, frame, num, color): x, y, h, w, vx, vy = self.p_star #@original #x, y, h, w, _ = p pstar_box = (x, y), (h, w), 0 paint_pstar=1 if paint_pstar: # OpenCV 2.4.8 box = cv2.cv.BoxPoints(pstar_box) """ # OpenCV 3.0.0 box = cv2.boxPoints(rot_box) """ box = np.int0(box) cv2.drawContours(frame, [box], 0, color, 2) cv2.putText(frame, str(num), (int(x), int(y)), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2) debug_flag=0 if debug_flag: print "Tr* = [%d,%d,%d,%d]" % (x,y,vx,vy) print "Tr mean:" print self.p_mean print "particles:" for ki in xrange(0,self.num_p-1): print self.p[ki] # OpenCV 2.4.8 box = cv2.cv.BoxPoints(self.rb) """ # OpenCV 3.0.0 box = cv2.boxPoints(self.rb) """ box = np.int0(box) if self.update: cv2.drawContours(frame, [box], 0, (0, 0, 255), 2)
def paintbestp(self, frame, num, color): x, y, h, w, vx, vy = self.p_star #@original #x, y, h, w, _ = p pstar_box = (x, y), (h, w), 0 paint_pstar = 1 if paint_pstar: # OpenCV 2.4.8 box = cv2.cv.BoxPoints(pstar_box) """ # OpenCV 3.0.0 box = cv2.boxPoints(rot_box) """ box = np.int0(box) cv2.drawContours(frame, [box], 0, color, 2) cv2.putText(frame, str(num), (int(x), int(y)), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2) debug_flag = 0 if debug_flag: print "Tr* = [%d,%d,%d,%d]" % (x, y, vx, vy) print "Tr mean:" print self.p_mean print "particles:" for ki in xrange(0, self.num_p - 1): print self.p[ki] # OpenCV 2.4.8 box = cv2.cv.BoxPoints(self.rb) """ # OpenCV 3.0.0 box = cv2.boxPoints(self.rb) """ box = np.int0(box) if self.update: cv2.drawContours(frame, [box], 0, (0, 0, 255), 2)
def paintnum(self, frame): cv2.putText(frame, str(self.num), self.subject.top, cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2)