I'm working on Image processing project where I need to capture the image after getting trigger by sensor and need to process the image. Trigger is coming very fast at 200ms. so I need to capture and process between 200ms where the next trigger arises. I have tried stream option also, but finally I need RGB image(.jpg).
In my program I have used video port, sequence function so current capture time is 80ms-100ms.
So please guide me how to capture the image in very short time(ms) after every trigger,
Thanks in Advance.
Program:
Code: Select all
import time
from picamera.array import PiRGBArray
import picamera
from PIL import Image
import RPi.GPIO as GPIO
import serial
port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=2.0)
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, GPIO.PUD_UP)
with picamera.PiCamera() as camera:
camera.start_preview()
camera.framerate = 30
camera.resolution = (700,150)
time.sleep(2)
cnt = 0
while True:
cnt = cnt + 1
if (cnt>=101):
break
GPIO.wait_for_edge(17, GPIO.RISING)
start = time.time()
camera.capture_sequence([
'/home/pi/tray' + str(cnt) + '.jpg'], use_video_port=True)
if True:
port.write("\r\n@T10LA10LA10LA#")
print (time.time()-start)
camera.stop_preview()