/// <summary>
 /// Creates a measurement object for the provided ROI instance.
 /// </summary>
 /// <param name="roi">ROI instance</param>
 /// <param name="mAssist">Reference to controller class</param>
 public MeasurementEdge(ROI roi, MeasureAssistant mAssist)
     : base(roi, mAssist)
 {
     mResult      = new EdgeResult();
     mResultWorld = new EdgeResult();
     UpdateMeasure();
 }
 /// <summary>
 /// Creates a measurement object for the provided ROI instance.
 /// </summary>
 /// <param name="roi">ROI instance</param>
 /// <param name="mAssist">Reference to controller class</param>
 public MeasurementEdge(ROI roi, MeasureAssistant mAssist)
     : base(roi, mAssist)
 {
     mResult = new EdgeResult();
     mResultWorld = new EdgeResult();
     UpdateMeasure();
 }
        /// <summary>
        /// Triggers an update of the measure results because of
        /// changes in the parameter setup or a recreation of the measure
        /// object caused by an update in the ROI model.
        /// </summary>
        public override void UpdateResults()
        {
            if (mHandle == null)
            {
                return;
            }

            mMeasAssist.exceptionText = "";

            try
            {
                HObject imageReduced;
                HOperatorSet.GenEmptyObj(out imageReduced);
                //«Ø ROI
                var     roiModel = mRoi.getModelData();
                var     row      = roiModel[0];
                var     column   = roiModel[1];
                var     phi      = roiModel[2];
                var     length1  = roiModel[3];
                var     length2  = roiModel[4];
                HRegion region   = new HRegion();
                region.GenRectangle2(row.D, column.D, phi.D, length1.D, length2.D);

                if (mMeasAssist.ApplyCalibration && mMeasAssist.IsCalibrationValid)
                {
                    HTuple cameraOut    = HMisc.ChangeRadialDistortionCamPar("adaptive", mMeasAssist.CameraIn, 0.0);
                    var    rectifyImage = mMeasAssist.mImage.ChangeRadialDistortionImage(region, mMeasAssist.CameraIn, cameraOut);
                    measurePos(rectifyImage);
                }
                else
                {
                    HOperatorSet.ReduceDomain(mMeasAssist.mImage, region, out imageReduced);
                    measurePos(new HImage(imageReduced));
                }
                mResultWorld = new EdgeResult(mResult);
            }
            catch (HOperatorException e)
            {
                mEdgeXLD.Dispose();
                mMeasAssist.exceptionText = e.Message;
                mResultWorld = new EdgeResult();
                return;
            }
            UpdateXLD();
        }
        /// <summary>
        /// Triggers an update of the measure results because of
        /// changes in the parameter setup or a recreation of the measure
        /// object caused by an update in the ROI model.
        /// </summary>
        public override void UpdateResults()
        {
            if (mHandle == null)
            {
                return;
            }

            mMeasAssist.exceptionText = "";

            try
            {
                mHandle.MeasurePos(mMeasAssist.mImage,
                                   mMeasAssist.mSigma, mMeasAssist.mThresh,
                                   mMeasAssist.mTransition, mMeasAssist.mPosition,
                                   out mResult.rowEdge, out mResult.colEdge,
                                   out mResult.amplitude, out mResult.distance);

                if (mMeasAssist.mIsCalibValid && mMeasAssist.mTransWorldCoord)
                {
                    Rectify(mResult.rowEdge, mResult.colEdge, out mResultWorld.rowEdge, out mResultWorld.colEdge);
                    mResultWorld.distance  = Distance(mResult.rowEdge, mResult.colEdge, mResult.rowEdge, mResult.colEdge, 1);
                    mResultWorld.amplitude = mResult.amplitude;
                }
                else
                {
                    mResultWorld = new EdgeResult(mResult);
                }
            }
            catch (HOperatorException e)
            {
                mEdgeXLD.Dispose();
                mMeasAssist.exceptionText = e.Message;
                mResultWorld = new EdgeResult();
                return;
            }
            UpdateXLD();
        }
        /// <summary>
        /// Creates an edge result instance containing data from
        /// the provided result value (deep copy).
        /// </summary>
        public EdgeResult(EdgeResult result)
            : this(result.rowEdge, result.colEdge,
				  result.amplitude, result.distance)
        {
        }
Example #6
0
 /// <summary>
 /// Creates an edge result instance containing data from
 /// the provided result value (deep copy).
 /// </summary>
 public EdgeResult(EdgeResult result)
     : this(result.rowEdge, result.colEdge,
            result.amplitude, result.distance)
 {
 }
 /// <summary>Clears measurement result.</summary>
 public override void ClearResultData()
 {
     mResultWorld = new EdgeResult();
 }
        /// <summary>
        /// Triggers an update of the measure results because of  
        /// changes in the parameter setup or a recreation of the measure 
        /// object caused by an update in the ROI model.
        /// </summary>               
        public override void UpdateResults()
        {
            if (mHandle == null)
                return;

            mMeasAssist.exceptionText = "";

            try
            {
                HObject imageReduced;
                HOperatorSet.GenEmptyObj(out imageReduced);
                //«Ø ROI
                var roiModel = mRoi.getModelData();
                var row = roiModel[0];
                var column = roiModel[1];
                var phi = roiModel[2];
                var length1 = roiModel[3];
                var length2 = roiModel[4];
                HRegion region = new HRegion();
                region.GenRectangle2(row.D, column.D, phi.D, length1.D, length2.D);

                if (mMeasAssist.ApplyCalibration && mMeasAssist.IsCalibrationValid)
                {
                    HTuple cameraOut = HMisc.ChangeRadialDistortionCamPar("adaptive", mMeasAssist.CameraIn, 0.0);
                    var rectifyImage = mMeasAssist.mImage.ChangeRadialDistortionImage(region, mMeasAssist.CameraIn, cameraOut);
                    measurePos(rectifyImage);
                }
                else
                {
                    HOperatorSet.ReduceDomain(mMeasAssist.mImage, region, out imageReduced);
                    measurePos(new HImage(imageReduced));
                }
                mResultWorld = new EdgeResult(mResult);
            }
            catch (HOperatorException e)
            {
                mEdgeXLD.Dispose();
                mMeasAssist.exceptionText = e.Message;
                mResultWorld = new EdgeResult();
                return;
            }
            UpdateXLD();
        }
        /// <summary>
        /// Triggers an update of the measure results because of  
        /// changes in the parameter setup or a recreation of the measure 
        /// object caused by an update in the ROI model.
        /// </summary>               
        public override void UpdateResults()
        {
            if (mHandle == null)
                return;

            mMeasAssist.exceptionText = "";

            try
            {
                mHandle.MeasurePos(mMeasAssist.mImage,
                                   mMeasAssist.mSigma, mMeasAssist.mThresh,
                                   mMeasAssist.mTransition, mMeasAssist.mPosition,
                                   out mResult.rowEdge, out mResult.colEdge,
                                   out mResult.amplitude, out mResult.distance);

                if (mMeasAssist.mIsCalibValid && mMeasAssist.mTransWorldCoord)
                {
                    Rectify(mResult.rowEdge, mResult.colEdge, out mResultWorld.rowEdge, out mResultWorld.colEdge);
                    mResultWorld.distance = Distance(mResult.rowEdge, mResult.colEdge, mResult.rowEdge, mResult.colEdge, 1);
                    mResultWorld.amplitude = mResult.amplitude;
                }
                else
                {
                    mResultWorld = new EdgeResult(mResult);
                }
            }
            catch (HOperatorException e)
            {
                mEdgeXLD.Dispose();
                mMeasAssist.exceptionText = e.Message;
                mResultWorld = new EdgeResult();
                return;
            }
            UpdateXLD();
        }
 /// <summary>Clears measurement result.</summary>
 public override void ClearResultData()
 {
     mResultWorld = new EdgeResult();
 }