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

def mouseTrap::cam::Camera::_setForehead (   self,
  face 
) [private]

Detect the forehead point and set it.

Arguments:
- self: The main object pointer.
- points: A list with the cv.cvPoints detected.

Definition at line 171 of file cam.py.

00171                                   :
        """
        Detect the forehead point and set it.
        
        Arguments:
        - self: The main object pointer.
        - points: A list with the cv.cvPoints detected.
        """
        
        self.cmAddMessage("Getting Forehead!!!")

        if face:
            areas = [ (pt[1].x - pt[0].x)*(pt[1].y - pt[0].y) for pt in face]
            
            startF   = face[areas.index(max(areas))][0]
            endF     = face[areas.index(max(areas))][1]

        #eyes = self.cmGetHaarPoints( self.haarCds['Eyes'] )

        if not face:
            return True

        rec  = cv.cvRect( startF.x, startF.y,  endF.x - startF.x, endF.y - startF.y )

        eyes = self.cmGetHaarROIPoints( self.haarCds['Eyes'], rec, (startF.x, startF.y) )

        if eyes:
            areas = [ (pt[1].x - pt[0].x)*(pt[1].y - pt[0].y) for pt in eyes ]
                    #if pt[0].x in range(startF.x, endF.x) and pt[0].y in range(startF.y, endF.y) ]

            point1   = eyes[areas.index(max(areas))][0]
            point2   = eyes[areas.index(max(areas))][1]

            X = ( (point1.x + point2.x) / 2 )
            Y = ( point1.y + ( (point1.y + point2.y) / 2 ) ) / 2
            
            self.foreheadOrig = self.foreheadLast = cv.cvPoint( X, Y )
            self.cmSetLKPoints("forehead", self.foreheadOrig)
            return
                
        self.foreheadOrig = None
        
        
    def _procCapture( self ):


Generated by  Doxygen 1.6.0   Back to index