如何访问兴趣点,在哈里斯角检测c#

本文关键字:哈里斯 检测 何访问 访问 | 更新日期: 2023-09-27 18:14:02

我正在使用Emgucv实现哈里斯角检测器我已经把代码转换成c#使用此链接

http://docs.opencv.org/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.html所以我想要访问这些角的坐标或者任何关于这些兴趣点的信息如何做到这一点?由于

如何访问兴趣点,在哈里斯角检测c#

您可以为Harris角图像创建一个阈值图像,然后迭代它。这样,如果点的亮度为255,那么在图像上就会有一个角点的X和Y值。例子:

    // create corner strength image and do Harris
    m_CornerImage = new Image<Gray, float>(m_SourceImage.Size);
        CvInvoke.cvCornerHarris(m_SourceImage, m_CornerImage, 3, 3, 0.01);
        // create and show inverted threshold image
        m_ThresholdImage = new Image<Gray, Byte>(m_SourceImage.Size);
        CvInvoke.cvThreshold(m_CornerImage, m_ThresholdImage, 0.0001, 255.0, Emgu.CV.CvEnum.THRESH.CV_THRESH_BINARY_INV);
        imageBox2.Image = m_ThresholdImage;
        imageBox1.Image = m_CornerImage;
        const double MAX_INTENSITY = 255;
        int contCorners = 0; 
        for (int x = 0; x < m_ThresholdImage.Width; x++)
        {
            for (int y = 0; y < m_ThresholdImage.Height; y++)
            {
                Gray imagenP = m_ThresholdImage[y,x];
                if (imagenP.Intensity == MAX_INTENSITY)
                {
                    //X and Y are harris point cordenates 
                }
            }
        }