非最大抑制 [英] Non-max suppression

查看:258
本文介绍了非最大抑制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经知道,你可以使用 atan(dy / dx)获得梯度方向,它是与边缘正交的方向。
现在我们有一个家庭作业,我们应该将这个方向离散化为四个类别(x和y方向和两个对角线),然后检查两个像素邻居的最佳匹配方向为非最大抑制

We've learned that you can get the gradient direction with atan(dy/dx) which is the direction orthogonal to the edge. Now we had a homework where we were supposed to discretize this direction into four classes (x- and y-direction and both diagonals) and then check both pixel neighbors in the best matching direction for non-max suppression.

我没有完全获得解决方案。显然我们有四种情况:

I didn't fully get the solution though. Obviously we had four cases:


  1. abs(angle) pi / 8 ,所以在x方向的渐变(大致)点,因此我们检查 img(i,j-1) c $ c> img(i,j + 1)(假设图片来源位于左上角)

  1. abs(angle) < pi/8, so the gradient (roughly) points in x-direction, thus we check img(i, j-1) and img(i, j+1) (assuming the image origin is in the top left)

angle> pi / 8&&角度<= 3 * pi / 8 ,因此渐变指向右上角。现在我想我们需要检查 img(i-1,j + 1) img(i + 1,j-1) img(i-1,j-1) img(i + 1,j + 1) code>这似乎是正交对角线。

angle > pi/8 && angle <= 3*pi/8, so the gradient points to the top right. Now I thought we need to check img(i-1, j+1) and img(i+1, j-1) but instead we check img(i-1, j-1) and img(i+1, j+1) which seems like the orthogonal diagonal.

我试图改变这一点,但边缘看起来很奇怪,所以这似乎是正确的,但我不明白为什么。

The other two cases are equivalent. I tried to change this but then the edges really look weird so this seems correct but I don't understand why.

有人可以向我解释这个吗?

Can someone explain this to me?

推荐答案

非最大抑制是消除不在重要边缘的点的一种方法。在第一种情况下,如果梯度在给定点接近零度,这意味着边缘是北部或南部,如果该点的大小大于该点,则该点将被认为在边缘上两个大小的点到它的左边和右边(如在你的例子)。在第二种情况下,您将检查45度的渐变,因此边缘为135度,因此如果它大于沿梯度方向的点,则保留该点,即(-1,-1)和(1 ,1)。旋转坐标系不会影响此。

Non-max suppression is a way to eliminate points that do not lie in important edges. In your first case if the gradient is close to zero degrees at a given point, that means the edge is to the north or to the south, and that point will be considered to be on the edge if the magnitude of this point is greater than both magnitudes of the points to its left and right (as in your example). In your second case you are checking for gradient at 45 degrees, so the edge is at 135 degrees, and so you keep the point if it is greater than the points along the gradient direction, i.e. (-1, -1) and (1, 1). Rotating the coordinate system doesn't affect this.

这篇关于非最大抑制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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