yet to be tested

This commit is contained in:
HeshamTB 2018-11-22 06:14:31 +00:00
parent f7faddb00d
commit 2adae62a29
2 changed files with 19 additions and 5 deletions

View File

@ -3,8 +3,24 @@ from io import BytesIO
import cv2
import numpy as np
import os
import takePhotos;
def addPerson(label, ImagesPath, newFileName, oldFileName):
picCount = 0
def start():
print('Starting training..')
label = int(input('Label (Integer): '))
picCount = int(input('Number of Photos: '))
clearTrainFolder()
def clearTrainFolder():
print('clearing train folder')
filelist = [ f for f in os.listdir('train/') if f.endswith(".jpg") ]
for f in filelist:
os.remove(os.path.join('train/', f))
def addPerson(label, newFileName, oldFileName):
try:
#faceFilePath = '/faces/hesham-saeed2'
faceFile = 'faces/'+ oldFileName

View File

@ -5,9 +5,8 @@ from picamera import PiCamera
from time import sleep
import cv2
def capture(path):
def capture(count):
try:
choice = input('Number of photos: ')
print('Initializing camera')
camera = PiCamera()
camera.resolution = (640, 480)
@ -15,7 +14,7 @@ def capture(path):
sleep(2)
except:
print('[ Error ] Can not initialize PiCamera')
for i in range(1, choice):
for i in range(1, count):
camera.capture(path+str(i)+'.jpg')
photo = cv2.imread(path+str(i)+'.jpg',1)
cv2.imshow('Photo',photo)
@ -24,5 +23,4 @@ def capture(path):
sleep(1)
cv2.destroyAllWindows()
print('Done!')
capture('train/')