实现一个Harris角检测器 [英] Implementing a Harris corner detector

查看:208
本文介绍了实现一个Harris角检测器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我采取以教育为目的Harris角器,但我被困在哈里斯响应的一部分。基本上,我在做什么,就是:

I am implementing a Harris corner detector for educational purposes but I'm stuck at the harris response part. Basically, what I am doing, is:

  1. 在x方向和y方向计算图像强度梯度
  2. (1)
  3. 模糊输出
  4. 在计算哈里斯反应过度(2)
  5. 输出
  6. 在燮preSS非极大值的输出(3)在一个3×3邻域和阈值输出
  1. Compute image intensity gradients in x- and y-direction
  2. Blur output of (1)
  3. Compute Harris response over output of (2)
  4. Suppress non-maximas in output of (3) in a 3x3-neighborhood and threshold output

1和2似乎做工精细;不过,我得到非常小的值作为哈里斯的反应,并没有一点确实达到阈值。输入是一个标准的户外摄影。

1 and 2 seem to work fine; however, I get very small values as the Harris response, and no point does reach the threshold. Input is a standard outdoor photography.

[...]
[Ix, Iy] = intensityGradients(img);
g = fspecial('gaussian');
Ix = imfilter(Ix, g);
Iy = imfilter(Iy, g);
H = harrisResponse(Ix, Iy);
[...]

function K = harrisResponse(Ix, Iy)
    max = 0;
    [sy, sx] = size(Ix);
    K = zeros(sy, sx);
    for i = 1:sx,
        for j = 1:sy,
            H = [Ix(j,i) * Ix(j,i), Ix(j,i) * Iy(j,i)
                Ix(j,i) * Iy(j,i), Iy(j,i) * Iy(j,i)];
            K(j,i) = det(H) / trace(H);
            if K(j,i) > max,
                max = K(j,i);
            end
        end
    end
    max
end

有关的样品图片,最大最终被6.4163e-018似乎太低了。

For the sample picture, max ends up being 6.4163e-018 which seems far too low.

推荐答案

在Harris角点检测一个角落被定义为在一个地区的最高值像素(通常 3X3 5×5 ),所以你对没有点达到门槛的评论似乎很奇怪我。只要收集有更高的价值比 5x5的身边附近其他所有像素的所有像素。

A corner in Harris corner detection is defined as "the highest value pixel in a region" (usually 3X3 or 5x5) so your comment about no point reaching a "threshold" seems strange to me. Just collect all pixels that have a higher value than all other pixels in the 5x5 neighborhood around them.

除此之外: 我不是100%肯定,但我认为你应该有:

Apart from that: I'm not 100% sure, but I think you should have:

K(J,I)= DET(H) - 拉姆达*(跟踪(H)^ 2) 其中的λ是一个正的常数,在你的情况下工作(和哈里斯建议值是0.04)。

K(j,i) = det(H) - lambda*(trace(H)^2) Where lambda is a positive constant that works in your case (and Harris suggested value is 0.04).

在一般的唯一明智的时刻来过滤输入了这一点之前:

In general the only sensible moment to filter your input is before this point:

[IX,IY = intensityGradients(IMG);

过滤 Ix2的 IY2 积Ixy 没有按'牛逼多大意义了我。

Filtering Ix2, Iy2 and Ixy doesn't make much sense to me.

另外,我觉得你的样品code是错在这里(不函数 harrisResponse 有两个或三个输入变量):

Further, I think your sample code is wrong here (does function harrisResponse have two or three input variables?):

H = harrisResponse(Ix2, Ixy, Iy2);
[...]

function K = harrisResponse(Ix, Iy)

这篇关于实现一个Harris角检测器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆