takePhotos file
This commit is contained in:
		
							parent
							
								
									9f75eda8a5
								
							
						
					
					
						commit
						3f710e9ab3
					
				
							
								
								
									
										20
									
								
								takePhotos.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								takePhotos.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import numpy as np
 | 
			
		||||
from picamera import PiCamera
 | 
			
		||||
from time import sleep
 | 
			
		||||
 | 
			
		||||
def capture(numberOfPhotos, path):
 | 
			
		||||
    try:
 | 
			
		||||
        choice = input('Number of photos: ')
 | 
			
		||||
        print('Initializing camera')
 | 
			
		||||
	    camera = PiCamera()
 | 
			
		||||
	    camera.resolution = (640, 480)
 | 
			
		||||
        print('[ OK ] Camera')
 | 
			
		||||
	    sleep(2)
 | 
			
		||||
    except:
 | 
			
		||||
	    print('[ Error ] Can not initialize PiCamera')
 | 
			
		||||
    for i in range(0, numberOfPhotos):
 | 
			
		||||
        camera.capture(path+i+'.jpg')
 | 
			
		||||
        print('Captured '+str(i)'\nPath ('path+i+'.jpg)')
 | 
			
		||||
        sleep(1)
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user