private static void ResultColIsNullOrEmpty(ResultCol resultCol) { return(!resultCol.PropertiesLoaded.Any() && resultCol == null); }
public void ClearResult() { ResultRow.Clear(); ResultCol.Clear(); ResultAngle.Clear(); }
public void Run(SoftwareRunState softwareRunState) { HTuple HMeasureHandle = new HTuple(); HTuple resultRow, resultCol; if (inputImage == null) { if (softwareRunState == SoftwareRunState.Debug) { FormCaliper.Instance.TextBoxMessageDisp("图像为空", System.Drawing.Color.Red); } toolRunStatu = ToolRunStatu.Not_Input_Image; return; } try { UpdateImage(); if (inputPose != null) { HTuple Row = inputPose.X - templatePose.X; HTuple Col = inputPose.Y - templatePose.Y; HTuple angle = inputPose.U - templatePose.U; HTuple _homMat2D; HOperatorSet.HomMat2dIdentity(out _homMat2D); HOperatorSet.HomMat2dRotate(_homMat2D, (HTuple)(angle), (HTuple)templatePose.X, (HTuple)templatePose.Y, out _homMat2D); HOperatorSet.HomMat2dTranslate(_homMat2D, (HTuple)(Row), (HTuple)(Col), out _homMat2D); //对预期线的起始点做放射变换 HOperatorSet.AffineTransPixel(_homMat2D, (HTuple)expectRecStartRow, (HTuple)expectRecStartColumn, out newExpectRecStartRow, out newExpectRecStartColumn); } else { newExpectRecStartRow = expectRecStartRow; newExpectRecStartColumn = expectRecStartColumn; } HTuple width, height, AmplitudeThreshold, distance; HOperatorSet.GetImageSize(inputImage, out width, out height); HOperatorSet.GenMeasureRectangle2(expectRecStartRow, expectRecStartColumn, expectAngle, length1, length2, width, height, "nearest_neighbor", out HMeasureHandle); HOperatorSet.MeasurePos(inputImage, HMeasureHandle, sigma, threshold, polarity, edgeSelect, out resultRow, out resultCol, out AmplitudeThreshold, out distance); if (resultRow.Length != 0) { ResulttRow = resultRow; ResultCol = resultCol; } //把点显示出来 HOperatorSet.GenCrossContourXld(out crossDisp, ResulttRow, ResultCol, new HTuple(60), new HTuple(0)); if (softwareRunState == SoftwareRunState.Debug) { DispMainWindow(FormCaliper.Instance.myHwindow); FormCaliper.Instance.tbx_resultStartRow.Text = ResulttRow.ToString(); FormCaliper.Instance.tbx_resultStartCol.Text = ResultCol.ToString(); FormCaliper.Instance.TextBoxMessageDisp("运行成功", System.Drawing.Color.Green); } // 参数传递 ParamsTrans(); toolRunStatu = ToolRunStatu.Succeed; } catch (Exception ex) { toolRunStatu = ToolRunStatu.Not_Succeed; if (softwareRunState == SoftwareRunState.Debug) { FormCaliper.Instance.TextBoxMessageDisp("工具运行异常" + ex.Message, System.Drawing.Color.Red); } } finally { //homMat2DArrow.Dispose(); //arrow.Dispose(); //arrowTrans.Dispose(); } }
public VisionShapParam() { ResultRow.Clear(); ResultCol.Clear(); ResultAngle.Clear(); }