def find_face_from_img(img):
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.equalizeHist(gray)
rects = detect(gray, cascade)
if __name__ == '__main__':
    args, video_src = getopt.getopt(sys.argv[1:], '', ['cascade=',
        'nested-cascade='])
try:
    video_src = video_src[0]
except:
    video_src = 0
args = dict(args)
cascade_fn = args.get('--cascade', 'cascades/haarcascade_frontalface_alt.xml')
cascade = cv2.CascadeClassifier(cascade_fn)
c = cv2.VideoCapture(0)
while 1:
    ret, frame = c.read()
rects = find_face_from_img(frame)
if 255 & cv2.waitKey(5) == 27:
    break
Using OpenCV detectMultiScale to find my face