Skip to content

Commit 194304b

Browse files
authored
Support software triggering aravis cameras
If an aravis camera is software triggered, a trigger needs to be explicitly sent using `arv_camera_software_trigger`, otherwise the camera will not grab any frames.
1 parent cc9b199 commit 194304b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/videoio/src/cap_aravis.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class CvCaptureCAM_Aravis : public CvCapture
148148
double exposureCompensation;
149149
bool autoGain;
150150
double targetGrey; // Target grey value (mid grey))
151+
bool softwareTriggered; // Flag if the camera is software triggered
151152

152153
gint64 *pixelFormats;
153154
guint pixelFormatsCnt;
@@ -275,6 +276,7 @@ bool CvCaptureCAM_Aravis::open( int index )
275276
exposure = exposureAvailable ? arv_camera_get_exposure_time(camera) : 0;
276277
gain = gainAvailable ? arv_camera_get_gain(camera) : 0;
277278
fps = arv_camera_get_frame_rate(camera);
279+
softwareTriggered = (strcmp(arv_camera_get_trigger_source(camera), "Software") == 0);
278280

279281
return startCapture();
280282
}
@@ -290,6 +292,9 @@ bool CvCaptureCAM_Aravis::grabFrame()
290292
ArvBuffer *arv_buffer = NULL;
291293
int max_tries = 10;
292294
int tries = 0;
295+
if (softwareTriggered) {
296+
arv_camera_software_trigger (camera);
297+
}
293298
for(; tries < max_tries; tries ++) {
294299
arv_buffer = arv_stream_timeout_pop_buffer (stream, 200000);
295300
if (arv_buffer != NULL && arv_buffer_get_status (arv_buffer) != ARV_BUFFER_STATUS_SUCCESS) {

0 commit comments

Comments
 (0)