Ask Your Question

Revision history [back]

SLOW PROCESSING on raspberry pi using python

hi i am using raspberry pi for my final year project. i wrote some scripts for face detection, training and face recognition all are working fine but its very slow. it shows only single frame per second because of processing of each frame. i have to extend this work upto emotion detection as well hence i want to make it faster. i also ran same codes on my pc it was pretty fast which means my scripts are good but i would want it to be faster on my pi. Please HELP !!!

this is my face detection code

import numpy as np import cv2

detector= cv2.CascadeClassifier('haarcascade_frontalface_default.xml') cap = cv2.VideoCapture(0)

while(True): ret, img = cap.read() gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = detector.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(254,0,0),2) cv2.imshow('frame',img) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()

click to hide/show revision 2
No.2 Revision

SLOW PROCESSING on raspberry pi using python

hi i am using raspberry pi for my final year project. i wrote some scripts for face detection, training and face recognition all are working fine but its very slow. it shows only single frame per second because of processing of each frame. i have to extend this work upto emotion detection as well hence i want to make it faster. i also ran same codes on my pc it was pretty fast which means my scripts are good but i would want it to be faster on my pi. Please HELP !!!

this is my face detection code

import numpy as np
import cv2

cv2 detector= cv2.CascadeClassifier('haarcascade_frontalface_default.xml') cap = cv2.VideoCapture(0)

cv2.VideoCapture(0) while(True): ret, img = cap.read() gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = detector.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(254,0,0),2) cv2.imshow('frame',img) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()

cv2.destroyAllWindows()
click to hide/show revision 3
No.3 Revision

SLOW PROCESSING Slow processing on raspberry pi Raspberry Pi using pythonPython

hi i am using raspberry pi for my final year project. i wrote some scripts for face detection, training and face recognition all are working fine but its very slow. it shows only single frame per second because of processing of each frame. i have to extend this work upto emotion detection as well hence i want to make it faster. i also ran same codes on my pc it was pretty fast which means my scripts are good but i would want it to be faster on my pi. Please HELP !!!

this is my face detection code

import numpy as np
import cv2

detector= cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)

while(True):
    ret, img = cap.read()
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    faces = detector.detectMultiScale(gray, 1.3, 5)
    for (x,y,w,h) in faces:
        cv2.rectangle(img,(x,y),(x+w,y+h),(254,0,0),2)
    cv2.imshow('frame',img)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()