/// <summary>Load camera calibration data from file</summary>
        /// <param name="file">Location of *.cal file</param>
        public void LoadCamParFile(string file)
        {
            exceptionText = "";
            try
            {
                mCamParameter = null;
                mCamParameter = HMisc.ReadCamPar(file);
            }
            catch (HOperatorException e)
            {
                mIsCalibValid = false;
                exceptionText = e.Message;
                throw (e);
            }

            if (mCamParameter == null || !(mCamParameter.Length > 0) || mCamPose == null || !(mCamPose.Length > 0))
            {
                mIsCalibValid = false;
            }
            else
            {
                mIsCalibValid = true;
            }

            if (mIsCalibValid)
            {
                UpdateExecute(ALL_ROI);
            }
        }
 /// <summary>
 /// 載入 校正後的 CameraParam
 /// </summary>
 /// <param name="file"></param>
 public void ImportCameraInParam(string file)
 {
     if (!File.Exists(file))
     {
         Hanbo.Log.LogManager.Error("CameraInParam file does not exists");
         return;
     }
     CameraIn      = HMisc.ReadCamPar(file);
     mCamParameter = CameraIn;
 }
Example #3
0
 public void readCamParam()
 {
     try
     {
         FileInfo fi = new FileInfo(dirPath + @"\Cameras\" + cameraName + @"\camera_parameters.dat");
         if (fi.Exists)
         {
             CameraParameter = HMisc.ReadCamPar(fi.FullName);
         }
     }
     catch (HOperatorException ex)
     {
         Utilitiy.write_error(this.GetType().FullName, System.Reflection.MethodBase.GetCurrentMethod().ToString(), ex, DataType.eErrors.Exeption);
     }
     catch (Exception ex)
     {
         Utilitiy.write_error(this.GetType().FullName, System.Reflection.MethodBase.GetCurrentMethod().ToString(), ex, DataType.eErrors.Exeption);
     }
 }
Example #4
0
        private void btnReadParam_Click(object sender, EventArgs e)
        {
            this.openFileDialog1.DefaultExt = "cal";
            this.openFileDialog1.FileName   = "campar.cal";
            this.openFileDialog1.Filter     = "内参数据文件 | *.*";
            if (DialogResult.OK != this.openFileDialog1.ShowDialog())
            {
                return;
            }

            this.CameraParam    = HMisc.ReadCamPar(this.openFileDialog1.FileName);
            this.tbxFocus.Text  = this.CameraParam[0].D.ToString(CultureInfo.InvariantCulture);
            this.tbxKappa.Text  = this.CameraParam[1].D.ToString(CultureInfo.InvariantCulture);
            this.tbxSx.Text     = this.CameraParam[2].D.ToString(CultureInfo.InvariantCulture);
            this.tbxSy.Text     = this.CameraParam[3].D.ToString(CultureInfo.InvariantCulture);
            this.tbxCx.Text     = this.CameraParam[4].D.ToString(CultureInfo.InvariantCulture);
            this.tbxCy.Text     = this.CameraParam[5].D.ToString(CultureInfo.InvariantCulture);
            this.tbxWidth.Text  = this.CameraParam[6].I.ToString();
            this.tbxHeight.Text = this.CameraParam[7].I.ToString();
        }