VimbaPython
VimbaPython copied to clipboard
Fast acquisition with reduced ROI
Hi, I am trying to write a script to allow fast acquisition (1-2kHz) with a narrow, horizontal region of interest on the Manta G-040.
I'm having two problems. I have managed to get a script that uses FixedRate acquisition and saves the captured frames to disk. This is working well, but I can only seem to get to a framerate of around 150 even though I have specified a 200fps framerate, and have turned the exposure all the way down to 25. My code is below (apologies for the link, formatting was buggy when I pasted my code here); I mostly stole the solution in Issue #62 and adjusted slightly so I could use FixedRate triggering instead of Software. I did this so I could manually set the framerate with cam.AcquisitionFrameRateAbs.set().
Is this just a limit of Python, or am I doing something wrong here?
Secondly, I wanted to ask about adjusting region of interest. I can do this in the Vimba Viewer software, and have found some mention of it in the Camera and Driver Attributes documents, but couldn't find any mention of adjusting the region of interest in the API source code. Could someone point me in the right direction?
Thanks!
Thank you for raising this question. The camera can achieve around 286fps in RAW pixelformat. So i request you to set the pixel format as follows in Vimba Python cam.set_pixel_format(PixelFormat.Mono8) cam.set_pixel_format(PixelFormat.BayerRG8)
The ROI can be set in Vimba Python as follows cam.OffsetX.set(value) cam.Width.set(value) cam.OffsetY.set(value) cam.Height.set(value)
In Vimba this can be done under All->ImageFormatControl->OffsetX() All->ImageFormatControl->Width() All->ImageFormatControl->OffsetY() All->ImageFormatControl->Height()
Thanks! That's worked for me. I had to generate an array of pixel formats using formats = cam.get_pixel_formats(), and then used cam.set_pixel_format(formats[0]) to set to Mono8. I couldn't find BayerRG8, but it seems like this has improved things. ROI also works exactly as you explained.
I am still finding that my script calculates a lower framerate than I have set, but I think this might be because of how I am calculating framerate: I am taking the time between beginning of acquisition until the end of the script, and I am dividing the total number of images saved by this. I guess I am taking processing/saving time into account as well, so the actual framerate may in fact be higher.
Thanks again for the quick response!