Exemplo n.º 1
0
        private ShapeMatchResult FindShapeModel()
        {
            HImage img = OnGetImage();

            if (img == null)
            {
                throw new Exception("匹配错误,图片无效");
            }

            shapeXLDModel.InputImg.Dispose();
            shapeXLDModel.InputImg = img;
            shapeXLDModel.FindModel();

            if (shapeXLDModel.OutputResult.Count > 0)
            {
                if (calibratePPControl != null)
                {
                    ShapeModel.dev_display_shape_matching_results(
                        calibratePPControl.HWindowControl.HalconWindow,
                        shapeXLDModel.shapeModel,
                        "green",
                        shapeXLDModel.OutputResult.Row,
                        shapeXLDModel.OutputResult.Col,
                        shapeXLDModel.OutputResult.Angle,
                        shapeXLDModel.OutputResult.Scale,
                        shapeXLDModel.OutputResult.Scale,
                        0);

                    calibratePPControl.HWindowControl.HalconWindow.DispCross(shapeXLDModel.OutputResult.Row, shapeXLDModel.OutputResult.Col, 30, shapeXLDModel.OutputResult.Angle);
                }
            }

            return(shapeXLDModel.OutputResult);
        }