1

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

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

4

1 回答 1

0

您可以制作哈里斯角图像的阈值图像,然后对其进行迭代。这样,该点的强度为 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 
                }
            }
        } 
于 2013-05-31T19:59:29.530 回答