morefigs / pymba

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

Auto exposure failure #119

Open symphonyzoe opened 4 years ago

symphonyzoe commented 4 years ago

Hi, I'm using Mako G-508B GigE camera on raspberry pi 3b via Ethernet port. We need to let it do the metering before capture and fix the exposure time afterward. I managed to set the 'ExposureAuto' feature to 'Once', but it either went to the maximum exposure time(499993) or the minimum(32). The Vimba Viewer can set auto exposure successfully in both 'Once' and 'Continuous' mode and have the right exposure. Do you have any idea about this?

I'm not quite sure how to control the metering procedure, so I just did a forever loop to see if the exposure time would change to something reasonable:

camera.AcquisitionMode = 'Continuous'
camera.ExposureAuto = 'Once'
while 1:
    camera.startCapture()
    frame.queueFrameCapture()
    camera.runFeatureCommand('AcquisitionStart')
    camera.runFeatureCommand('AcquisitionStop')
    frame.waitFrameCapture()
    camera.endCapture()
    camera.revokeAllFrames()
    exposure = camera.ExposureTimeAbs
    print(exposure)

And it always ends up in 499993 or 32...

Besides, sometimes I got pictures like this: 20-01-07_10 46 13 019

Is there any way to avoid this?

Many thanks.

morefigs commented 4 years ago

I'm not sure about the exposure stuff, I find it takes a few iterations for exposure to "settle".

Regarding the bad frame, you should be able to ignore them by checking the receiveStatus or receiveFlags attributes of the frame. If it's a bad frame these will be different in my experience.