private void button_DragModelRegion_Click(object sender, EventArgs e) { if (showRegion != null) { if (showRegion.IsInitialized()) { showRegion.Dispose(); } } showRegion = regionModifyForm.ModifyRegion; htWindow.Focus(); HObject ho_show_region = null, ho_dragRect = null, ho_update_show_contour = null; HOperatorSet.GenRegionContourXld(LoctionModels.showContour, out ho_show_region, "filled"); HOperatorSet.DragRegion1(ho_show_region, out ho_dragRect, htWindow.HTWindow.HalconWindow); HOperatorSet.GenContourRegionXld(ho_dragRect, out ho_update_show_contour, "border"); HOperatorSet.ConcatObj(ho_update_show_contour, showRegion, out showRegion); if (regionModifyForm != null) { if (!regionModifyForm.IsDisposed) { regionModifyForm.Dispose(); } } regionModifyForm = new RegionModifyForm(htWindow, showRegion, RegionModifyForm.RegionMode.contour); regionModifyForm.Dock = DockStyle.Fill; regionModifyForm.Visible = true; panel1.Controls.Add(regionModifyForm); _station.operation.ShowImage(htWindow, htWindow.Image, showRegion); }
private void button_FindModel_Click(object sender, EventArgs e) { if (showRegion != null) { if (showRegion.IsInitialized()) { showRegion.Dispose(); } } _station.operation.ShowImage(htWindow, htWindow.Image, null); HTuple hv_found_row = null; HTuple hv_found_col = null; HTuple hv_found_angle = null; HTuple hv_found_score = null; HTuple hv_update_def_row = null; HTuple hv_update_def_col = null; HTuple hv_model_H_new = null; HTuple hv_iFlag = null; VisionMethon.find_model_ext(htWindow.Image, htWindow.Image, LoctionModels.showContour, out showRegion, LoctionModels.modelType, LoctionModels.modelID, -1, -1, ((double)trackBar1.Value) / 100, 0, LoctionModels.defRows, LoctionModels.defCols, out hv_found_row, out hv_found_col, out hv_found_angle, out hv_found_score, out hv_update_def_row, out hv_update_def_col, out hv_model_H_new, out hv_iFlag); _station.operation.ShowImage(htWindow, htWindow.Image, showRegion); if (regionModifyForm != null) { if (!regionModifyForm.IsDisposed) { regionModifyForm.Dispose(); } } regionModifyForm = new RegionModifyForm(htWindow, showRegion, RegionModifyForm.RegionMode.contour); regionModifyForm.Dock = DockStyle.Fill; regionModifyForm.Visible = true; panel1.Controls.Add(regionModifyForm); }