Exemplo n.º 1
0
        public void Run()
        {
            using var image = new Mat(new Size(1920, 1080), MatType.CV_8UC3, Scalar.All(128));

            using var tool = new IntelligentScissorsMB();
            tool.SetEdgeFeatureCannyParameters(16, 100)  // using Canny() as edge feature extractor
            .SetGradientMagnitudeMaxLimit(200);

            // calculate image features
            tool.ApplyImage(image);

            // calculate map for specified source point
            var sourcePoint = new Point(200, 100);

            tool.BuildMap(sourcePoint);

            // fast fetching of contours
            // for specified target point and the pre-calculated map (stored internally)
            var targetPoint = new Point(400, 300);

            using var ptsMat = new Mat <Point>();
            tool.GetContour(targetPoint, ptsMat);

            var pts = ptsMat.ToArray();

            Assert.Equal(201, pts.Length);
        }
Exemplo n.º 2
0
 public void NewAndDispose()
 {
     using var tool = new IntelligentScissorsMB();
     GC.KeepAlive(tool);
 }