/* Some features are floating point features. This function illustrates how to set and get floating * point parameters. */ private static void demonstrateFloatFeature(PYLON_DEVICE_HANDLE hDev) { string featureName = "Gamma"; /* The name of the feature used. */ bool isAvailable; /* Is the feature available? */ bool isWritable; /* Is the feature writable? */ double min, max, value; /* Value range and current value. */ isAvailable = Pylon.DeviceFeatureIsAvailable(hDev, featureName); if (isAvailable) { /* Query the value range and the current value. */ min = Pylon.DeviceGetFloatFeatureMin(hDev, featureName); max = Pylon.DeviceGetFloatFeatureMax(hDev, featureName); value = Pylon.DeviceGetFloatFeature(hDev, featureName); Console.WriteLine("{0}: min = {1}, max = {2}, value = {3}", featureName, min, max, value); /* Set a new value. */ isWritable = Pylon.DeviceFeatureIsWritable(hDev, featureName); if (isWritable) { value = 0.5 * (min + max); Console.WriteLine("Setting {0} to {1}.", featureName, value); Pylon.DeviceSetFloatFeature(hDev, featureName, value); } } else { Console.WriteLine("The {0} feature isn't available.", featureName); } }
/// <summary> /// Configure device and report frame format that will be used during streaming. /// This method must return a proper ImageDescriptor so we can pre-allocate buffers. /// </summary> public ImageDescriptor Prepare() { Open(); if (deviceHandle == null || !deviceHandle.IsValid) { return(ImageDescriptor.Invalid); } firstOpen = false; // Get the configured framerate for recording support. if (Pylon.DeviceFeatureIsReadable(deviceHandle, "ResultingFrameRateAbs")) { resultingFramerate = (float)Pylon.DeviceGetFloatFeature(deviceHandle, "ResultingFrameRateAbs"); } else if (Pylon.DeviceFeatureIsReadable(deviceHandle, "ResultingFrameRate")) { resultingFramerate = (float)Pylon.DeviceGetFloatFeature(deviceHandle, "ResultingFrameRate"); } SpecificInfo specific = summary.Specific as SpecificInfo; string streamFormatSymbol = specific.StreamFormat; bool hasWidth = Pylon.DeviceFeatureIsReadable(deviceHandle, "Width"); bool hasHeight = Pylon.DeviceFeatureIsReadable(deviceHandle, "Height"); bool hasPixelFormat = Pylon.DeviceFeatureIsReadable(deviceHandle, "PixelFormat"); bool canComputeImageDescriptor = hasWidth && hasHeight && hasPixelFormat; if (!canComputeImageDescriptor) { return(ImageDescriptor.Invalid); } int width = (int)Pylon.DeviceGetIntegerFeature(deviceHandle, "Width"); int height = (int)Pylon.DeviceGetIntegerFeature(deviceHandle, "Height"); string pixelFormat = Pylon.DeviceFeatureToString(deviceHandle, "PixelFormat"); // Note: the image provider will perform the Bayer conversion itself and only output two formats. // - Y800 for anything monochrome. // - RGB32 for anything color. EPylonPixelType pixelType = Pylon.PixelTypeFromString(pixelFormat); if (pixelType == EPylonPixelType.PixelType_Undefined) { return(ImageDescriptor.Invalid); } bool monochrome = Pylon.IsMono(pixelType) && !Pylon.IsBayer(pixelType); ImageFormat format = monochrome ? format = ImageFormat.Y800 : ImageFormat.RGB32; int bufferSize = ImageFormatHelper.ComputeBufferSize(width, height, format); bool topDown = true; return(new ImageDescriptor(format, width, height, topDown, bufferSize)); }
public double get_floatParam(string featureName) { if (Pylon.DeviceFeatureIsAvailable(m_hDevice, featureName)) { return(Pylon.DeviceGetFloatFeature(m_hDevice, featureName)); } else { return(-1); } }
public static float GetResultingFramerate(PYLON_DEVICE_HANDLE deviceHandle) { if (Pylon.DeviceFeatureIsReadable(deviceHandle, "ResultingFrameRateAbs")) { return((float)Pylon.DeviceGetFloatFeature(deviceHandle, "ResultingFrameRateAbs")); } else if (Pylon.DeviceFeatureIsReadable(deviceHandle, "ResultingFrameRate")) { return((float)Pylon.DeviceGetFloatFeature(deviceHandle, "ResultingFrameRate")); } return(0); }