Skip to content

Commit 1358c0a

Browse files
committed
Made automated triggering for ARAVIS cameras optional.
1 parent 194304b commit 1358c0a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

modules/videoio/include/opencv2/videoio.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,16 @@ enum { CAP_PROP_XI_DOWNSAMPLING = 400, //!< Chan
483483

484484
//! @} XIMEA
485485

486+
/** @name XIMEA Camera API
487+
* @{
488+
*/
489+
490+
//! Properties of cameras available through ARAVIS backend
491+
enum { CAP_PROP_ARAVIS_AUTOTRIGGER = 600 //!< Automatically trigger frame capture if camera is configured with software trigger
492+
};
493+
494+
//! @} ARAVIS
495+
486496
/** @name AVFoundation framework for iOS
487497
OS X Lion will have the same API
488498
@{

modules/videoio/src/cap_aravis.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class CvCaptureCAM_Aravis : public CvCapture
149149
bool autoGain;
150150
double targetGrey; // Target grey value (mid grey))
151151
bool softwareTriggered; // Flag if the camera is software triggered
152+
bool allowAutoTrigger; // Flag that user allowed to trigger software triggered cameras automatically
152153

153154
gint64 *pixelFormats;
154155
guint pixelFormatsCnt;
@@ -190,6 +191,7 @@ CvCaptureCAM_Aravis::CvCaptureCAM_Aravis()
190191
exposureCompensation = 0;
191192
targetGrey = 0;
192193
frameID = prevFrameID = 0;
194+
allowAutoTrigger = false;
193195

194196
num_buffers = 10;
195197
frame = NULL;
@@ -292,7 +294,7 @@ bool CvCaptureCAM_Aravis::grabFrame()
292294
ArvBuffer *arv_buffer = NULL;
293295
int max_tries = 10;
294296
int tries = 0;
295-
if (softwareTriggered) {
297+
if (softwareTriggered && allowAutoTrigger) {
296298
arv_camera_software_trigger (camera);
297299
}
298300
for(; tries < max_tries; tries ++) {
@@ -499,6 +501,12 @@ double CvCaptureCAM_Aravis::getProperty( int property_id ) const
499501
return out;
500502
}
501503
break;
504+
505+
case CAP_PROP_ARAVIS_AUTOTRIGGER:
506+
{
507+
return allowAutoTrigger ? 1. : 0.;
508+
}
509+
break;
502510
}
503511
return -1.0;
504512
}
@@ -583,6 +591,11 @@ bool CvCaptureCAM_Aravis::setProperty( int property_id, double value )
583591
}
584592
break;
585593

594+
case CAP_PROP_ARAVIS_AUTOTRIGGER:
595+
{
596+
allowAutoTrigger = (bool) value;
597+
}
598+
break;
586599

587600
default:
588601
return false;

0 commit comments

Comments
 (0)