映像特徵檢測(Image Feature Detection)(二)

來源:互聯網
上載者:User

FAST角點檢測

FAST角點由E. Rosten教授提出,相比其他檢測手段,這種方法的速度正如其名,相當的 快。值得關注的是他所研究的理論都是屬於實用類的,都很快。Rosten教授實現了FAST角點 檢測,並將其提供給了OpenCv,相當的有愛呀;不過OpenCv中的函數和Rosten教授的實現似 乎有點點不太一樣。遺憾的是,OpenCv中目前還沒有FAST角點檢測的文檔。下面是我從 Rosten的代碼中找到的函式宣告,可以看到粗略的參數說明。

/*
The references are:
  * Machine learning for high-speed corner detection,

    E. Rosten and T. Drummond, ECCV 2006
  * Faster and better: A machine learning approach to corner  detection
    E. Rosten, R. Porter and T. Drummond, PAMI, 2009
*/
void cvCornerFast( const CvArr* image, int threshold, int N,
                    int nonmax_suppression, int*  ret_number_of_corners,
                    CvPoint** ret_corners);

image:      OpenCV image in which to detect corners. Must be 8  bit unsigned.
threshold:  Threshold for detection (higher is fewer corners). 0-- 255
N:          Arc length of detector, 9, 10, 11 or 12. 9 is  usually best.
nonmax_suppression: Whether to perform nonmaximal suppression.
ret_number_of_corners: The number of detected corners is returned  here.
ret_corners: The corners are returned here.

EmguCv中的 Image<TColor,TDepth>.GetFASTKeypoints方法也實現了FAST角點檢 測,不過參數少了一些,只有 threshold和nonmaxSupression,其中N我估計取的預設值9, 但是返回的角點數目我不知道是怎麼設定的。

使用FAST角點檢測的範例程式碼如下:

FAST關鍵點

private string FASTKeyPointFeatureDetect()
         {
             //擷取參數
             int threshold = int.Parse (txtFASTThreshold.Text);
             bool nonmaxSuppression =  cbFASTNonmaxSuppression.Checked;
             bool showDetail = cbFASTShowDetail.Checked;
             //計算
             Stopwatch sw = new Stopwatch();
             sw.Start();
             MKeyPoint[] keyPoints =  imageSourceGrayscale.GetFASTKeypoints(threshold, nonmaxSuppression);
             sw.Stop();
             //顯示
             Image<Bgr, Byte> imageResult =  imageSourceGrayscale.Convert<Bgr, Byte>();
             StringBuilder sbResult = new StringBuilder();
             int idx = 0;
             foreach (MKeyPoint keypoint in keyPoints)
             {
                 imageResult.Draw(new CircleF(keypoint.Point,  (int)(keypoint.Size / 2)), new Bgr(255d, 0d, 0d), (int)(keypoint.Size  / 4));
                 if (showDetail)
                     sbResult.AppendFormat("第{0}點(座標 :{1},尺寸:{2},方向:{3}°,響應:{4},octave:{5}),",
                                 idx,  keypoint.Point, keypoint.Size, keypoint.Angle, keypoint.Response,  keypoint.Octave);
                 idx++;
             }
             pbResult.Image = imageResult.Bitmap;
             //釋放資源
             imageResult.Dispose();
             //返回
             return string.Format("·FAST關鍵點,用時{0:F05}毫秒 ,參數(閥值:{1},nonmaxSupression:{2}),檢測到{3}個關鍵點\r\n{4}",
                 sw.Elapsed.TotalMilliseconds, threshold,  nonmaxSuppression, keyPoints.Length, showDetail ? (sbResult.ToString() +  "\r\n") : "");
         }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.