如何获取Harris Corner检测中的兴趣点c#

时间:2013-05-16 02:07:01

标签: c# emgucv

我正在使用Emgucv实现Harries Corner探测器 我已将代码转换为C# 使用此链接

http://docs.opencv.org/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.html 所以我想访问这些角落的坐标或有关此兴趣点的任何信息 这该怎么做 ? 感谢

1 个答案:

答案 0 :(得分:0)

您可以制作Harris Corner Image的阈值图像,然后迭代它。这种方式是点的强度为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 
                }
            }
        }