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.
pull/15714/head
Christoph Schmidt-Hieber 5 years ago committed by GitHub
parent cc9b199ecb
commit 194304bbe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      modules/videoio/src/cap_aravis.cpp

@ -148,6 +148,7 @@ protected:
double exposureCompensation; double exposureCompensation;
bool autoGain; bool autoGain;
double targetGrey; // Target grey value (mid grey)) double targetGrey; // Target grey value (mid grey))
bool softwareTriggered; // Flag if the camera is software triggered
gint64 *pixelFormats; gint64 *pixelFormats;
guint pixelFormatsCnt; guint pixelFormatsCnt;
@ -275,6 +276,7 @@ bool CvCaptureCAM_Aravis::open( int index )
exposure = exposureAvailable ? arv_camera_get_exposure_time(camera) : 0; exposure = exposureAvailable ? arv_camera_get_exposure_time(camera) : 0;
gain = gainAvailable ? arv_camera_get_gain(camera) : 0; gain = gainAvailable ? arv_camera_get_gain(camera) : 0;
fps = arv_camera_get_frame_rate(camera); fps = arv_camera_get_frame_rate(camera);
softwareTriggered = (strcmp(arv_camera_get_trigger_source(camera), "Software") == 0);
return startCapture(); return startCapture();
} }
@ -290,6 +292,9 @@ bool CvCaptureCAM_Aravis::grabFrame()
ArvBuffer *arv_buffer = NULL; ArvBuffer *arv_buffer = NULL;
int max_tries = 10; int max_tries = 10;
int tries = 0; int tries = 0;
if (softwareTriggered) {
arv_camera_software_trigger (camera);
}
for(; tries < max_tries; tries ++) { for(; tries < max_tries; tries ++) {
arv_buffer = arv_stream_timeout_pop_buffer (stream, 200000); arv_buffer = arv_stream_timeout_pop_buffer (stream, 200000);
if (arv_buffer != NULL && arv_buffer_get_status (arv_buffer) != ARV_BUFFER_STATUS_SUCCESS) { if (arv_buffer != NULL && arv_buffer_get_status (arv_buffer) != ARV_BUFFER_STATUS_SUCCESS) {

Loading…
Cancel
Save