Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    def paintp(self, frame):

        pt = self.p

        print pt[0]

        for p in pt:
            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, (255, 255, 255), 2)
Ejemplo n.º 3
0
    def paintp(self, frame, color):

        pt = self.p

        for p in pt:
            x, y, h, w, _, _ = p
            #x, y, h, w, _ = p
            rot_box = (x, y), (h, w), 0
            # OpenCV 2.4.8
            box = cv2.cv.BoxPoints(rot_box)
            """
            # OpenCV 3.0.0
            box = cv2.boxPoints(rot_box)
            """
            box = np.int0(box)
            cv2.drawContours(frame, [box], 0, color, 1)
Ejemplo n.º 4
0
    def paintp(self, frame, color):

        pt = self.p

        for p in pt:
            x, y, h, w, _, _ = p
            #x, y, h, w, _ = p
            rot_box = (x, y), (h, w), 0
            # OpenCV 2.4.8
            box = cv2.cv.BoxPoints(rot_box)
            """
            # OpenCV 3.0.0
            box = cv2.boxPoints(rot_box)
            """
            box = np.int0(box)
            cv2.drawContours(frame, [box], 0, color, 1)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)