示例#1
0
        private void CalibrateDeviceButton_Click(object sender, EventArgs e)
        {
            ////////////////////////////
            // OPEN IMAGE FILE
            ////////////////////////////
            OpenFileDialog OFDlg = new OpenFileDialog();

            OFDlg.Title = "Open Calibration Image";
            if (OFDlg.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show("Error in Opening File");
                return;
            }
            String fname = OFDlg.FileName;

            Byte [] CalImageBytes = System.IO.File.ReadAllBytes(fname);

            if (CalImageBytes.Length != (CalibrationImageSX) * (CalibrationImageSY))
            {
                MessageBox.Show("Error: file size not correct");
                return;
            }

            ///////////////////////////////
            // CALIBRATE DEVICE
            ///////////////////////////////
            // ver 2.10.0.0: use "2" functions
            //int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage(
            //    this.FlatScanArea, CalImageBytes);
            int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage2(
                this.ScanArea, CalImageBytes);

            // end ver 2.10.0.0: use "2" functions
            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                    RetVal, "CalibrateDeviceButton_Click,GBMSAPI_NET_SetCalibrationImage2");
            }
            else
            {
                MessageBox.Show("Device Calibrated", "Calibration results");
            }

            return;
        }
示例#2
0
        private void SetFactoryCalibrationButton_Click(object sender, EventArgs e)
        {
            ///////////////////////////////
            // CALIBRATE DEVICE
            ///////////////////////////////
            // ver 2.10.0.0: use "2" functions
            //int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage(this.FlatScanArea, null);
            int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage2(
                GBMSAPI_NET_ScanAreas.GBMSAPI_NET_SA_FULL_FRAME, null);

            // end ver 2.10.0.0: use "2" functions
            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                    RetVal, "SetFactoryCalibrationButton_Click,GBMSAPI_GetImageSize");
                return;
            }

            MessageBox.Show("Device Calibrated", "Calibration results");
        }