May-12-2017, 06:12 PM
Hi everyone, I would like to know if it is possible to run this code in my Flask app and turn on users camera to detect their faces. I tried but the server just crashes. Is there a way to do it with Python as my backend language or I should switch to a different approach? Also is it possible instead of waiting for Q to be pressed to quit, to get it to quit with a value returned from user input?
face_detect = cv2.CascadeClassifier("C:\\Users\\HP\\Desktop\\workoutflow\\FLask\\Face\\haarcascade_frontalface_default.xml") camera = cv2.VideoCapture(0) while True: ret, img = camera.read() make_image_gray = cv2.cvtColor(img, cvt.COLOR_BGR2GRAY) user_face = face_detect.detectMultiScale(gray, 1.2, 5) for(x, y, w, h) in user_face: cv2.rectangle(img, (x,y), (x+w, y+h), (0, 255, 0),2) cv2.imshow("Face",img) cam.release() cv2.destroyAllWindows()