Code for controlling mbed hardware (LED's, motors), as well as code for the Raspberry Pi to run a Support Vector Machine that identifies objects using the Pi camera
Dependencies: mbed Motordriver mbed-rtos PololuLedStrip
Diff: pi/collectImages.py
- Revision:
- 1:183a8efd562a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pi/collectImages.py Thu Dec 05 23:23:06 2019 -0500 @@ -0,0 +1,28 @@ +import sys +import time +import picamera + + + +myargs = sys.argv[1:] + +camera = picamera.PiCamera() +camera.resolution = (352, 240) +camera.color_effects = (128, 128) # turn camera to black and white +camera.start_preview() +time.sleep(2) + + +if len(myargs) <= 1: + sys.exit("Incorrect arguments") + +num_images_per_type = int(myargs[0]) # number of images to take of each type of object + +print("Taking ", num_images_per_type, "images each of ", myargs[1:]) + +for image_type in myargs[1:]: + for i in range(num_images_per_type): + filename = image_type + "_" + str(i) + ".bmp" + camera.capture("images/"+filename, format='bmp', resize=(352, 240)) + print(filename) + time.sleep(1)