VimbaPython icon indicating copy to clipboard operation
VimbaPython copied to clipboard

Can't make image capture with external trigger work

Open cnavarrete opened this issue 3 years ago • 6 comments

Hello I need to capture images using an external trigger, after reading the manual for the API I used the code below to set the camera in trigger mode, but that didn't work, next I used Vimba viewer to do the same and that did work. The only options I changed in the TriggerIO tab were:

Trigger

Source: Line0
Selector: FrameStart
Activ.: RisingEdge
Mode: On

The acquisition mode was already set to "Continuous". Something interesting, if I print TriggerSource using the get method the option is still set as "Software" instead of "Line0". By the way I'm using Vimba 4.2 modified to work with python3.6.9, been using it like this for months and it hasn't give me any trouble, so I doubt it's that.

self.__cam.TriggerSource.set("Line0")
self.__cam.TriggerSelector.set("FrameStart")
self.__cam.TriggerMode.set("On")
self.__cam.TriggerActivation.set("RisingEdge")
self.__cam.AcquisitionMode.set("Continuous")

#Trigger source is still set as "software"
logger.info(f'Trigger source {self.__cam.TriggerSource.get()}')

cnavarrete avatar Jun 07 '21 05:06 cnavarrete

I believe the problem might stem from the fact, that you are not changing the TriggerSelector feature first. Please try setting the features in the following order in your code:

self.__cam.TriggerSelector.set('FrameStart')
self.__cam.TriggerSource.set('Line0')
self.__cam.TriggerActivation.set('RisingEdge')
self.__cam.AcquisitionMode.set("Continuous")
self.__cam.TriggerMode.set('On')

The TriggerSelector is a special kind of feature named a "Selector". These features select from a set of possible values and depending on the value might load values for other, effected features. In the case of the TriggerSelector feature, these effected features include the other trigger features like TriggerSource, TriggerActivation and TriggerMode. Essentially for every value in TriggerSelector a set of feature values for the other effected features exists. This is kind of hard to visualize.

By default for my camera (Alvium U-500m) the TriggerSelector is set to AcquisitionStart. Since your code changes TriggerSource first, the TriggerSource value corresponding to AcquisitionStart is set to Line0. Then you are changing the TriggerSelector to FrameStart, essentially loading a new set of values for the effected features. I hope the following helps in explaining this a bit as I find it hard to describe the behavior in text.

TriggerSelector = AcquisitionStart:
    TriggerSource = Line0              <- Value changed in your first line of code
    TriggerActivation = RisingEdge
    TriggerMode = Off
TriggerSelector = FrameStart:          <- loaded in your second line of code
    TriggerSource = Software
    TriggerActivation = RisingEdge
    TriggerMode = Off                  <- Set in your third line of code

Rearranging your code should hopefully take care of this issue. If you are still having trouble getting external triggers to work please comment here again and I will take another look.

Thanks that was indeed the problem and now I can grab images using an external trigger. I have a couple of questions, first how do I "turn off" the trigger mode if I want to capture images automatically again? Looks like I'm stuck with the external trigger until I reboot the board, by the way I'm testing a couple of ALVIUM 1800 U-501 NIR connected to a Jetson Xavier NX.

The second question is how can I reach 67 fps via external trigger? A couple of days ago I tested the same "triggering device" with an ALVIUM 1800 C-158 and I could reach 50fps no problem, just as advertised. My problem is that even if I set the trigger to 67fps I'm only receiving 34fps in the callback function, by the way without the trigger I can reach 67fps, finally the value for "devicelinkthroughputlimit" is the same when I capture images via external triggering and when I do without it.

cnavarrete avatar Jun 08 '21 22:06 cnavarrete

how do I "turn off" the trigger mode if I want to capture images automatically again?

This should be as simple as setting the TriggerMode feature to Off again. The image acquisition would still depend on other features you have set on the camera (e.g. AcquisitionMode should probably be set to Continuous for "automatic capture").

My problem is that even if I set the trigger to 67fps I'm only receiving 34fps in the callback function, by the way without the trigger I can reach 67fps, finally the value for "devicelinkthroughputlimit" is the same when I capture images via external triggering and when I do without it.

If your other features are the same I would have expected you to be able to reach the same frame rate with hardware triggering as with free-run capturing. You already mention the DeviceLinkThroughputLimit which would have also been my first guess. Off the top of my head I can't think of a reason why you would not be able to reach the max fps with hardware triggering if you do reach it in free-run. This would be a good question for our general support team. I will try and ping them to take a look at this issue, but you can always contact them via the form on our website and they will be happy to help out! Feel free to also put a link to this Github issue in there. They should be able to help you better as the problem does not appear to be directly related to VimbaPython but more of a general camera question.

Hello!

if you are using a camera with rolling shutter, then the maximum framerate is reduced to the half when using SW or HW trigger. With global shutter sensor the maximum framerate can be achieved in freerun and in trigger mode

BernardoLuck avatar Jun 09 '21 06:06 BernardoLuck

Thank I will try to contact support, also what @BernardoLuck says it's pretty interesting.

Looks like there's a problem when submiting contact form "connection - Error connecting to Salesforce". I will try latter.

cnavarrete avatar Jun 09 '21 15:06 cnavarrete

Hi, the web formular should now work again. Please try again.

BR

Bernardo

BernardoLuck avatar Jun 10 '21 06:06 BernardoLuck