Working 0.2
This commit is contained in:
		
							parent
							
								
									7a550a20b2
								
							
						
					
					
						commit
						14a05c10d8
					
				
							
								
								
									
										14
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								main.py
									
									
									
									
									
								
							@ -6,7 +6,7 @@ import cv2
 | 
				
			|||||||
import numpy as np
 | 
					import numpy as np
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def init():
 | 
					def init():
 | 
				
			||||||
	go = true
 | 
						go = True
 | 
				
			||||||
	print('Initilizing Camera and cascade components..')
 | 
						print('Initilizing Camera and cascade components..')
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		camera = PiCamera()
 | 
							camera = PiCamera()
 | 
				
			||||||
@ -15,7 +15,7 @@ def init():
 | 
				
			|||||||
		print('[ OK ] Camera')
 | 
							print('[ OK ] Camera')
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		print('[ Error ] Can not initialize PiCamera')
 | 
							print('[ Error ] Can not initialize PiCamera')
 | 
				
			||||||
		go = false
 | 
							go = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
 | 
							face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
 | 
				
			||||||
@ -23,14 +23,14 @@ def init():
 | 
				
			|||||||
		print('[ OK ] CascadeClassifier')
 | 
							print('[ OK ] CascadeClassifier')
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		print('[ Error ] Can not load cascade File')
 | 
							print('[ Error ] Can not load cascade File')
 | 
				
			||||||
		go = false
 | 
							go = False
 | 
				
			||||||
	if (go):
 | 
						if (go):
 | 
				
			||||||
		print('Starting Photo loop..')
 | 
							print('Starting Photo loop..')
 | 
				
			||||||
		start(camera)
 | 
							start(camera, face_cascade)
 | 
				
			||||||
	else: 
 | 
						else: 
 | 
				
			||||||
		print('closing')
 | 
							print('closing')
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
def start(camera):
 | 
					def start( camera, face_cascade):
 | 
				
			||||||
	while True:
 | 
						while True:
 | 
				
			||||||
		try:
 | 
							try:
 | 
				
			||||||
			print('Taking photo')
 | 
								print('Taking photo')
 | 
				
			||||||
@ -61,9 +61,5 @@ def start(camera):
 | 
				
			|||||||
			print('Closing')
 | 
								print('Closing')
 | 
				
			||||||
			break
 | 
								break
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
def recognize():
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def sendOK():
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
init()
 | 
					init()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user