In open CV, python how can i remove lag in the camera
<p>I am working on Odroid and running face detection using openCV python on it. But there is too much lag in the camera. I have tried a lot of things but couldn't remove the lag. Please suggest how can i remove the lag. I want to detect faces from at least 15 feet for that I need  high resolution images, but high resolution images cause more lag. Currently I am having 2 second lag between frames. If there are suggestions please share.</p>

<pre><code>import cv2, sys, numpy, os
import json
size = 3
fn_haar = 'haarcascade_frontalface_default.xml'
fn_haareye = 'haarcascade_eye.xml'
(im_width, im_height) = (112, 92)
haar_cascade = cv2.CascadeClassifier(fn_haar)
eye_cascade = cv2.CascadeClassifier(fn_haareye)
webcam = cv2.VideoCapture(0)
while True:
    (rval, frame) = webcam.read()
    frame=cv2.flip(frame,1,0)
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    mini = cv2.resize(gray, (gray.shape[1] / size, gray.shape[0] / size))
    faces = haar_cascade.detectMultiScale(mini,scaleFactor=1.05, minNeighbors=3, minSize=(20, 20), flags = cv2.cv.CV_HAAR_SCALE_IMAGE)
    for i in range(len(faces)):
        face_i = faces[i]
        (x, y, w, h) = [v * size for v in face_i]
        face = gray[y:y + h, x:x + w]
        face_resize = cv2.resize(face, (im_width, im_height))
        eyes = eye_cascade.detectMultiScale(face)
        for (ex,ey,ew,eh) in eyes:
            cv2.rectangle(face_resize ,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)
    cv2.imshow('OpenCV', frame)
    key = cv2.waitKey(10)
    if key == 27:
        break
</code></pre>