#! /usr/bin/python2.7 # Program to Test Haar Features import picamera from SimpleCV import Image import time with picamera.PiCamera() as camera: camera.resolution = (640, 480) camera.start_preview() time.sleep(2) camera.capture('foto.jpg') foto = Image("foto.jpg") print(foto.listHaarFeatures()) trovati = foto.findHaarFeatures('face.xml') if trovati: for trovato in trovati: print "Face Found at Coordinates : " + str(trovato.coordinates()) trovato.draw() else: print "Not Found" camera.stop_preview() foto.save('foto1.jpg') foto.show() time.sleep(10)
#!/usr/bin/python2.7 # Programma test Haar Features import picamera from SimpleCV import Image import time with picamera.PiCamera() as camera: camera.resolution = (640, 480) camera.start_preview() time.sleep(10) camera.capture('foto.jpg') foto = Image("foto.jpg") print(foto.listHaarFeatures()) trovati = foto.findHaarFeatures('face.xml') if trovati: for trovato in trovati: print "Found all coordinate : " + str(trovato.coordinates()) trovato.draw() else: print "No found" camera.stop_preview() foto.save('foto1.jpg') foto.show() time.sleep(10)
#camera = PiCamera() #camera.start_preview() #sleep(2) #['right_eye.xml', 'lefteye.xml', 'face3.xml', 'glasses.xml', # 'right_ear.xml', 'fullbody.xml', 'profile.xml', 'upper_body2.xml', # 'face.xml', 'face4.xml', 'two_eyes_big.xml', 'right_eye2.xml', # 'left_ear.xml', 'nose.xml', 'upper_body.xml', 'left_eye2.xml', # 'two_eyes_small.xml', 'face2.xml', 'eye.xml', 'face_cv2.xml', # 'mouth.xml', 'lower_body.xml'] #camera.capture('img1.jpg') #img = Image('img1pg') img = Image('img1.jpg') disp = Display(img.size()) #while disp.isNotDone(): #img = cam.getImage() # camera.capture('img2.jpg') #img = Image('img2.jpg') whatt = img.listHaarFeatures() #print whatt faces = img.findHaarFeatures('face.xml') if faces is not None: faces = faces.sortArea() bigFace = faces[-1] bigFace.draw() img.save(disp) img.save('img11.jpg')