Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Face-recognition program in Galileo IoT DevKit

Hi everybody.

I have the image IoT DevKit installed in my Galileo platform and I would like to write a program, it can be in python to do face recognition. I want my program works like that: There will be two folders: resources and results. Inside of resources I want another two folders (person1 and person2) and inside both I want to include pictures .jpg of faces. There will be a webcam connected in Galileo. So I will stand in front of the camera in order it takes a picture of my face. I click in a button in my Galileo, then it will take a picture and verify if my face is inside of person1 or person2 folders and I want the program save the picture in results and give me a signal the person is in the system or not, for example printing in SSH terminal a message saying that and later I want to send this signal as 0 or 1 in an output to use in external circuits. The only program I have is to do face detection, take a look:

import numpy as np import cv2

it starts the caputre

capture = cv2.VideoCapture(0)

take the last received frame

ret,img = capture.read()

save as pic.jpg

cv2.imwrite('pic.jpg', img)

capture.release()

face_cascade = cv2.CascadeClassifier('/home/root/haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('/home/root/haarcascade_eye.xml')

img = cv2.imread('pic.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) roi_gray = gray[y:y+h, x:x+w] roi_color = img[y:y+h, x:x+w] eyes = eye_cascade.detectMultiScale(roi_gray) for (ex,ey,ew,eh) in eyes: cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)

cv2.imwrite('img.png', img)

This program also design squares on the eyes, mouth and face, so I have done the detection, but I still need the recognition. That's the first time I work with embedded systems and Galileo platform and all program I find is for linux in desktops. Thank you.

click to hide/show revision 2
No.2 Revision

updated 2015-05-13 08:39:33 -0600

berak gravatar image

Face-recognition program in Galileo IoT DevKit

Hi everybody.

I have the image IoT DevKit installed in my Galileo platform and I would like to write a program, it can be in python to do face recognition. I want my program works like that: There will be two folders: resources and results. Inside of resources I want another two folders (person1 and person2) and inside both I want to include pictures .jpg of faces. There will be a webcam connected in Galileo. So I will stand in front of the camera in order it takes a picture of my face. I click in a button in my Galileo, then it will take a picture and verify if my face is inside of person1 or person2 folders and I want the program save the picture in results and give me a signal the person is in the system or not, for example printing in SSH terminal a message saying that and later I want to send this signal as 0 or 1 in an output to use in external circuits. The only program I have is to do face detection, take a look:

import numpy as np
import cv2

cv2 # it starts the caputre

caputre capture = cv2.VideoCapture(0)

cv2.VideoCapture(0) # take the last received frame

frame ret,img = capture.read()

capture.read() # save as pic.jpg

pic.jpg cv2.imwrite('pic.jpg', img)

capture.release()

img) capture.release() face_cascade = cv2.CascadeClassifier('/home/root/haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('/home/root/haarcascade_eye.xml')

cv2.CascadeClassifier('/home/root/haarcascade_eye.xml') img = cv2.imread('pic.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) roi_gray = gray[y:y+h, x:x+w] roi_color = img[y:y+h, x:x+w] eyes = eye_cascade.detectMultiScale(roi_gray) for (ex,ey,ew,eh) in eyes: cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)

cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2) cv2.imwrite('img.png', img)

img)

This program also design squares on the eyes, mouth and face, so I have done the detection, but I still need the recognition. That's the first time I work with embedded systems and Galileo platform and all program I find is for linux in desktops. Thank you.