Face recognition using raspberry pi, pi camera,python and Open Cv
<p>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.</p>

<p>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.</p>

<p>I have followed this tutorial which was clear enough but the code there is throwing a syntax error.</p>

<p><a href="https://oscarliang.com/raspberry-pi-face-recognition-opencv/" rel="nofollow">https://oscarliang.com/raspberry-pi-face-recognition-opencv/</a></p>

<p>I tried to run this code</p>

<pre><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()
</code></pre>

<p>but I am getting following error in line number 6 </p>

<blockquote>
  <p>There's an error in your program:expected an intended block.</p>
</blockquote>

<p>I tried my best to solve it but nothing worked.</p>

<p>As I am a newbie to raspberry pi and python, any help will be appreciated.</p>

<p>Thanks in advance.</p>