

import numpy as np
import cv2
import sys
face_cascade = cv2.CascadeClassifier('charan1.xml')
video_capture = cv2.VideoCapture(0)
id=raw_input('enter your id')
sampleNum=0;
while True:
    # Capture frame-by-frame
    ret, frame = video_capture.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for (x,y,w,h) in faces:
        sampleNum=sampleNum+1;
        cv2.imwrite("dataSet/user."+str(id)+"."+str(sampleNum)+".jpg",gray[y:y+h,x:x+w])
        cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)
        cv2.waitKey(100);
    
    cv2.imshow('Video', frame)
    cv2.waitKey(1);
    if(sampleNum>70):
       break
video_capture.release()
cv2.destroyAllWindows()

04856955bea95812a12e3040b50f560bdfc413d1
<mask token>

<mask token>
while True:
    ret, frame = video_capture.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for x, y, w, h in faces:
        sampleNum = sampleNum + 1
        cv2.imwrite('dataSet/user.' + str(id) + '.' + str(sampleNum) +
            '.jpg', gray[y:y + h, x:x + w])
        cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
        cv2.waitKey(100)
    cv2.imshow('Video', frame)
    cv2.waitKey(1)
    if sampleNum > 70:
        break
video_capture.release()
cv2.destroyAllWindows()

<mask token>
face_cascade = cv2.CascadeClassifier('charan1.xml')
video_capture = cv2.VideoCapture(0)
id = raw_input('enter your id')
sampleNum = 0
while True:
    ret, frame = video_capture.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for x, y, w, h in faces:
        sampleNum = sampleNum + 1
        cv2.imwrite('dataSet/user.' + str(id) + '.' + str(sampleNum) +
            '.jpg', gray[y:y + h, x:x + w])
        cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
        cv2.waitKey(100)
    cv2.imshow('Video', frame)
    cv2.waitKey(1)
    if sampleNum > 70:
        break
video_capture.release()
cv2.destroyAllWindows()

import numpy as np
import cv2
import sys
face_cascade = cv2.CascadeClassifier('charan1.xml')
video_capture = cv2.VideoCapture(0)
id = raw_input('enter your id')
sampleNum = 0
while True:
    ret, frame = video_capture.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for x, y, w, h in faces:
        sampleNum = sampleNum + 1
        cv2.imwrite('dataSet/user.' + str(id) + '.' + str(sampleNum) +
            '.jpg', gray[y:y + h, x:x + w])
        cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
        cv2.waitKey(100)
    cv2.imshow('Video', frame)
    cv2.waitKey(1)
    if sampleNum > 70:
        break
video_capture.release()
cv2.destroyAllWindows()



import numpy as np
import cv2
import sys
face_cascade = cv2.CascadeClassifier('charan1.xml')
video_capture = cv2.VideoCapture(0)
id=raw_input('enter your id')
sampleNum=0;
while True:
    # Capture frame-by-frame
    ret, frame = video_capture.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for (x,y,w,h) in faces:
        sampleNum=sampleNum+1;
        cv2.imwrite("dataSet/user."+str(id)+"."+str(sampleNum)+".jpg",gray[y:y+h,x:x+w])
        cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)
        cv2.waitKey(100);
    
    cv2.imshow('Video', frame)
    cv2.waitKey(1);
    if(sampleNum>70):
       break
video_capture.release()
cv2.destroyAllWindows()
