summaryrefslogtreecommitdiffstats
path: root/test/grab.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-06-29 09:56:26 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-06-29 10:09:06 +0200
commit9551b293504f772cbcbd0e67714a30149738118b (patch)
tree531faae7b7c22e5353c36a63a055a66d347a3bca /test/grab.c
parenta94f1c1a38673a37093f6e3bae7e470807046cbd (diff)
downloaduca-9551b293504f772cbcbd0e67714a30149738118b.tar.gz
uca-9551b293504f772cbcbd0e67714a30149738118b.tar.bz2
uca-9551b293504f772cbcbd0e67714a30149738118b.tar.xz
uca-9551b293504f772cbcbd0e67714a30149738118b.zip
Fix LU-15: Broken ROI image
This fix contains two changes: 1. We check that passed ROI requests are multiples of possible ROI steps as provided by the camera. If this is not the case, the request is ignored and a warning issued. 2. We added two new base properties ROI_WIDTH_MULTIPLIER and ROI_HEIGHT_MULTIPLIER that expose this information to client programs.
Diffstat (limited to 'test/grab.c')
-rw-r--r--test/grab.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/grab.c b/test/grab.c
index c4b3f3c..a5f1cf5 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
GError *error = NULL;
(void) signal(SIGINT, sigint_handler);
guint sensor_width, sensor_height, sensor_width_extended, sensor_height_extended;
- guint roi_width, roi_height, roi_x, roi_y;
+ guint roi_width, roi_height, roi_x, roi_y, roi_width_multiplier, roi_height_multiplier;
guint bits, sensor_rate;
gchar *name;
@@ -62,13 +62,15 @@ int main(int argc, char *argv[])
"roi-x0", 0,
"roi-y0", 0,
"sensor-extended", FALSE,
- "roi-width", sensor_width,
+ "roi-width", 1000,
"roi-height", sensor_height,
NULL);
g_object_get(G_OBJECT(camera),
"roi-width", &roi_width,
"roi-height", &roi_height,
+ "roi-width-multiplier", &roi_width_multiplier,
+ "roi-height-multiplier", &roi_height_multiplier,
"roi-x0", &roi_x,
"roi-y0", &roi_y,
"sensor-bitdepth", &bits,
@@ -78,10 +80,13 @@ int main(int argc, char *argv[])
g_print("Camera: %s\n", name);
g_free(name);
- g_print("Sensor: %ix%i px (extended: %ix%i), ROI %ix%i @ (%i, %i) and %i Hz\n",
+ g_print("Sensor: %ix%i px (extended: %ix%i) @ %i Hz\n",
sensor_width, sensor_height,
sensor_width_extended, sensor_height_extended,
- roi_width, roi_height, roi_x, roi_y, sensor_rate);
+ sensor_rate);
+
+ g_print("ROI: %ix%i @ (%i, %i), steps: %i, %i\n",
+ roi_width, roi_height, roi_x, roi_y, roi_width_multiplier, roi_height_multiplier);
const int pixel_size = bits == 8 ? 1 : 2;
gpointer buffer = g_malloc0(roi_width * roi_height * pixel_size);