/// <summary> /// 显示检测直线 /// </summary> /// <param name="hv_ImageWindow"></param> /// <param name="hv_ZoomFactor"></param> /// <param name="LineDetect"></param> /// <param name="color"></param> public static void ShowLine(HTuple hv_ImageWindow, HTuple hv_ZoomFactor, LineDetect LineDetect, HTuple color) { HTuple hv_LineRowBegin = new HTuple(); HTuple hv_LineColumnBegin = new HTuple(); HTuple hv_LineRowEnd = new HTuple(); HTuple hv_LineColumnEnd = new HTuple(); HObject ho_MeasuredLine = new HObject(); HTuple hv_PointRow = new HTuple(); HTuple hv_PointColumn = new HTuple(); hv_LineRowBegin = LineDetect.hv_LineRowBegin * hv_ZoomFactor; hv_LineColumnBegin = LineDetect.hv_LineColumnBegin * hv_ZoomFactor; hv_LineRowEnd = LineDetect.hv_LineRowEnd * hv_ZoomFactor; hv_LineColumnEnd = LineDetect.hv_LineColumnEnd * hv_ZoomFactor; try { HOperatorSet.GenRegionLine(out ho_MeasuredLine, hv_LineRowBegin, hv_LineColumnBegin, hv_LineRowEnd, hv_LineColumnEnd); HOperatorSet.SetLineWidth(hv_ImageWindow, 3); HOperatorSet.SetColor(hv_ImageWindow, color); HOperatorSet.DispObj(ho_MeasuredLine, hv_ImageWindow); } catch (Exception) { } HOperatorSet.SetLineWidth(hv_ImageWindow, 1); ho_MeasuredLine.Dispose(); }
public static void ShowMeasureRectangle(HTuple hv_ImageWindow, HTuple hv_ZoomFactor, LineDetect LineDetect, HTuple color) { HTuple hv_Row1 = new HTuple(); HTuple hv_Column1 = new HTuple(); HTuple hv_Row2 = new HTuple(); HTuple hv_Column2 = new HTuple(); HTuple hv_MeasureLength1 = new HTuple(); hv_Row1 = LineDetect.hv_MeasureRow1 * hv_ZoomFactor; hv_Column1 = LineDetect.hv_MeasureColumn1 * hv_ZoomFactor; hv_Row2 = LineDetect.hv_MeasureRow2 * hv_ZoomFactor; hv_Column2 = LineDetect.hv_MeasureColumn2 * hv_ZoomFactor; hv_MeasureLength1 = LineDetect.hv_MeasureLength1 * hv_ZoomFactor; HOperatorSet.DistancePp(hv_Row1, hv_Column1, hv_Row2, hv_Column2, out HTuple hv_Distance); HOperatorSet.AngleLx(hv_Row1, hv_Column1, hv_Row2, hv_Column2, out HTuple hv_Angle); HOperatorSet.GenRectangle2(out HObject ho_Rectangle, (hv_Row1 + hv_Row2) / 2, (hv_Column1 + hv_Column2) / 2, hv_Angle, hv_Distance / 2, hv_MeasureLength1); HOperatorSet.SetColor(hv_ImageWindow, color); HOperatorSet.SetDraw(hv_ImageWindow, "margin"); HOperatorSet.SetLineWidth(hv_ImageWindow, 2); HOperatorSet.DispObj(ho_Rectangle, hv_ImageWindow); HOperatorSet.SetLineWidth(hv_ImageWindow, 1); ho_Rectangle.Dispose(); }