1 Reply Latest reply on Apr 28, 2015 7:33 AM by mhahn

    face detect python+opencv


      Hi again!

      I try script python+opencv with face detection, but don`t work, I try with other script to capture image from webcam Logitech and it is perfect.

      But only I need print display “Detect” but my board does nothing.

      The script is the following:

      import numpy as np

      import cv2

      import sys


      cap = cv2.VideoCapture(-1)




      1. cap.set(3,640)
      2. cap.set(4,480)



      if not cap.isOpened():

          print "La camara NO OK"



          print "La camara OK"

          while True:

              ret, img = cap.read()

              cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt2.xml")

              rects = cascade.detectMultiScale(img, 1.3, 4, cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))

              if not len(rects) == 0 :

                  print "Detect"


      1. cap.release()

      In this folder I put haarcascade_frontalface_alt2.xml and in my windows with the IDLE Python works perfectly.

      What’s wrong? any ideas??

      Thank you MamenGil