/// <summary> /// Match学习ROI /// </summary> /// <param name="image"></param> /// <param name="ppc"></param> internal void MatchLearnPattern(Image image, PicturePanelC ppc) { Bitmap bitmap = new Bitmap(image); EImageC24 image24 = ConvertBitmapToEImageC24(bitmap); _MatchLearnPattern(image24, ppc); }
private void _MatchLearnPattern(EBaseROI image24, PicturePanelC ppc) { EC24Image1Roi1.Attach(image24); EC24Image1Roi1.SetPlacement(ppc.Location.X + 1, ppc.Location.Y + 1, ppc.Width - 8, ppc.Height - 8); m_match.LearnPattern(EC24Image1Roi1);//学习ROI模型 m_match.DontCareThreshold = 80; }
private void paintCut_Event_ROIChanged(PicturePanelC ppc) { if (this.radioButton_Exclude.Checked) { this.ClipBitmap = (Bitmap)ppc.DontCareImage.Clone(); } else { this.ROI = new Rectangle(ppc.Location, ppc.Size); } }
private void pictureBox_Image_MouseDown(object sender, MouseEventArgs e) { try { if (this.pictureBox_Image.Image == null) { return; } if (e.Button == MouseButtons.Right) //右键处理 { rightClickX = e.X; rightClickY = e.Y; enter = false; return; } foreach (Control ctr in this.pictureBox_Image.Controls)//仅仅允许,一种类型存在一个实例 { if (ctr is PicturePanelC) { PicturePanelC ppc = (PicturePanelC)ctr; if ((this.radioButton_ROI.Checked && ppc.PaintType == PicType.ROI) || (this.radioButton_Exclude.Checked && ppc.PaintType == PicType.Exclude)) { return; } } } if (this.radioButton_ROI.Checked) { this.paintCut = new PicturePanelC(); this.paintCut.PaintType = PicType.ROI; } else { this.paintCut = new PicturePanelC(this.pictureBox_Image.Image); this.paintCut.PaintType = PicType.Exclude; } this.paintCut.Event_RegionChanged += new PicturePanelC.dele_ROIChanged(paintCut_Event_ROIChanged); this.paintCut.Event_SelectedType += new PicturePanelC.dele_SelectedType(paintCut_Event_Selected); enter = true; winbeginx = e.X; winbeginy = e.Y; } catch { } }
private void pictureBox_Image_MouseUp(object sender, MouseEventArgs e) { try { if (this.pictureBox_Image.Image == null) { return; } if (e.Button == MouseButtons.Right) //右键不处理 { return; } if (enter) { try { enter = false; int pwidth = e.X - winbeginx; int pheight = e.Y - winbeginy; this.paintCut.WinX = winbeginx; this.paintCut.WinY = winbeginy; this.paintCut.Winwidth = pwidth; this.paintCut.Winheight = pheight; this.paintCut.setPicturepoint(this.pictureBox_Image.Height, this.pictureBox_Image.Width); if (paintCut.Winwidth < 20 || paintCut.Winheight < 20) { this.pictureBox_Image.Controls.Remove(this.paintCut); this.paintCut = null; return; } this.paintCut.paintRectangle(); paintCut_Event_ROIChanged(this.paintCut); this.paintCut = null; } catch { MessageBox.Show("添加目标失败", "ERROR"); } } } catch { } }
/// <summary> /// Match学习ROI /// </summary> /// <param name="image"></param> /// <param name="ppc"></param> internal void MatchLearnPattern(EImageC24 image24, PicturePanelC ppc) { _MatchLearnPattern(image24, ppc); }
/// <summary> /// Match学习ROI /// </summary> /// <param name="image"></param> /// <param name="ppc"></param> internal void MatchLearnPattern(EROIBW8 bw8, PicturePanelC ppc) { _MatchLearnPattern(bw8, ppc); }