示例#1
0
        public static void ReadCameraParametersToInfos(this Int16 cameraHandle, ICameraInfo cameraInfo)
        {
            //build speed tabls

            cameraHandle.BuildSpeedTable(cameraInfo);

            //get serial (X) and parallel (Y) size of the CCD
            IntPtr unmngCcdSize = Marshal.AllocHGlobal(sizeof(Int16));

            Pvcam.pl_get_param(cameraHandle, PvTypes.PARAM_PAR_SIZE, (Int16)PvTypes.AttributeIDs.ATTR_CURRENT,
                               unmngCcdSize);
            cameraInfo.CameraParas.SizeX = Marshal.ReadInt16(unmngCcdSize);

            Pvcam.pl_get_param(cameraHandle, PvTypes.PARAM_SER_SIZE, (Int16)PvTypes.AttributeIDs.ATTR_CURRENT,
                               unmngCcdSize);
            cameraInfo.CameraParas.SizeY = Marshal.ReadInt16(unmngCcdSize);

            Marshal.FreeHGlobal(unmngCcdSize);
            unmngCcdSize = IntPtr.Zero;

            //read the camera chip name, currently used for main identification of the camera model
            IntPtr unmngChipName = Marshal.AllocHGlobal(PvTypes.CCD_NAME_LEN);

            Pvcam.pl_get_param(cameraHandle, PvTypes.PARAM_CHIP_NAME, (Int16)PvTypes.AttributeIDs.ATTR_CURRENT,
                               unmngChipName);
            cameraInfo.CameraParas.ChipName =
                new StringBuilder(Marshal.PtrToStringAnsi(unmngChipName, PvTypes.CCD_NAME_LEN));
            Marshal.FreeHGlobal(unmngChipName);
            unmngChipName = IntPtr.Zero;

            //temperature always available
            if (ReadCoolingParameters(cameraHandle, out var min, out var max, out var setPoint))
            {
                cameraInfo.CameraParas.TemperatureMin = min;
                cameraInfo.CameraParas.TemperatureMax = max;
                cameraInfo.CameraSettings.Temperature = setPoint;
            }

            //regions, will always get at leat one ROI, must after sizex and sizey gettings
            ReadRegions(cameraHandle, cameraInfo);

            //set optional params, may not supported by camera
            GetCameraParas(cameraHandle, cameraInfo);

            //exposeTime
            cameraInfo.CameraSettings.ExposureTime = new CameraPrimitiveParameter("Explore Time", (int)10); //default


            ////Read Trigger input Modes available on the camera
            if (ReadEnumeration(cameraHandle, out var list, PvTypes.PARAM_EXPOSURE_MODE))
            {
                cameraInfo.CameraParas.TriggerModes   = list;
                cameraInfo.CameraSettings.TriggerMode = list[0].Value;
            }

            //Check if Expose Out Parameter is available on the camera
            cameraInfo.CameraParas.IsExposeOutModeSupported =
                IsParamAvailable(cameraHandle, PvTypes.PARAM_EXPOSE_OUT_MODE);

            if (cameraInfo.CameraParas.IsExposeOutModeSupported)
            {
                if (ReadEnumeration(cameraHandle, out var exposeOutList, PvTypes.PARAM_EXPOSE_OUT_MODE))
                {
                    cameraInfo.CameraParas.ExposeOutModes   = exposeOutList;
                    cameraInfo.CameraSettings.ExposeOutMode = exposeOutList[0].Value;
                }
            }
        }