public HTuple GetCameraParamHTuple(CalibImage image)
        {
            HTuple campar;
            int paramsListSize = 8;
            int offset = 0;
            bool areaScanPoly = false;
            var mKappa = 0.0;
            var mK1 = 0.0;
            var mK2 = 0.0;
            var mK3 = 0.0;
            var mP1 = 0.0;
            var mP2 = 0.0;
            var mMotionVx = 0.0;
            var mMotionVy = 500.0;
            var mMotionVz = 0.0;
            var mCameraType = _cameraParam.CameraType;
            if (mCameraType == CameraModelType.AreaScanPolynomial)
            {
                paramsListSize = 12;
                offset = 4;
                areaScanPoly = true;
            }

            paramsListSize += (mCameraType == CameraModelType.LineScan) ? 3 : 0;

            campar = new HTuple(paramsListSize);
            campar[0] = (_cameraParam.IsTelecentric ? 0.0 : ((double)_cameraParam.Focus / 1000000.0));

            if (areaScanPoly)
            {
                campar[1] = mK1;
                campar[2] = mK2;
                campar[3] = mK3;
                campar[4] = mP1;
                campar[5] = mP2;
            }
            else
            {
                campar[1] = mKappa;
            }

            campar[2 + offset] = (double)_cameraParam.Sx / 1000000000.0;   // Sx -width   -> * 10^ -9
            campar[3 + offset] = (double)_cameraParam.Sy / 1000000000.0;  // Sy -height  -> * 10^ -9
            campar[4 + offset] = image.ImageWidth * 0.5;                  // x -principal point
            campar[5 + offset] = image.ImageHeight * 0.5;                 // y -principal point
            campar[6 + offset] = image.ImageWidth;                      // imagewidth
            campar[7 + offset] = image.ImageHeight;                     // imageheight

            if (paramsListSize == 11)
            {
                campar[8] = mMotionVx / 1000000.0;
                campar[9] = mMotionVy / 1000000.0;
                campar[10] = mMotionVz / 1000000.0;

                campar[5 + offset] = 0;     // y -principal point = 0 for line scan camera
            }
            return campar;
        }
        /// <summary>
        /// 加入校正影像
        /// </summary>
        /// <param name="image">CalibImage</param>
        public void AddCalibImage(CalibImage image)
        {
            if (_calibImages == null) _calibImages = new List<CalibImage>();
            _calibImages.Add(image);

            _worker.RequestCalibrationImageReport(new CalibImageDTO() { ImageID = image.ID, UserState = "ImageAdded" });
        }
 /// <summary>
 /// 加入校正影像
 /// </summary>
 /// <param name="filename">image file path</param>
 public void AddCalibImage(string filename)
 {
     var image = new CalibImage(filename);
     AddCalibImage(image);
 }
        /// <summary>
        /// Gets the camera parameters corresponding to
        /// the supplied calibration image.
        /// </summary>
        /// <returns>Camera parameters</returns>
        public HTuple getCameraParams(CalibImage image)
        {
            HTuple campar;
            int  paramsListSize = 8;
            int  offset         = 0;
            bool areaScanPoly   = false;

            if(mCameraType==CalibrationAssistant.CAMERA_TYP_AREA_SCAN_POLY)
            {
                paramsListSize  = 12;
                offset          = 4;
                areaScanPoly    = true;
            }

            paramsListSize += (mCameraType==CalibrationAssistant.CAMERA_TYP_LINE_SCAN)?3:0;

            campar    = new HTuple(paramsListSize);
            campar[0] = (isTelecentric? 0.0: ((double)mFocalLength/1000.0));

            if(areaScanPoly)
            {
                campar[1] =  mK1;
                campar[2] =  mK2;
                campar[3] =  mK3;
                campar[4] =  mP1;
                campar[5] =  mP2;
            }
            else
            {
                campar[1] =  mKappa;
            }

            campar[2+offset] = (double)mCellWidth/1000000.0;   // Sx -width   -> * 10^ -6
            campar[3+offset] = (double)mCellHeight/1000000.0;  // Sy -height  -> * 10^ -6
            campar[4 + offset] = (double)image.mWidth * 0.5;                  // x -principal point
            campar[5 + offset] = (double)image.mHeight * 0.5;                 // y -principal point
            campar[6+offset] = image.mWidth;                      // imagewidth
            campar[7+offset] = image.mHeight;                     // imageheight

            if(paramsListSize==11)
            {
                campar[8] = mMotionVx/1000000.0;
                campar[9] = mMotionVy/1000000.0;
                campar[10]= mMotionVz/1000000.0;

                campar[5+offset] = 0;     // y -principal point = 0 for line scan camera
            }

            return campar;
        }
 /// <summary>
 /// Calls the actual <c>addQualityIssue</c>
 /// method, with the feature list obtained from the
 /// calibration image <c>cImg</c>
 /// </summary>
 /// <param name="cImg">
 /// Calibration image model, which has been tested for
 /// the quality feature defined with <c>type</c>
 /// </param>
 /// <param name="type">
 /// Constant starting with QUALITY_* describing one of the quality 
 /// features
 /// </param>
 /// <param name="score">
 /// Score determined for the quality feature
 /// </param>
 public void addQualityIssue(CalibImage cImg, int type, double score)
 {
     ArrayList qList = cImg.getQualityIssueList();
     addQualityIssue(qList, type, score);
 }
        /// <summary>
        /// Add a new calibration image to the list <c>CalibData</c>.
        /// The image is read from the location <c>filename</c>
        /// and a new calibration image instance is then 
        /// generated, embedding this image.
        /// As a preparation step prior to the calibration process, the 
        /// basic information for the calibration image are determined,
        /// in terms of: detection of the region plate and the marks
        /// and pose.
        /// </summary>
        /// <returns>
        /// Instance of a calibration image model created for 
        /// the calibration image, supplied by <c>filename</c>
        /// </returns>
        public CalibImage addImage(string filename)
        {
            HImage     image = null;
            CalibImage data = null;

            try
            {
                image = new HImage(filename);
                data  = new CalibImage(image, this);
                CalibData.Add(data);
                data.UpdateCaltab(true);
                mCanCalib = (mCanCalib && (data.mCanCalib==0));
                mCalibValid = false;
            }
            catch(HOperatorException e)
            {
                mErrorMessage = e.Message;
                NotifyCalibObserver(CalibrationAssistant.ERR_READING_FILE);
            }

            return data;
        }
        /// <summary>
        /// Tests different quality features for the calibration image 
        /// <c>cImg</c>
        /// </summary>
        /// <returns>
        /// Returns a value indicating the success or failure
        /// of the quality assessment
        /// </returns>
        public bool testQualityIssues(CalibImage cImg)
        {
            ArrayList qList;

            HObject markContours;
            HObject plateRegion;
            HImage  mImg;
            HTuple  score, score2, contrast;
            int  numRegions, numContours;
            bool qualityFailure;

            mImg            = cImg.getImage();
            qList           = cImg.getQualityIssueList();
            procedure       = new QualityProcedures();
            contrast        = new HTuple();
            qualityFailure  = false;
            // DescriptionFileName = mDescrFileName;
            ;

            try
            {
                procedure.find_caltab_edges(mImg, out plateRegion,
                                            out markContours,
                                            new HTuple(mDescrFileName));
                numRegions   = plateRegion.CountObj();
                numContours  = markContours.CountObj();

                if(mImageTests < QUALITY_ISSUE_TEST_NONE)
                {
                    if(numRegions == 0)
                    {
                        qualityFailure = true;
                    }
                    else
                    {
                        procedure.eval_caltab_overexposure(mImg, plateRegion, out score);
                        addQualityIssue(qList, QUALITY_ISSUE_IMG_EXPOSURE, score.D);
                    }

                    if(numContours == 0)
                    {
                        qualityFailure = true;
                    }
                    else
                    {
                        procedure.eval_caltab_contrast_homogeneity(mImg, markContours,out contrast, out score, out score2);
                        addQualityIssue(qList, QUALITY_ISSUE_IMG_CONTRAST,    score.D);
                        addQualityIssue(qList, QUALITY_ISSUE_IMG_HOMOGENEITY, score2.D);

                        procedure.eval_caltab_size(mImg, plateRegion, markContours, out score);
                        addQualityIssue(qList, QUALITY_ISSUE_IMG_CALTAB_SIZE, score.D);
                    }

                    if(mImageTests == QUALITY_ISSUE_TEST_ALL)
                    {
                        procedure.eval_caltab_focus(mImg, markContours,contrast , out score);
                        addQualityIssue(qList, QUALITY_ISSUE_IMG_FOCUS, score.D);
                    }
                }
            }
            catch(HOperatorException e)
            {
                throw(e);
            }

            return qualityFailure;
        }
 /// <summary>
 /// 取得校正影像品質報告
 /// </summary>
 /// <param name="descFile"></param>
 /// <param name="calibImage"></param>
 /// <param name="plateParam"></param>
 /// <param name="startCameraParam"></param>
 /// <returns></returns>
 public CalibImageViewModel GetCalibtionImageReport(string descFile, CalibImage calibImage, CalibrationPlateParam plateParam, HTuple startCameraParam)
 {
     //ToDo
     return new CalibImageViewModel();
 }