Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-max suppression

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, 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)

  2. 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?

like image 937
user1709708 Avatar asked Dec 01 '12 12:12

user1709708


People also ask

What is non Max suppression?

Non Maximum Suppression is a computer vision method that selects a single entity out of many overlapping entities (for example bounding boxes in object detection). The criteria is usually discarding entities that are below a given probability bound.

What is use of non Max suppression?

The purpose of non-max suppression is to select the best bounding box for an object and reject or “suppress” all other bounding boxes. The NMS takes two things into account. The objectiveness score is given by the model. The overlap or IOU of the bounding boxes.

Is non Max suppression used in training?

1. Is non-max suppression for bounding boxes obtained from a Region Proposal Network performed during training? Yes, according to the Faster-RCNN paper it states, Some RPN proposals highly overlap with each other.

What is non maximum suppression Python?

The Non-maximum suppression (NMS) function takes in an array of boxes and overlap treshold with a default value of 0.4. The array of boxes must be organized so that every row contains a different bounding box. (Image by author) The overlap treshold determines the overlap in area two bounding boxes are allowed to have.


1 Answers

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.

enter image description here

like image 200
mmgp Avatar answered Sep 22 '22 20:09

mmgp