summaryrefslogtreecommitdiffstats
path: root/plugins/pylon
diff options
context:
space:
mode:
authorMihael Koep <koep@schneide.com>2014-09-11 11:39:11 +0200
committerMihael Koep <koep@schneide.com>2014-10-07 13:08:08 +0200
commit8e98707648406e2c7a6831c2f3366a2c34eba617 (patch)
tree2f2081997780f0c708a2b3d210892e6dd7298388 /plugins/pylon
parent6f73f9daa1f9d1ac6054dec6e06b93e040a011f2 (diff)
downloaduca-8e98707648406e2c7a6831c2f3366a2c34eba617.tar.gz
uca-8e98707648406e2c7a6831c2f3366a2c34eba617.tar.bz2
uca-8e98707648406e2c7a6831c2f3366a2c34eba617.tar.xz
uca-8e98707648406e2c7a6831c2f3366a2c34eba617.zip
Improve robustness of roi setting for pylon plugin
Diffstat (limited to 'plugins/pylon')
-rw-r--r--plugins/pylon/CMakeLists.txt2
-rw-r--r--plugins/pylon/changelog.txt2
-rw-r--r--plugins/pylon/uca-pylon-camera.c115
3 files changed, 60 insertions, 59 deletions
diff --git a/plugins/pylon/CMakeLists.txt b/plugins/pylon/CMakeLists.txt
index 02f65c9..7ae3288 100644
--- a/plugins/pylon/CMakeLists.txt
+++ b/plugins/pylon/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.6)
project(ucapylon C)
-set(VERSION "1.2.0")
+set(VERSION "1.2.1")
find_package(Pylon)
diff --git a/plugins/pylon/changelog.txt b/plugins/pylon/changelog.txt
index 5a004cf..9e1584c 100644
--- a/plugins/pylon/changelog.txt
+++ b/plugins/pylon/changelog.txt
@@ -1,3 +1,5 @@
+* Thu Sep 11 2014 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.2.1-1
+- improve robustness of roi setting
* Thu Jul 31 2014 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.2.0-1
- require libpyloncam 0.4.0
- update to modified libpyloncam API
diff --git a/plugins/pylon/uca-pylon-camera.c b/plugins/pylon/uca-pylon-camera.c
index bac9684..1c3a759 100644
--- a/plugins/pylon/uca-pylon-camera.c
+++ b/plugins/pylon/uca-pylon-camera.c
@@ -89,8 +89,10 @@ struct _UcaPylonCameraPrivate {
guint width;
guint height;
- guint16 roi_x, roi_y;
- guint16 roi_width, roi_height;
+ guint16 roi_x;
+ guint16 roi_y;
+ guint16 roi_width;
+ guint16 roi_height;
GValueArray *binnings;
};
@@ -136,65 +138,62 @@ static void uca_pylon_camera_set_property(GObject *object, guint property_id, co
GError* error = NULL;
switch (property_id) {
- case PROP_SENSOR_HORIZONTAL_BINNING:
- /* intentional fall-through*/
- case PROP_SENSOR_VERTICAL_BINNING:
- /* intentional fall-through*/
- case PROP_TRIGGER_MODE:
- break;
- case PROP_BALANCE_WHITE_AUTO:
- {
- pylon_camera_set_int_attribute("BalanceWhiteAuto", g_value_get_enum(value), &error);
- }
- break;
-
- case PROP_ROI_X:
- {
- priv->roi_x = g_value_get_uint(value);
- pylon_set_roi(object, &error);
- }
- break;
-
- case PROP_ROI_Y:
- {
- priv->roi_y = g_value_get_uint(value);
- pylon_set_roi(object, &error);
- }
- break;
-
- case PROP_ROI_WIDTH:
- {
- priv->roi_width = g_value_get_uint(value);
- pylon_set_roi(object, &error);
- }
- break;
-
- case PROP_ROI_HEIGHT:
- {
- priv->roi_height = g_value_get_uint(value);
- pylon_set_roi(object, &error);
- }
- break;
-
- case PROP_EXPOSURE_TIME:
- pylon_camera_set_exposure_time(g_value_get_double(value), &error);
- break;
-
- case PROP_GAIN:
- pylon_camera_set_gain(g_value_get_int(value), &error);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- return;
+ case PROP_SENSOR_HORIZONTAL_BINNING:
+ /* intentional fall-through*/
+ case PROP_SENSOR_VERTICAL_BINNING:
+ /* intentional fall-through*/
+ case PROP_TRIGGER_MODE:
+ break;
+ case PROP_BALANCE_WHITE_AUTO:
+ {
+ pylon_camera_set_int_attribute("BalanceWhiteAuto", g_value_get_enum(value), &error);
+ break;
+ }
+ case PROP_ROI_X:
+ {
+ priv->roi_x = g_value_get_uint(value);
+ gint max_roi_width = priv->width - priv->roi_x;
+ priv->roi_width = MIN(priv->roi_width, max_roi_width);
+ pylon_set_roi(object, &error);
+ break;
+ }
+ case PROP_ROI_Y:
+ {
+ priv->roi_y = g_value_get_uint(value);
+ gint max_roi_height = priv->height - priv->roi_y;
+ priv->roi_height = MIN(priv->roi_height, max_roi_height);
+ pylon_set_roi(object, &error);
+ break;
+ }
+ case PROP_ROI_WIDTH:
+ {
+ priv->roi_width = g_value_get_uint(value);
+ pylon_set_roi(object, &error);
+ break;
+ }
+ case PROP_ROI_HEIGHT:
+ {
+ priv->roi_height = g_value_get_uint(value);
+ pylon_set_roi(object, &error);
+ break;
+ }
+ case PROP_EXPOSURE_TIME:
+ pylon_camera_set_exposure_time(g_value_get_double(value), &error);
+ break;
+ case PROP_GAIN:
+ pylon_camera_set_gain(g_value_get_int(value), &error);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ return;
}
if (error) {
- if(error->message) {
- g_warning("failed to set property %d: %s", property_id, error->message);
- } else {
- g_warning("failed to set property %d", property_id);
- }
+ if (error->message) {
+ g_warning("failed to set property %d: %s", property_id, error->message);
+ } else {
+ g_warning("failed to set property %d", property_id);
+ }
}
}