Ask Your Question

CharlyChi's profile - activity

2014-03-08 04:32:15 -0600 received badge  Popular Question (source)
2013-07-07 03:46:26 -0600 asked a question Python. Simple image Face Detection using OpenCV

I'm noobe in OpenCV and looking for simple python face detecting script. I've find one here http://suksant.com/2013/04/03/simple-face-detection-using-opencv/

But there is no rect. on face when script stops.

#!/usr/bin/python

import cv2
img = cv2.imread("Lenna.png")
hc = cv2.CascadeClassifier("haarcascade_frontalface_alt2.xml")
faces = hc.detectMultiScale(img)

for face in faces:
  cv2.rectangle(img, (face[0], face[1]), (face[0] + face[2], face[0] + face[3]), (255, 0, 0), 3)

cv2.imshow("Lenna's face", img)
if cv2.waitKey(5000) == 27:
  cv2.destroyWindow("Lenna's face")
cv2.imwrite("LennaFace.png", img)