コード例 #1
0
ファイル: cameo.py プロジェクト: Eelin-xyl/Python
 def run(self):
     """Run the main loop."""
     self._windowManager.createWindow()
     while self._windowManager.isWindowCreated:
         self._captureManager.enterFrame()
         self._hiddenCaptureManager.enterFrame()
         frame = self._captureManager.frame
         hiddenFrame = self._hiddenCaptureManager.frame
         
         if frame is not None:
             if hiddenFrame is not None:
                 self._faceTracker.update(hiddenFrame)
                 hiddenFaces = self._faceTracker.faces
                 self._faceTracker.update(frame)
                 faces = self._faceTracker.faces
             
                 i = 0
                 while i < len(faces) and i < len(hiddenFaces):
                     rects.copyRect(
                         hiddenFrame, frame, hiddenFaces[i].faceRect,
                         faces[i].faceRect)
                     i += 1
             
             filters.strokeEdges(frame, frame)
             self._curveFilter.apply(frame, frame)
             
             if hiddenFrame is not None and self._shouldDrawDebugRects:
                 self._faceTracker.drawDebugRects(frame)
         
         self._captureManager.exitFrame()
         self._hiddenCaptureManager.exitFrame()
         self._windowManager.processEvents()
コード例 #2
0
ファイル: cameo.py プロジェクト: sarvex/pycv
 def run(self):
     """Run the main loop."""
     self._windowManager.createWindow()
     while self._windowManager.isWindowCreated:
         self._captureManager.enterFrame()
         self._hiddenCaptureManager.enterFrame()
         frame = self._captureManager.frame
         hiddenFrame = self._hiddenCaptureManager.frame
         
         if frame is not None:
             if hiddenFrame is not None:
                 self._faceTracker.update(hiddenFrame)
                 hiddenFaces = self._faceTracker.faces
                 self._faceTracker.update(frame)
                 faces = self._faceTracker.faces
             
                 i = 0
                 while i < len(faces) and i < len(hiddenFaces):
                     rects.copyRect(
                         hiddenFrame, frame, hiddenFaces[i].faceRect,
                         faces[i].faceRect)
                     i += 1
             
             filters.strokeEdges(frame, frame)
             self._curveFilter.apply(frame, frame)
             
             if hiddenFrame is not None and self._shouldDrawDebugRects:
                 self._faceTracker.drawDebugRects(frame)
         
         self._captureManager.exitFrame()
         self._hiddenCaptureManager.exitFrame()
         self._windowManager.processEvents()