[aravis] camera: give access to the full exposure time range on Basler cameras.



commit e6559cc2682cdb94e9aff8a9ee8933e583f4a2f7
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Tue Jan 11 22:43:38 2011 +0100

    camera: give access to the full exposure time range on Basler cameras.

 src/arvcamera.c |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/src/arvcamera.c b/src/arvcamera.c
index 5c138fd..e51b85d 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -460,6 +460,38 @@ arv_camera_set_exposure_time (ArvCamera *camera, double exposure_time_us)
 	if (exposure_time_us <= 0)
 		return;
 
+	switch (camera->priv->vendor) {
+		case ARV_CAMERA_VENDOR_BASLER:
+			{
+				gint64 exposure_int;
+				gint64 time_base_min_int, time_base_max_int;
+				gint64 i;
+				double time_base_min, time_base_max;
+				gint64 raw_min, raw_max;
+
+				exposure_int = (gint64) ((double) 0.5 + exposure_time_us);
+				arv_device_get_float_feature_bounds (camera->priv->device, "ExposureTimeBaseAbs",
+								     &time_base_min, &time_base_max);
+				time_base_min_int = (gint64) ((double) 0.5 + time_base_min);
+				time_base_max_int = (gint64) ((double) 0.5 + time_base_max);
+				arv_device_get_integer_feature_bounds (camera->priv->device, "ExposureTimeRaw",
+								       &raw_min, &raw_max);
+
+				for (i = time_base_min_int; i <= time_base_max_int; i++) {
+					if (exposure_int % i == 0 &&
+					    (exposure_int / i) > raw_min &&
+					    (exposure_int / i) < raw_max)
+						continue;
+				}
+
+				arv_device_set_float_feature_value (camera->priv->device, "ExposureTimeBaseAbs", i);
+			}
+			break;
+		case ARV_CAMERA_VENDOR_PROSILICA:
+		case ARV_CAMERA_VENDOR_UNKNOWN:
+			break;
+	}
+
 	arv_device_set_float_feature_value (camera->priv->device, "ExposureTimeAbs", exposure_time_us);
 }
 
@@ -482,7 +514,28 @@ arv_camera_get_exposure_time_bounds (ArvCamera *camera, double *min, double *max
 {
 	g_return_if_fail (ARV_IS_CAMERA (camera));
 
-	arv_device_get_float_feature_bounds (camera->priv->device, "ExposureTimeAbs", min, max);
+	switch (camera->priv->vendor) {
+		case ARV_CAMERA_VENDOR_BASLER:
+			{
+				double time_base_min, time_base_max;
+				gint64 raw_min, raw_max;
+
+				arv_device_get_float_feature_bounds (camera->priv->device, "ExposureTimeBaseAbs",
+								     &time_base_min, &time_base_max);
+				arv_device_get_integer_feature_bounds (camera->priv->device, "ExposureTimeRaw",
+								       &raw_min, &raw_max);
+
+				if (min != NULL)
+					*min = time_base_min * (double) raw_min;
+				if (max != NULL)
+					*max = time_base_max * (double) raw_max;
+			}
+			break;
+		case ARV_CAMERA_VENDOR_PROSILICA:
+		case ARV_CAMERA_VENDOR_UNKNOWN:
+			arv_device_get_float_feature_bounds (camera->priv->device, "ExposureTimeAbs", min, max);
+			break;
+	}
 }
 
 /* Analog control */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]