public void UpdateROIModel(ROIViewModel updateModel)
 {
     if (updateModel != null)
     {
         this.length1 = updateModel.Length;
         this.length2 = updateModel.Width;
         this.phi     = updateModel.Phi;
         this.midR    = updateModel.CenterRow;
         this.midC    = updateModel.CenterCol;
     }
 }
Esempio n. 2
0
 public void UpdateROIModel(ROIViewModel updateModel)
 {
     if (updateModel != null)
     {
         this.length1 = updateModel.Length;
         this.length2 = updateModel.Width;
         this.phi = updateModel.Phi;
         this.midR = updateModel.CenterRow;
         this.midC = updateModel.CenterCol;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 重設 ROI 資訊
 /// </summary>
 /// <param name="model"></param>
 public override void MakeROI(ROIViewModel model)
 {
     MakeROI(model.CenterRow, model.CenterCol, model.Phi, model.Length, model.Width);
 }
 public override void MakeROI(ROIViewModel model)
 {
     MakeROI(model.CenterRow, model.CenterCol, model.Radius);
 }
 /// <summary>
 /// 重設 ROI 資訊
 /// </summary>
 /// <param name="model"></param>
 public override void MakeROI(ROIViewModel model)
 {
     MakeROI(model.CenterRow, model.CenterCol, model.Phi, model.Length, model.Width);
 }
 public override void MakeROI(ROIViewModel model)
 {
     MakeROI(model.CenterRow, model.CenterCol, model.Radius);
 }
Esempio n. 7
0
 public override void MakeROI(ROIViewModel model)
 {
     MakeROI(model.CenterRow, model.CenterCol, model.Radius, model.StartPhi, model.ExtentPhi, model.ROIWidth);
 }
        /// <summary>
        /// 演算法改這裡
        /// </summary>
        public override void UpdateResults()
        {
            if (mHandle == null)
            {
                return;
            }

            mMeasAssist.exceptionText = "";

            try
            {
                HObject imageReduced;
                HOperatorSet.GenEmptyObj(out imageReduced);
                //建 ROI
                var    roiModel = mRoi.getModelData();
                HTuple row      = roiModel[0];
                var    column   = roiModel[1];
                var    phi      = roiModel[2];
                var    length1  = roiModel[3];
                var    length2  = roiModel[4];
                //Halcon 徑度轉角度
                double degree = phi.D.HalconPhiToDegree();

                bool   terminate = false;
                double degreeSeed, finalDegree;
                degreeSeed = finalDegree = degree;

                //reset result
                mResult = new EdgeResult();
                //旋轉角度, Search Point
                while (!HasResult)
                {
                    var region      = getRectangle2(row, column, degreeSeed, length1, length2);
                    var regionImage = getRegionImage(region);
                    //Reset Handle and mResult
                    mHandle = new HMeasure(mMeasROI[0].D, mMeasROI[1].D,
                                           degreeSeed.ToHalconPhi(), mMeasROI[3].D, mMeasROI[4].D,
                                           mMeasAssist.mWidth, mMeasAssist.mHeight,
                                           mMeasAssist.mInterpolation);
                    measurePos(regionImage);
                    finalDegree = degreeSeed;
                    degreeSeed  = getNextSeed(degreeSeed, phi.D, ref terminate);
                    if (terminate)
                    {
                        break;
                    }
                }
                mResultWorld = new EdgeResult(mResult);

                //Update Model
                var updateableROI = mRoi as ViewROI.Interface.IROIModelUpdateable;
                if (updateableROI != null)
                {
                    mMeasROI[2].D = finalDegree.ToHalconPhi();
                    var updateROIModel = new ROIViewModel()
                    {
                        CenterRow = row.D,
                        CenterCol = column.D,
                        Phi       = finalDegree.ToHalconPhi(),
                        Length    = length1.D,
                        Width     = length2.D,
                    };
                    updateableROI.UpdateROIModel(updateROIModel);
                }
            }
            catch (HOperatorException e)
            {
                mEdgeXLD.Dispose();
                mMeasAssist.exceptionText = e.Message;
                mResultWorld = new EdgeResult();
                return;
            }
            UpdateXLD();
        }
Esempio n. 9
0
 public override void MakeROI(ROIViewModel model)
 {
     MakeROI(model.CenterRow, model.CenterCol, model.Radius, model.StartPhi, model.ExtentPhi, model.ROIWidth);
 }