Ejemplo n.º 1
0
        /* This function demonstrates how to handle integer camera parameters. */
        private static void demonstrateIntFeature(PYLON_DEVICE_HANDLE hDev)
        {
            string featureName = "Width";  /* Name of the feature used in this sample: AOI Width. */
            long   val, min, max, incr;    /* Properties of the feature. */

            /*
             * Query the current value, the allowed value range, and the increment of the feature.
             * For some integer features, you are not allowed to set every value within the
             * value range. For example, for some cameras the Width parameter must be a multiple
             * of 2. These constraints are expressed by the increment value. Valid values
             * follow the rule: val >= min && val <= max && val == min + n * inc.
             *
             * To help clarify this sample, we don't check for the feature accessibility as demonstrated
             * in the demonstrateAccessibility() function.
             */
            min  = Pylon.DeviceGetIntegerFeatureMin(hDev, featureName); /* Get the minimum value. */
            max  = Pylon.DeviceGetIntegerFeatureMax(hDev, featureName); /* Get the maximum value. */
            incr = Pylon.DeviceGetIntegerFeatureInc(hDev, featureName); /* Get the increment value. */
            val  = Pylon.DeviceGetIntegerFeature(hDev, featureName);    /* Get the current value. */

            Console.WriteLine("{0}: min= {1}  max= {2}  incr={3}  Value={4}", featureName, min, max, incr, val);

            /* Set the Width to its maximum allowed value. */
            Pylon.DeviceSetIntegerFeature(hDev, featureName, max);
            Console.WriteLine("The {0} was set to {1}.", featureName, max);
        }