Thanks for working on this project. I am using Throlabs uc480 camera for realtime processing and saving of videos. Previously, I used openCV for this but it no longer works with these cameras. I was able to grab and save frames using the code below. Currently ,I can only record with default parameters (frame size: (1024, 1280), fps: 13.94 Hz, exposure_time: 10ms),
However, I want to record with 30-60 Hz and only grab small part of the frame (top left rectangle 180x120px). I tried to set framerate, exposure_time, _set_AOI but it did not work for various reasons. Changing framerate and exposure time did not change anything (I guess it is due to the large image size). I was able to change the height (not width) of the video capture by using set_AOI(0, 0, 180, 120), however, latest_frame returns the same frame all the time (not sure whether this is due to the wait_for_frame or latest_frame).
I wanted to ask whether it is possible to set frame_size and framerate for live_video or is there any other way I can do a realtime processing of the video stream (eg. grab_frames).
I would appreciate any help.
# imports
import cv2
import numpy as np
from instrumental.drivers.cameras import uc480
# init camera
instruments = uc480.list_instruments()
cam = uc480.UC480_Camera(instruments[0])
# params
ls_frames = []
print(cam.DEFAULT_KWDS)
cam.start_live_video(framerate = "30Hz")
print (cam.is_open, cam.framerate)
#cam._set_exposure("5ms")
#cam._set_AOI(0, 0, 180, 120)
while (i < total_frames):
flag = cam.wait_for_frame(timeout = "0 ms")
if flag:
i = i + 1
frame = cam.latest_frame(copy = False)
frame = frame.astype('uint8')
ls_frames.append(frame)
'''
Hello,
Thanks for working on this project. I am using Throlabs uc480 camera for realtime processing and saving of videos. Previously, I used openCV for this but it no longer works with these cameras. I was able to grab and save frames using the code below. Currently ,I can only record with default parameters (frame size: (1024, 1280), fps: 13.94 Hz, exposure_time: 10ms),
However, I want to record with 30-60 Hz and only grab small part of the frame (top left rectangle 180x120px). I tried to set framerate, exposure_time, _set_AOI but it did not work for various reasons. Changing framerate and exposure time did not change anything (I guess it is due to the large image size). I was able to change the height (not width) of the video capture by using set_AOI(0, 0, 180, 120), however, latest_frame returns the same frame all the time (not sure whether this is due to the wait_for_frame or latest_frame).
I wanted to ask whether it is possible to set frame_size and framerate for live_video or is there any other way I can do a realtime processing of the video stream (eg. grab_frames).
I would appreciate any help.