예제 #1
0
        private void OnGetDescription(object sender, System.EventArgs e)
        {
            pcoCameraType = new PCO_CameraType();
            pcoDescr      = new PCO_Description();
            pcoStorage    = new PCO_Storage();
            pcoImage      = new PCO_Image();

            pcoDescr.wSize   = (ushort)Marshal.SizeOf(pcoDescr);
            pcoStorage.wSize = (ushort)Marshal.SizeOf(pcoStorage);
            pcoImage.wSize   = (ushort)Marshal.SizeOf(pcoImage);
            var err = PCO_SDK_LibWrapper.PCO_GetCameraDescription(f_CameraHandle, ref pcoDescr);

            err = PCO_SDK_LibWrapper.PCO_GetStorageStruct(f_CameraHandle, ref pcoStorage);

            pcoImage.strSegment = new PCO_Segment[4];

            pcoImage.strSegment[0].wSize = (ushort)Marshal.SizeOf(typeof(PCO_Segment));
            pcoImage.strSegment[1].wSize = (ushort)Marshal.SizeOf(typeof(PCO_Segment));
            pcoImage.strSegment[2].wSize = (ushort)Marshal.SizeOf(typeof(PCO_Segment));
            pcoImage.strSegment[3].wSize = (ushort)Marshal.SizeOf(typeof(PCO_Segment));

            err = PCO_SDK_LibWrapper.PCO_GetImageStruct(f_CameraHandle, ref pcoImage);

            var usfwsize = (ushort)Marshal.SizeOf(typeof(PCO_SC2_Firmware_DESC));

            usfwsize = (ushort)Marshal.SizeOf(typeof(PCO_FW_Vers));
            pcoCameraType.strHardwareVersion.Board  = new PCO_SC2_Hardware_DESC[10];
            pcoCameraType.strFirmwareVersion.Device = new PCO_SC2_Firmware_DESC[10];
            for (var i = 0; i < 10; i++)
            {
                pcoCameraType.strHardwareVersion.Board[i].szName  = "123456789012345";
                pcoCameraType.strFirmwareVersion.Device[i].szName = "123456789012345";
            }
            pcoCameraType.wSize = (ushort)Marshal.SizeOf(pcoCameraType);

            err = PCO_SDK_LibWrapper.PCO_GetCameraType(f_CameraHandle, ref pcoCameraType);

            var szCameraName = new byte[30];

            err = PCO_SDK_LibWrapper.PCO_GetCameraName(f_CameraHandle, szCameraName, 30);

            SetupConvert();

            cbStartCamera.IsEnabled = true;
            cbStopCamera.IsEnabled  = true;
        }
예제 #2
0
        private void SetupConvert()
        {
            pcoDescr       = new PCO_Description();
            pcoDescr.wSize = (ushort)Marshal.SizeOf(pcoDescr);
            int err = 0;

            err = PCO_SDK_LibWrapper.PCO_GetCameraDescription(f_CameraHandle, ref pcoDescr);
            PCO_ConvertStructures.PCO_SensorInfo strsensorinf = new PCO_ConvertStructures.PCO_SensorInfo();
            PCO_ConvertStructures.PCO_Display    strDisplay   = new PCO_ConvertStructures.PCO_Display();
            strsensorinf.wSize              = (ushort)Marshal.SizeOf(strsensorinf);
            strDisplay.wSize                = (ushort)Marshal.SizeOf(strDisplay);
            strsensorinf.wDummy             = 0;
            strsensorinf.iConversionFactor  = 0;
            strsensorinf.iDataBits          = pcoDescr.wDynResDESC;
            strsensorinf.iSensorInfoBits    = 1;
            strsensorinf.iDarkOffset        = 100;
            strsensorinf.dwzzDummy0         = 0;
            strsensorinf.strColorCoeff.da11 = 1.0;
            strsensorinf.strColorCoeff.da12 = 0.0;
            strsensorinf.strColorCoeff.da13 = 0.0;
            strsensorinf.strColorCoeff.da21 = 0.0;
            strsensorinf.strColorCoeff.da22 = 1.0;
            strsensorinf.strColorCoeff.da23 = 0.0;
            strsensorinf.strColorCoeff.da31 = 0.0;
            strsensorinf.strColorCoeff.da32 = 0.0;
            strsensorinf.strColorCoeff.da33 = 1.0;
            strsensorinf.iCamNum            = 0;
            strsensorinf.hCamera            = f_CameraHandle;

            int errorCode;

            /* We created a pointer to a convert object here */
            errorCode = PCO_Convert_LibWrapper.PCO_ConvertCreate(ref f_ConvertHandle, ref strsensorinf, PCO_Convert_LibWrapper.PCO_COLOR_CONVERT);

            PCO_ConvertStructures.PCO_Convert pcoConv = new PCO_ConvertStructures.PCO_Convert();;

            pcoConv.wSize = (ushort)Marshal.SizeOf(pcoConv);
            errorCode     = PCOConvertDll.PCO_Convert_LibWrapper.PCO_ConvertGet(f_ConvertHandle, ref pcoConv);
            pcoConv.wSize = (ushort)Marshal.SizeOf(pcoConv);

            IntPtr debugIntPtr = f_ConvertHandle;

            PCO_ConvertStructures.PCO_Convert pcoConvertlocal = (PCO_ConvertStructures.PCO_Convert)Marshal.PtrToStructure(debugIntPtr, typeof(PCO_ConvertStructures.PCO_Convert));
        }