Ask Your Question
0

Disable the removal of keypoints near borders with GridAdapter?

asked 2013-06-07 12:43:07 -0500

yes123 gravatar image

updated 2013-06-08 13:17:09 -0500

I am using the GridAdaptedFeatureDetector( ... ) with ORB to have a better distribution of keypoints.

The bad thing is that when you apply a grid all the points near the grid will get eliminated (even tho they are fully immerse in the image)

Is there any way to disable this unwanted behaviour?

Sample:

Ptr<FeatureDetector> det = new OrbFeatureDetector();
Ptr<FeatureDetector> gridDet = new GridAdaptedFeatureDetector(det,totalKeyPointLimit,gridRows,gridCols);

image description

The key part of this behaviour is line 246 and 247:

https://github.com/Itseez/opencv/blob/master/modules/features2d/src/detectors.cpp#L230

Where GridAdpaterFeatureDetectorInvoker builds the right mask. We should expand the mask to about 40-50 overlapping pixels.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-06-08 01:49:20 -0500

The reason for this is quite simple. In order for a keypoint to exist, there must be a certain region of information around it to use later for descriptor creation. If you take a point that lies on a border (since the image parts are processed piece by piece and not together), these points will not have the required amount of pixels surrounding to create the ORB descriptor and thus be removed.

If you want to change this behaviour you will have to dive into the source code of both ORBDescriptor and the GridAdaptedFeatureDetector, to make sure that you know the size of the region around the keypoint needed, add about 15% to that and use that measurement as an overlap value for different parts of the grid. Using overlapping windows will then give you the possibility of finding this keypoints.

edit flag offensive delete link more

Comments

I have digged a bit in the GridAdaptedFeatureDetector. The key part is here: https://github.com/Itseez/opencv/blob/master/modules/features2d/src/detectors.cpp#L230 where it builds the mask to pass to detector_->detect We should make a variable mask considering if the actual subpart is on the border or inside the image.... Hmm

yes123 gravatar imageyes123 ( 2013-06-08 13:14:32 -0500 )edit

Like I said: If it solved your problem, then please accept so this topic shows solved :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-06-08 13:25:59 -0500 )edit

Well it's not 100% solved :D... The problem with overlapping regions is that you will end up with duplicated keypoints (extracted in the overlapped region). Maybe we should overlap only the region on the right side and on bottom side. So you get overlapped regions only within one part... But that maybe be not so easy to implement... Any hint ?

yes123 gravatar imageyes123 ( 2013-06-08 14:14:32 -0500 )edit
1

You should just overlap and be prepared to get doubles. Then loop through your keypoints and remove any points that have two centers with a minimal euclidean distance or so.

Or like you said, partial borders, inside the function, on top, you will have to modify the mask area I guess.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-06-08 14:38:25 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-06-07 12:43:07 -0500

Seen: 714 times

Last updated: Jun 08 '13