Anbu Kumar
Published

Human Face Detection

Human Face Detection application for Artificial Intelligence Applications using Jetson Nano Edge Computing Devises.

IntermediateShowcase (no instructions)3 hours1,053
Human Face Detection

Things used in this project

Hardware components

NVIDIA Jetson Nano Developer Kit
NVIDIA Jetson Nano Developer Kit
×1
Webcam, Logitech® HD Pro
Webcam, Logitech® HD Pro
×1

Software apps and online services

Visual Studio extension
.NET nanoFramework Visual Studio extension

Story

Read more

Code

Face Detection Python Code

Python
import cv2
print(cv2.__version__)
dispW=640
dispH=480
flip=2

#camSet='nvarguscamerasrc !  video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(dispW)+', height='+str(dispH)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
#cam= cv2.VideoCapture(camSet)

cam=cv2.VideoCapture(1)
face_cascade=cv2.CascadeClassifier('/home/anbu/Desktop/PyPro/cascade/face.xml')

while True:
    ret, frame = cam.read()
    gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
    faces=face_cascade.detectMultiScale(gray,1.3,5)
    for (x,y,w,h) in faces:
        cv2.rectangle(frame, (x,y),(x+w,y+h),(0,0,255),4)
    
    cv2.imshow('nanoCam',frame)
    cv2.moveWindow('nanoCam',0,0)
    if cv2.waitKey(1)==ord('q'):
        break
        
cam.release()
cv2.destroyAllWindows()

Credits

Anbu Kumar
21 projects • 81 followers
CodingScientist - Platform To Learn, Build, Code, Compile and Run your Artificial Intelligence applications on your own Autonomous Robot

Comments