示例#1
0
        private void btn获取图片_Click(object sender, EventArgs e)
        {
            string ImagePath = ImagesPath[count++];

            halconFun.ReadImage(ImagePath);
            if (!matchName.Equals("无模板定位"))
            {
                matchingfun.Find(halconFun.m_hoImage, out halconFun.m_hoImage);
            }
            halconFun.ShowImage();
            ParameterSetControl.SetHalconImage(halconFun.m_hoImage);
            count %= ImagesPath.Length;
        }
        private void btn测试模板_Click(object sender, EventArgs e)
        {
            if (matchingfun is null)
            {
                MessageBox.Show("请创建定位模板");
                return;
            }
            double score;

            matchingfun.Find(halconFun.m_hoImage, out halconFun.m_hoImage, out score);
            halconFun.HWindowRefresh(Color.Red, HalconFun.RegionFillMode.Margin);
            lab模板匹配率.Text = "模板匹配率:" + score.ToString("P3");
        }