alliedvision / VimbaPython

Old Allied Vision Vimba Python API. The successor to this API is VmbPy
BSD 2-Clause "Simplified" License
93 stars 40 forks source link

Always return to set AcquisitionFrameRate? #63

Open rk-exxec opened 3 years ago

rk-exxec commented 3 years ago

Hey,

i am setting my camera to 30 fps at program start with

def set_framerate(self, fps=30.0):
    with self._vimba:
        with self._cam:
            range = self._cam.AcquisitionFrameRate.get_range()
            self._cam.AcquisitionFrameRateEnable.set(True)
            self._cam.AcquisitionFrameRate.set(min( max(fps, range[0]), range[1] ))

If the exposure is set to a value higher than the framerate would allow, the framerate is reduced, this is expected. My issue is, that the framerate does not increase to 30 again after lowering the exposure enough. And I cannot change it while that cam is running.

I set some keybinds to increase or decrease exposure time for quick checking of alignments and such. Stopping the cam every time I use those keybindings to reset the framerate is somewhat time-consuming:

Is there a better way to do this? I need the constant framerate, because I am recording the video to a file. Thanks!

rk-exxec commented 3 years ago

Ideally, the camera would always send 30 fps and maybe duplicate frames if the exposure is too high. But that is not supported by the Alvium 1800 U-319m model, is it?

arunprakash-avt commented 3 years ago

One way to change the framerate back to 30 fps after changing the exposure time would be to perform a AcquisitionStop and then change the framerate. Acquisition frame rate cannot be changed in the runtime of the camera. The framerate does not change to the maximum value automatically. One way to perform is to work in freerun mode. Limit the Device Throughput limit for 30fs. If the exposure value changes and get back to the last exposure value the framerate will also come back to the maximum fps.