fps test code added
This commit is contained in:
39
src/test code for fps/python/v4l2_capture_read.py
Normal file
39
src/test code for fps/python/v4l2_capture_read.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from PIL import Image
|
||||
import select
|
||||
import v4l2capture,time
|
||||
import subprocess
|
||||
import Queue,cv2
|
||||
|
||||
video = v4l2capture.Video_device("/dev/video0")
|
||||
#q=Queue.Queue()
|
||||
size_x, size_y = video.set_format(640, 480)
|
||||
|
||||
video.create_buffers(5)
|
||||
|
||||
#subprocess.check_call("v4l2-ctl -d /dev/video0 -c exposure_absolute=1/10",shell=True) # adjusting exposure time to 100 micro sec
|
||||
|
||||
video.queue_all_buffers()
|
||||
|
||||
video.start()
|
||||
|
||||
|
||||
c=0
|
||||
t_s=time.time() + 60
|
||||
while time.time() < t_s:
|
||||
select.select((video,), (), ())
|
||||
|
||||
image_data = video.read_and_queue()
|
||||
c=c+1
|
||||
#image = Image.frombytes("RGB", (size_x, size_y), image_data)
|
||||
#image.save("images/image%d.tiff" %c)
|
||||
|
||||
video.close()
|
||||
|
||||
print c
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user