public int windowsmallregionwidth = 5;//4边小矩形的大小 /// <summary>Paints the ROI into the supplied window</summary> /// <param name="window">HALCON window</param> public override void draw(HalconDotNet.HWindow window) { window.DispRectangle1(row1, col1, row2, col2); if (SizeEnable && ShowRect) { int hrow, hcol, hw, hh; window.GetPart(out hrow, out hcol, out hh, out hw); int wrow, wcol, ww, wh; window.GetWindowExtents(out wrow, out wcol, out ww, out wh); double smallregionwidth = (hw - hcol) * windowsmallregionwidth / ww; double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh; //焦点小矩形最小为5 if (smallregionwidth < 5) { smallregionwidth = 5; } if (smallregionheight < 5) { smallregionheight = 5; } window.DispRectangle2(row1, col1, 0, smallregionheight, smallregionwidth); window.DispRectangle2(row1, col2, 0, smallregionheight, smallregionwidth); window.DispRectangle2(row2, col2, 0, smallregionheight, smallregionwidth); window.DispRectangle2(row2, col1, 0, smallregionheight, smallregionwidth); window.DispRectangle2(midR, midC, 0, smallregionheight, smallregionwidth); } }
/// <summary> /// Paints the active handle of the ROI object into the supplied window /// </summary> /// <param name="window">HALCON window</param> public override void displayActive(HalconDotNet.HWindow window) { if (!SizeEnable || !ShowRect) { return; } int hrow, hcol, hw, hh; window.GetPart(out hrow, out hcol, out hh, out hw); int wrow, wcol, ww, wh; window.GetWindowExtents(out wrow, out wcol, out ww, out wh); double smallregionwidth = (hw - hcol) * windowsmallregionwidth / ww; double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh; window.DispRectangle2(rows[activeHandleIdx].D, cols[activeHandleIdx].D, phi, smallregionwidth, smallregionheight); if (activeHandleIdx == 5) { window.DispArrow(midR, midC, midR + (Math.Sin(-phi) * length1 * 1.2), midC + (Math.Cos(-phi) * length1 * 1.2), 2.0); } }
/// <summary> /// Paints the active handle of the ROI object into the supplied window. /// </summary> public override void displayActive(HalconDotNet.HWindow window) { if (!SizeEnable || !ShowRect) { return; } int hrow, hcol, hw, hh; window.GetPart(out hrow, out hcol, out hh, out hw); int wrow, wcol, ww, wh; window.GetWindowExtents(out wrow, out wcol, out ww, out wh); double smallregionwidth = (hw - hcol) * windowsmallregionwidth / ww; double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh; switch (activeHandleIdx) { case 0: window.DispRectangle2(row1, col1, 0, smallregionheight, smallregionwidth); break; case 1: window.DispObj(arrowHandleXLD); //window.DispRectangle2(row2, col2, 0, 5, 5); break; case 2: window.DispRectangle2(midR, midC, 0, smallregionheight, smallregionwidth); break; } }
public int windowsmallregionwidth = 5;//4边小矩形的大小 /// <summary>Paints the ROI into the supplied window.</summary> public override void draw(HalconDotNet.HWindow window) { window.DispLine(row1, col1, row2, col2); if (SizeEnable && ShowRect) { int hrow, hcol, hw, hh; window.GetPart(out hrow, out hcol, out hh, out hw); int wrow, wcol, ww, wh; window.GetWindowExtents(out wrow, out wcol, out ww, out wh); double smallregionwidth = (hw - hcol) * windowsmallregionwidth / ww; double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh; window.DispRectangle2(row1, col1, 0, smallregionheight, smallregionwidth); window.DispObj(arrowHandleXLD); //window.DispRectangle2( row2, col2, 0, 5, 5); window.DispRectangle2(midR, midC, 0, smallregionheight, smallregionwidth); } }
public int windowsmallregionwidth = 5;//4边小矩形的大小 /// <summary>Paints the ROI into the supplied window</summary> /// <param name="window">HALCON window</param> public override void draw(HalconDotNet.HWindow window) { window.DispRectangle2(midR, midC, phi, length1, length2); if (SizeEnable && ShowRect) { int hrow, hcol, hw, hh; window.GetPart(out hrow, out hcol, out hh, out hw); int wrow, wcol, ww, wh; window.GetWindowExtents(out wrow, out wcol, out ww, out wh); double smallregionwidth = (hw - hcol) * windowsmallregionwidth / ww; double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh; for (int i = 0; i < NumHandles; i++) { window.DispRectangle2(rows[i].D, cols[i].D, phi, smallregionwidth, smallregionheight); } window.DispArrow(midR, midC, midR + (Math.Sin(-phi) * length1 * 1.2), midC + (Math.Cos(-phi) * length1 * 1.2), 2.0); } }
public int windowsmallregionwidth = 5;//小矩形的大小 public override void draw(HalconDotNet.HWindow window) { //window.SetColor("white"); //window.SetLineStyle(0); //window.SetLineWidth(1); window.DispRegion(mCurHRegion); if (SizeEnable && ShowRect) { int hrow, hcol, hw, hh; window.GetPart(out hrow, out hcol, out hh, out hw); int wrow, wcol, ww, wh; window.GetWindowExtents(out wrow, out wcol, out ww, out wh); double smallregionwidth = (hw - hcol) * windowsmallregionwidth / ww; double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh; double midR, midC; this.getRegion().AreaCenter(out midR, out midC); window.DispRectangle2(midR, midC, 0, smallregionheight, smallregionwidth); } }