Hardware triggered, continuous video acquisition with Basler GigE camera

23 vues (au cours des 30 derniers jours)
Iris
Iris le 1 Sep 2014
Réponse apportée : Andrei le 24 Oct 2024 à 15:20
I am using a Basler acA1300-60gm camera. I am able to acquire video using the matlab gigE drivers either with imaqtool, or directly through matlab. I can trigger the acquisition of a single frame with an external hardware trigger, but my problem is that I need to acquire multiple frames per hardware trigger, and am unable to do this.
The Basler proprietary drivers (which are now uninstalled, as per matlab gigE installation instructions) have an "AcquisitionMode" setting to switch between single frame and continuous mode. However, this property does not appear on the Imaqtool device properties, which I understood to mean that I cannot access it via matlab. Setting the vidobj.FramesPerTrigger to a value greater than one does not seem to have any effect. I was understanding this to mean that the camera is fixed in SingleFrame by the GigE controller, and that this overrides Matlab's FramesPerTrigger - could this be?
Below are my current camera settings.
If anyone has experience with continuous, triggered video acquisition through Matlab using a Basler gigE Camera, and has any thoughts/suggestions, they would be much appreciated. Am I missing an obvious way to access the AcquisitionMode parameter?
Many thanks in advance Iris
---------------- src =
Display Summary for Video Source Object:
General Settings:
Parent = [1x1 videoinput]
Selected = on
SourceName = input1
Tag = [0x0 string]
Type = videosource
Device Specific Properties:
AcquisitionFrameRateAbs = 25
AcquisitionFrameRateEnable = True
AcquisitionStartTriggerActivation = RisingEdge
AcquisitionStartTriggerDelayAbs = 0
AcquisitionStartTriggerMode = On
AcquisitionStartTriggerSource = Line1
ActionCommandCount = 1
ActionDeviceKey = 0
ActionGroupKey = 0
ActionGroupMask = 0
ActionSelector = 1
AllBlackLevelRaw = 0
AllGainRaw = 0
AnalogAllGainRaw = 0
AOI1AutoFunctionAOIHeight = 1024
AOI1AutoFunctionAOIOffsetX = 1
AOI1AutoFunctionAOIOffsetY = 1
AOI1AutoFunctionAOIUsageIntensity = True
AOI1AutoFunctionAOIUsageWhiteBalance = False
AOI1AutoFunctionAOIWidth = 1280
AOI2AutoFunctionAOIHeight = 1024
AOI2AutoFunctionAOIOffsetX = 1
AOI2AutoFunctionAOIOffsetY = 1
AOI2AutoFunctionAOIUsageIntensity = False
AOI2AutoFunctionAOIUsageWhiteBalance = True
AOI2AutoFunctionAOIWidth = 1280
AutoExposureTimeAbsLowerLimit = 20
AutoExposureTimeAbsUpperLimit = 350000
AutoFunctionProfile = GainMinimum
AutoGainRawLowerLimit = 0
AutoGainRawUpperLimit = 95
AutoTargetValue = 128
BalanceWhiteAdjustmentDampingAbs = 0.97656
BalanceWhiteAdjustmentDampingRaw = 1000
BinningHorizontal = 1
BinningModeHorizontal = Summing
BinningModeVertical = Summing
BinningVertical = 1
CenterX = False
CenterY = False
Counter1CounterEventSource = FrameTrigger
Counter1CounterResetSource = Off
Counter2CounterEventSource = FrameStart
Counter2CounterResetSource = Off
DecimationHorizontal = 1
DecimationVertical = 1
DeviceFirmwareVersion = 106200-10;U;acA1300_60g;V3.15-6;0
DeviceID = 21531505
DeviceManufacturerInfo = none
DeviceModelName = acA1300-60gm
DeviceScanType = Areascan
DeviceUserID = [0x0 string]
DeviceVendorName = Basler
DeviceVersion = 106200-10
DigitalAllGainRaw = 0
DigitalShift = 0
ExpertFeature1_LegacyExpertFeatureAccessKey = 0
ExpertFeature1_LegacyExpertFeatureEnable = False
ExpertFeature1ExpertFeatureAccessKey = 0
ExpertFeature1ExpertFeatureEnable = False
ExpertFeature2ExpertFeatureAccessKey = 0
ExpertFeature2ExpertFeatureEnable = False
ExpertFeature3ExpertFeatureAccessKey = 0
ExpertFeature3ExpertFeatureEnable = False
ExpertFeature4ExpertFeatureAccessKey = 0
ExpertFeature4ExpertFeatureEnable = False
ExpertFeature5ExpertFeatureAccessKey = 0
ExpertFeature5ExpertFeatureEnable = False
ExpertFeature6ExpertFeatureAccessKey = 0
ExpertFeature6ExpertFeatureEnable = False
ExpertFeature7ExpertFeatureAccessKey = 0
ExpertFeature7ExpertFeatureEnable = False
ExposureAuto = Off
ExposureMode = Timed
ExposureTimeAbs = 5000
ExposureTimeRaw = 5000
FeatureSet = Full
FileOpenMode = Read
FrameStartTriggerActivation = RisingEdge
FrameStartTriggerDelayAbs = 0
FrameStartTriggerMode = Off
FrameStartTriggerSource = Line1
GainAuto = Off
GainRemoveLimits = False
Gamma = 1
GammaEnable = False
GammaSelector = User
GrayValueAdjustmentDampingAbs = 0.68359
GrayValueAdjustmentDampingRaw = 700
LastError = InvalidParameter
Line1LineDebouncerTimeAbs = 10
Line1LineFormat = OptoCoupled
Line1LineInverter = False
Line1LineMode = Input
Line1LineStatus = False
Line1MinOutPulseWidthAbs = 0
LineLogic = Negative
LineStatusAll = 0
Out1LineDebouncerTimeAbs = 0
Out1LineFormat = OptoCoupled
Out1LineInverter = False
Out1LineMode = Output
Out1LineSource = UserOutput
Out1LineStatus = False
Out1MinOutPulseWidthAbs = 0
PacketDelay = 0
PacketSize = 2000
PixelColorFilter = None
PixelDynamicRangeMax = 255
PixelDynamicRangeMin = 0
ReadoutTimeAbs = 14762
ResultingFramePeriodAbs = 19810
ResultingFrameRateAbs = 50.4796
ReverseX = False
SequenceAdvanceMode = Auto
SequenceCurrentSet = 0
SequenceEnable = False
SequenceSetExecutions = 1
SequenceSetIndex = 0
SequenceSetTotalNumber = 2
ShutterMode = Global
SyncUserOutput1SyncUserOutputValue = False
SyncUserOutputValueAll = 0
TestImageSelector = Off
TimestampTickFrequency = 125000000
UserOutput1UserOutputValue = False
UserOutputValueAll = 0
Value1UserDefinedValue = 0
Value2UserDefinedValue = 0
Value3UserDefinedValue = 0
Value4UserDefinedValue = 0
Value5UserDefinedValue = 0
VendorDefectPixelCorr = False

Réponses (2)

Hanshin
Hanshin le 23 Sep 2014
Hello Iris,
I recently started using the MATLAB Image acquisition toolbox and encountered a (I think) similar issue as yours. I use a AVT Gige camera and their SDK library has a C function to set the acquisition mode to 'continuous' like what you had in your camera. So, it is possible to let the camera stream continuously while I can pick most recent frame to display or process. I believe that the SDK automatically recycles image buffers so that the camera memory can be used efficiently. As you said, it appears that MATLAB's toolbox does not provide this functionality. Hope they do in the future. However MATLAB doesn't seem touching this parameter. It seems like MATLAB does not care about this parameter (perhaps overiding is the right term as you said).
For me, one way to get around this problem is to basically keep empty buffer(s) in the camera (or computer in case MATLAB?) memory by reading out image(s) from the buffer as soon as a frame is acquired. This is sort of like what the AVT SDK provided. A continuous acquisition is what I need to do anyway. So, what I did was to set up a 'FramesAcquiredFcn' call back function where it does 'getdata(obj,1)'. In this case, I needed to read out only the last frame (1) so that the total FramesAvailable is always 1 frame less than whatever maximum your memory allows (at which MATLAB flags an error). It appears that 'FramesAvailable' indicates how many frames are stored in the camera (or assigned computer) memory. With my current setting, MATLAB flags an error after reaching about 250 frames. In reality, I never got to the maximum frames even if I set 'FramesPerTrigger' to 'Inf'. Once 'start' is issued, the acquisition never stops until you issue 'stop' or the process is forced to stop for some reason. After stopping a continuous acquisition for about 4 min with the maximum frame rate of 17fps (~ 4000 frames), 'FramesAvailable' remained 0 (or 1 if stop happens before reading out) as expected (at least in my case).
Hopefully this is helpful for you.
Good luck! Hanshin

Andrei
Andrei le 24 Oct 2024 à 15:20
AcquisitionFrameCount camera property value plays a role when using a hardware trigger configuration. It's likely this is set by default to 1 when the camera is powered on.
In more recent MATLAB releases (since R2016a), you can set the AcquisitionFrameCount property to a desired value.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by