Esempio n. 1
0
        /// <summary>
        /// Extracts keypoints by C-style code (cvGetStarKeypoints)
        /// </summary>
        /// <param name="img"></param>
        /// <param name="cimg"></param>
        private void CStyleStarDetector(IplImage img, IplImage cimg)
        {
            using (CvMemStorage storage = new CvMemStorage(0))
            {
                CvStarDetectorParams param = new CvStarDetectorParams(45);
                CvSeq<CvStarKeypoint> keypoints = Cv.GetStarKeypoints(img, storage, param);

                if (keypoints != null)
                {
                    for (int i = 0; i < keypoints.Total; i++)
                    {
                        CvStarKeypoint kpt = keypoints[i].Value;
                        int r = kpt.Size / 2;
                        //Cv.Circle(cimg, kpt.Pt, r, new CvColor(0, 255, 0));
                        //Cv.Line(cimg, new CvPoint(kpt.Pt.X + r, kpt.Pt.Y + r), new CvPoint(kpt.Pt.X - r, kpt.Pt.Y - r), new CvColor(0, 255, 0));
                        //Cv.Line(cimg, new CvPoint(kpt.Pt.X - r, kpt.Pt.Y + r), new CvPoint(kpt.Pt.X + r, kpt.Pt.Y - r), new CvColor(0, 255, 0));
                        cimg.DrawMarker(kpt.Pt.X, kpt.Pt.Y, CvColor.Green, MarkerStyle.CircleAndTiltedCross, kpt.Size);
                    }
                }
            }
        }