Logo Search packages:      
Sourcecode: gnome-mousetrap version File versions  Download package

def mouseTrap::ocvfw::ocvfw::cmShowLKPoints (   self  ) 

Callculate the optical flow of the set points and draw them in the image.

Arguments:
- self: The main object pointer.

Definition at line 179 of file ocvfw.py.

00179                               :
        """
        Callculate the optical flow of the set points and draw them in the image.
        
        Arguments:
        - self: The main object pointer.
        """
        
        # calculate the optical flow
        self.imgLKPoints["current"], status = cv.cvCalcOpticalFlowPyrLK (
            self.prevGrey, self.grey, self.prevPyramid, self.pyramid,
            self.imgLKPoints["last"], len( self.imgLKPoints["last"] ),
            cv.cvSize (20, 20), 3, len( self.imgLKPoints["last"] ), None,
            cv.cvTermCriteria (cv.CV_TERMCRIT_ITER|cv.CV_TERMCRIT_EPS,
                               20, 0.03), 0)

        # initializations
        counter = 0
        new_points = []

        for point in self.imgLKPoints["current"]:
            # go trough all the self.imgPoints

            if not status[counter]:
                # we will disable this point
                continue
            

            # this point is a correct point
            new_points.append( point )
            setattr(self, self.imgLKPoints["labels"][counter], cv.cvPoint(int(point.x), int(point.y)))
            
            # draw the current point
            cv.cvCircle (self.img, [point.x, point.y], 3, cv.cvScalar (0, 255, 0, 0), -1, 8, 0)
                         
            # increment the counter
            counter += 1

        
        #debug.debug( "ocvfw", "cmShowLKPoints: Showing %d LK Points" % counter )
        
        # set back the self.imgPoints we keep
        self.imgLKPoints["current"] = new_points
    
    def cmWaitKey( self, int ):


Generated by  Doxygen 1.6.0   Back to index