| 321 | # detects a face in the image |
| 322 | # img : the input image |
| 323 | def detectFace(self, img): |
| 324 | # the img is upscaled so that it become larger than 512 pix |
| 325 | upscale = 512 / max(img.shape[0], img.shape[1]) |
| 326 | print 'detecting', upscale, img.shape |
| 327 | #img = self.improve(img) |
| 328 | detected = self.detector(img, upscale) |
| 329 | if len(detected) == 0: |
| 330 | return None |
| 331 | |
| 332 | face = detected[0] |
| 333 | img = img[face.top(): face.bottom(), face.left(): face.right()] |
| 334 | return img |
| 335 | |
| 336 | # sets the text of the progress bar |
| 337 | def setProgress(self, value, text, wait=10): |