@@ -148,6 +148,8 @@ 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
152+ bool allowAutoTrigger; // Flag that user allowed to trigger software triggered cameras automatically
151153
152154 gint64 *pixelFormats;
153155 guint pixelFormatsCnt;
@@ -189,6 +191,7 @@ CvCaptureCAM_Aravis::CvCaptureCAM_Aravis()
189191 exposureCompensation = 0 ;
190192 targetGrey = 0 ;
191193 frameID = prevFrameID = 0 ;
194+ allowAutoTrigger = false ;
192195
193196 num_buffers = 10 ;
194197 frame = NULL ;
@@ -275,6 +278,7 @@ bool CvCaptureCAM_Aravis::open( int index )
275278 exposure = exposureAvailable ? arv_camera_get_exposure_time (camera) : 0 ;
276279 gain = gainAvailable ? arv_camera_get_gain (camera) : 0 ;
277280 fps = arv_camera_get_frame_rate (camera);
281+ softwareTriggered = (strcmp (arv_camera_get_trigger_source (camera), " Software" ) == 0 );
278282
279283 return startCapture ();
280284 }
@@ -290,6 +294,9 @@ bool CvCaptureCAM_Aravis::grabFrame()
290294 ArvBuffer *arv_buffer = NULL ;
291295 int max_tries = 10 ;
292296 int tries = 0 ;
297+ if (softwareTriggered && allowAutoTrigger) {
298+ arv_camera_software_trigger (camera);
299+ }
293300 for (; tries < max_tries; tries ++) {
294301 arv_buffer = arv_stream_timeout_pop_buffer (stream, 200000 );
295302 if (arv_buffer != NULL && arv_buffer_get_status (arv_buffer) != ARV_BUFFER_STATUS_SUCCESS) {
@@ -494,6 +501,12 @@ double CvCaptureCAM_Aravis::getProperty( int property_id ) const
494501 return out;
495502 }
496503 break ;
504+
505+ case CAP_PROP_ARAVIS_AUTOTRIGGER:
506+ {
507+ return allowAutoTrigger ? 1 . : 0 .;
508+ }
509+ break ;
497510 }
498511 return -1.0 ;
499512}
@@ -578,6 +591,11 @@ bool CvCaptureCAM_Aravis::setProperty( int property_id, double value )
578591 }
579592 break ;
580593
594+ case CAP_PROP_ARAVIS_AUTOTRIGGER:
595+ {
596+ allowAutoTrigger = (bool ) value;
597+ }
598+ break ;
581599
582600 default :
583601 return false ;
0 commit comments