How to use a frame grabbed asynchronously with Vimba Python?

760 views Asked by At

I am working with a system that uses an Allied Vision Camera with Vimba Python.

Currently, I grab frames synchronously inside a loop, convert them into numpy arrays and append those to a list.

for _ in range(10):
    frame = cam.get_frame()
    img = np.ndarray(buffer=frame._buffer, dtype=np.uint16, shape=(frame._frame.height, frame._frame.width))
    vTmpImg.append(img)

I need to optimize this process because it takes a significant amount of time. It would be ideal that the camera started streaming, taking frames and putting them in a queue or something and the I could retrieve them when I needed them. I figured that a good way to handle it is taking the frames asynchronously.

I've read the examples that Vimba has on asynchronous_grab, but it is still not clear to me how can I grab the frames that the camera is taking.

Does anyone know how to approach it?

Thanks in advance.

1

There are 1 answers

0
T F On

What is unclear about the asynchronous grab? The code or the concept? Maybe asynchronous_grab_opencv.py is easier to modify. It transforms the frame into an OpenCV frame that can then be modified/saved etc in the Handler class. Basically, switch out the imshow command line for whatever you want to do with your frames.