Unverified Commit 194304bb authored by Christoph Schmidt-Hieber's avatar Christoph Schmidt-Hieber Committed by GitHub

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.
parent cc9b199e
...@@ -148,6 +148,7 @@ protected: ...@@ -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 ) ...@@ -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() ...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment