using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenCV.OpenCV
{
    internal partial class OpenCVClass
    {
        public IplImage GoodFeaturesToTrack(IplImage src)
        {
            _cvt = new IplImage(src.Size, BitDepth.U8, 3);
            IplImage eigImage = new IplImage(src.Size, BitDepth.U8, 1);
            IplImage tempImage = new IplImage(src.Size, BitDepth.U8, 1);

            Cv.Copy(src, _cvt);
            _gray = GrayScale(src);

            CvPoint2D32f[] corners;
            int cornerCount = 150;

            Cv.GoodFeaturesToTrack(_gray, eigImage, tempImage, out corners, ref cornerCount, 0.01, 5);

            for (int i = 0; i < cornerCount; i++)
            {
                Cv.DrawCircle(_cvt, corners[i], 3, CvColor.Red, 1);
            }

            return _cvt;
        }
    }
}
