I am trying to implement face recognition using python and Open Cv. I have successfully implemented face detection using python by following few tutorials available and its working fine.
Now what I am trying to do is to do face recognition I have followed few tutorials but none of them is working for me.
I have followed this tutorial which was clear enough but the code there is throwing a syntax error.
https://oscarliang.com/raspberry-pi-face-recognition-opencv/
I tried to run this code
import cv
cv.NamedWindow(“w1”, cv.CV_WINDOW_AUTOSIZE)
camera_index = 0
capture = cv.CaptureFromCAM(camera_index)
def repeat():
global capture #declare as globals since we are assigning to them now
global camera_index
frame = cv.QueryFrame(capture)
cv.ShowImage(“w1″, frame)
c = cv.WaitKey(10)
if(c==”n”): #in “n” key is pressed while the popup window is in focus
camera_index += 1 #try the next camera index
capture = cv.CaptureFromCAM(camera_index)
if not capture: #if the next camera index didn’t work, reset to 0.
camera_index = 0
capture = cv.CaptureFromCAM(camera_index)
while True:
repeat()
but I am getting following error in line number 6
There's an error in your program:expected an intended block.
I tried my best to solve it but nothing worked.
As I am a newbie to raspberry pi and python, any help will be appreciated.
Thanks in advance.