[aravis] camera_test: add options for exposure and gain setting.



commit 62de44ebafc115d68b289375673f846daee03b97
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Tue Aug 31 16:53:07 2010 +0200

    camera_test: add options for exposure and gain setting.

 tests/arvcameratest.c |   43 +++++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/tests/arvcameratest.c b/tests/arvcameratest.c
index 7da99a4..d1970ff 100644
--- a/tests/arvcameratest.c
+++ b/tests/arvcameratest.c
@@ -19,6 +19,8 @@ static int arv_option_width = -1;
 static int arv_option_height = -1;
 static int arv_option_horizontal_binning = -1;
 static int arv_option_vertical_binning = -1;
+static double arv_option_exposure_time_us = -1;
+static int arv_option_gain = -1;
 
 static const GOptionEntry arv_option_entries[] =
 {
@@ -32,14 +34,18 @@ static const GOptionEntry arv_option_entries[] =
 		&arv_option_frequency,	"Acquisition frequency", NULL },
 	{ "trigger",		't', 0, G_OPTION_ARG_STRING,
 		&arv_option_trigger,	"External trigger", NULL},
-	{ "width", 		'w', 0, G_OPTION_ARG_INT,
+	{ "width", 		'\0', 0, G_OPTION_ARG_INT,
 		&arv_option_width,		"Width", NULL },
-	{ "height", 		'h', 0, G_OPTION_ARG_INT,
+	{ "height", 		'\0', 0, G_OPTION_ARG_INT,
 		&arv_option_height, 		"Height", NULL },
 	{ "h-binning", 		'\0', 0, G_OPTION_ARG_INT,
 		&arv_option_horizontal_binning,"Horizontal binning", NULL },
 	{ "v-binning", 		'\0', 0, G_OPTION_ARG_INT,
 		&arv_option_vertical_binning, 	"Vertical binning", NULL },
+	{ "exposure", 		'e', 0, G_OPTION_ARG_DOUBLE,
+		&arv_option_exposure_time_us, 	"Exposure time (µs)", NULL },
+	{ "gain", 		'g', 0, G_OPTION_ARG_INT,
+		&arv_option_gain,	 	"Gain (dB)", NULL },
 	{ "debug", 		'd', 0, G_OPTION_ARG_STRING,
 		&arv_option_debug_domains, 	"Debug domains", NULL },
 	{ NULL }
@@ -86,23 +92,28 @@ main (int argc, char **argv)
 		guint64 n_completed_buffers;
 		guint64 n_failures;
 		guint64 n_underruns;
+		int gain;
 
 		arv_camera_set_region (camera, 0, 0, arv_option_width, arv_option_height);
 		arv_camera_set_binning (camera, arv_option_horizontal_binning, arv_option_vertical_binning);
+		arv_camera_set_exposure_time (camera, arv_option_exposure_time_us);
+		arv_camera_set_gain (camera, arv_option_gain);
 
 		arv_camera_get_region (camera, &x, &y, &width, &height);
 		arv_camera_get_binning (camera, &dx, &dy);
 		exposure = arv_camera_get_exposure_time (camera);
 		payload = arv_camera_get_payload (camera);
-
-		g_print ("vendor name         = %s\n", arv_camera_get_vendor_name (camera));
-		g_print ("model name          = %s\n", arv_camera_get_model_name (camera));
-		g_print ("device id           = %s\n", arv_camera_get_device_id (camera));
-		g_print ("image width         = %d\n", width);
-		g_print ("image height        = %d\n", height);
-		g_print ("horizontal binning  = %d\n", dx);
-		g_print ("vertical binning    = %d\n", dy);
-		g_print ("exposure            = %g us\n", exposure);
+		gain = arv_camera_get_gain (camera);
+
+		g_printf ("vendor name         = %s\n", arv_camera_get_vendor_name (camera));
+		g_printf ("model name          = %s\n", arv_camera_get_model_name (camera));
+		g_printf ("device id           = %s\n", arv_camera_get_device_id (camera));
+		g_printf ("image width         = %d\n", width);
+		g_printf ("image height        = %d\n", height);
+		g_printf ("horizontal binning  = %d\n", dx);
+		g_printf ("vertical binning    = %d\n", dy);
+		g_printf ("exposure            = %g µs\n", exposure);
+		g_printf ("gain                = %d dB\n", gain);
 
 		stream = arv_camera_create_stream (camera, NULL, NULL);
 		if (arv_option_auto_buffer)
@@ -141,22 +152,22 @@ main (int argc, char **argv)
 				}
 			} while (buffer != NULL);
 
-			g_print ("Frame rate = %d\n", buffer_count);
+			g_printf ("Frame rate = %d\n", buffer_count);
 
 		} while (!cancel);
 
 		arv_stream_get_statistics (stream, &n_completed_buffers, &n_failures, &n_underruns);
 
-		g_print ("Completed buffers = %Lu\n", (unsigned long long) n_completed_buffers);
-		g_print ("Failures          = %Lu\n", (unsigned long long) n_failures);
-		g_print ("Underruns         = %Lu\n", (unsigned long long) n_underruns);
+		g_printf ("Completed buffers = %Lu\n", (unsigned long long) n_completed_buffers);
+		g_printf ("Failures          = %Lu\n", (unsigned long long) n_failures);
+		g_printf ("Underruns         = %Lu\n", (unsigned long long) n_underruns);
 
 		arv_camera_stop_acquisition (camera);
 
 		g_object_unref (stream);
 		g_object_unref (camera);
 	} else
-		g_print ("No camera found\n");
+		g_printf ("No camera found\n");
 
 	return 0;
 }



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