morefigs / pymba

Python wrapper for Allied Vision's Vimba C API
MIT License
105 stars 84 forks source link

Framerate Limit #118

Open ryanmgriffiths opened 4 years ago

ryanmgriffiths commented 4 years ago

I am attempting to work some high frame rates (~300fps). I have everything set up correctly and the features list shows the correct absolute frame rate limit but using time.time and acquiring 300 frames with:

with Vimba as vimba: camera = vimba.camera(0) camera.open() camera.arm('continuous', incrementing_function, frame_number) start = time.time()

camera.start_frame......

while counter < frame_number: pass

camera.end_frame..... end = time.time() - start

Disarm & close

the time taken is ~3,5 seconds which is an effective frame rate of 83fps. Furthermore if I reduce the absolute frame rate limit below this then I can see that the lower frame rate was being achieved. I get trashed frames when exceeding this limit.

I also have a similar program running in Visual Studio on the C API which is able to match the exact absolute frame rate limit set on Vimba Viewer. It doesn't seem like python speed should be the limitation since the frames are announced by calling the frame number as an argument to the arm function and the callback executes a simple incrementing counter.

Gabry993 commented 4 years ago

Usually while loops with pass inside kill performances. Try to replace 'pass' with time.sleep(0.1) for example