Skip to content
shimat edited this page Jan 19, 2019 · 1 revision
var gray = new Mat("lena.png", LoadMode.GrayScale);
var detector = StarDetector.Create(45);

KeyPoint[] keypoints = detector.Run(gray);

foreach (KeyPoint kpt in keypoints)
{
    var color = new Scalar(0, 255, 0);
    float r = kpt.Size / 2;
    Cv2.Circle(dst, kpt.Pt, (int)r, color, 1, LineType.Link8, 0);
    Cv2.Line(dst, 
        new Point2f(kpt.Pt.X + r, kpt.Pt.Y + r), 
        new Point2f(kpt.Pt.X - r, kpt.Pt.Y - r), 
        color, 1, LineType.Link8, 0);
    Cv2.Line(dst, 
        new Point2f(kpt.Pt.X - r, kpt.Pt.Y + r), 
        new Point2f(kpt.Pt.X + r, kpt.Pt.Y - r), 
        color, 1, LineType.Link8, 0);
    }
}
Clone this wiki locally