summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-05-29 16:27:41 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-05-29 16:27:41 +0200
commitcfdeec6fc8fabca7682c4c6fd2111b75fdfb527a (patch)
tree4e01d44c1ecd04f2bd2975a498d6c8840c1a33f3 /src
parent1dde4920bfb1a257f2d2ea3b087124cf3cad6540 (diff)
downloaduca-cfdeec6fc8fabca7682c4c6fd2111b75fdfb527a.tar.gz
uca-cfdeec6fc8fabca7682c4c6fd2111b75fdfb527a.tar.bz2
uca-cfdeec6fc8fabca7682c4c6fd2111b75fdfb527a.tar.xz
uca-cfdeec6fc8fabca7682c4c6fd2111b75fdfb527a.zip
Use ROI with (0,0) as starting coordinate
Diffstat (limited to 'src')
-rw-r--r--src/cameras/uca-pco-camera.c55
-rw-r--r--src/uca-camera.c12
2 files changed, 57 insertions, 10 deletions
diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c
index fbbc613..852a4f9 100644
--- a/src/cameras/uca-pco-camera.c
+++ b/src/cameras/uca-pco-camera.c
@@ -540,6 +540,53 @@ static void uca_pco_camera_set_property(GObject *object, guint property_id, cons
}
break;
+ case PROP_ROI_X:
+ {
+ guint16 roi[4] = {0};
+ pco_get_roi(priv->pco, roi);
+
+ /*
+ * According to PCO specs, the image starts coordinates (1,1)
+ * rather than (0,0). Therefore we adjust the coordinates here.
+ */
+ roi[0] = g_value_get_uint(value) + 1;
+
+ if (pco_set_roi(priv->pco, roi) != PCO_NOERROR)
+ g_warning("Cannot set horizontal ROI position");
+ }
+ break;
+
+ case PROP_ROI_Y:
+ {
+ guint16 roi[4] = {0};
+ pco_get_roi(priv->pco, roi);
+ roi[1] = g_value_get_uint(value) + 1;
+
+ if (pco_set_roi(priv->pco, roi) != PCO_NOERROR)
+ g_warning("Cannot set vertical ROI position");
+ }
+ break;
+
+ case PROP_ROI_WIDTH:
+ {
+ guint16 roi[4] = {0};
+ pco_get_roi(priv->pco, roi);
+ roi[2] = roi[0] + g_value_get_uint(value) - 1;
+ if (pco_set_roi(priv->pco, roi) != PCO_NOERROR)
+ g_warning("Cannot set ROI width");
+ }
+ break;
+
+ case PROP_ROI_HEIGHT:
+ {
+ guint16 roi[4] = {0};
+ pco_get_roi(priv->pco, roi);
+ roi[3] = roi[1] + g_value_get_uint(value) - 1;
+ if (pco_set_roi(priv->pco, roi) != PCO_NOERROR)
+ g_warning("Cannot set ROI height");
+ }
+ break;
+
case PROP_EXPOSURE_TIME:
{
const gdouble time = g_value_get_double(value);
@@ -901,7 +948,7 @@ static void uca_pco_camera_get_property(GObject *object, guint property_id, GVal
{
guint16 roi[4] = {0};
pco_get_roi(priv->pco, roi);
- g_value_set_uint(value, roi[0]);
+ g_value_set_uint(value, roi[0] - 1);
}
break;
@@ -909,7 +956,7 @@ static void uca_pco_camera_get_property(GObject *object, guint property_id, GVal
{
guint16 roi[4] = {0};
pco_get_roi(priv->pco, roi);
- g_value_set_uint(value, roi[1]);
+ g_value_set_uint(value, roi[1] - 1);
}
break;
@@ -917,7 +964,7 @@ static void uca_pco_camera_get_property(GObject *object, guint property_id, GVal
{
guint16 roi[4] = {0};
pco_get_roi(priv->pco, roi);
- g_value_set_uint(value, (roi[2] - roi[0]));
+ g_value_set_uint(value, (roi[2] - roi[0] + 1));
}
break;
@@ -925,7 +972,7 @@ static void uca_pco_camera_get_property(GObject *object, guint property_id, GVal
{
guint16 roi[4] = {0};
pco_get_roi(priv->pco, roi);
- g_value_set_uint(value, (roi[3] - roi[1]));
+ g_value_set_uint(value, (roi[3] - roi[1] + 1));
}
break;
diff --git a/src/uca-camera.c b/src/uca-camera.c
index ba7d912..dc7d8d7 100644
--- a/src/uca-camera.c
+++ b/src/uca-camera.c
@@ -254,29 +254,29 @@ static void uca_camera_class_init(UcaCameraClass *klass)
g_param_spec_uint(uca_camera_props[PROP_ROI_X],
"Horizontal coordinate",
"Horizontal coordinate",
- 1, G_MAXUINT, 1,
- G_PARAM_READABLE);
+ 0, G_MAXUINT, 1,
+ G_PARAM_READWRITE);
camera_properties[PROP_ROI_Y] =
g_param_spec_uint(uca_camera_props[PROP_ROI_Y],
"Vertical coordinate",
"Vertical coordinate",
- 1, G_MAXUINT, 1,
- G_PARAM_READABLE);
+ 0, G_MAXUINT, 1,
+ G_PARAM_READWRITE);
camera_properties[PROP_ROI_WIDTH] =
g_param_spec_uint(uca_camera_props[PROP_ROI_WIDTH],
"Width",
"Width of the region of interest",
1, G_MAXUINT, 1,
- G_PARAM_READABLE);
+ G_PARAM_READWRITE);
camera_properties[PROP_ROI_HEIGHT] =
g_param_spec_uint(uca_camera_props[PROP_ROI_HEIGHT],
"Height",
"Height of the region of interest",
1, G_MAXUINT, 1,
- G_PARAM_READABLE);
+ G_PARAM_READWRITE);
camera_properties[PROP_EXPOSURE_TIME] =
g_param_spec_double(uca_camera_props[PROP_EXPOSURE_TIME],