Orb detector-Number of detected areas-BAD formulation (Bug #3017)
Description
The detector phase of the ORB method detects many-many keypoints.
It is far too much for most of the applications, so it contains
an algorithm to keep the few best keypoints.
This part of the algorithm is bad in the 2.4.4 version.
It assumes that a given scale would have a portion of required number
of keypoints proportional to the linear scale of the scale.
The proper would be proportional to the square of the linear scale.
I tested it, the corrected formulation performs much better
in a registration application. I did not remember wether the basic ORB
article is describing such details or not.
The corrected code (original commented):
orb.cpp:
static void computeKeyPoints(const vector<Mat>& imagePyramid,
const vector<Mat>& maskPyramid,
vector<vector<KeyPoint> >& allKeypoints,
int nfeatures, int firstLevel, double scaleFactor,
int edgeThreshold, int patchSize, int scoreType )
{
int nlevels = (int)imagePyramid.size();
vector<int> nfeaturesPerLevel(nlevels);
// fill the extractors and descriptors for the corresponding scales
//calculate desited numbers per scale:
//original:
// float factor = (float)(1.0 / scaleFactor);
// float ndesiredFeaturesPerScale = nfeatures*(1 - factor)/(1 - (float)pow((double)factor, (double)nlevels));
//Modification:
float factor = (float)(1.0 / scaleFactor);
float factor2D=factor*factor;//scalefactor is linear, factor is areal
float ndesiredFeaturesPerScale = nfeatures*(1 - factor2D)/(1 - (float)pow((double)factor2D, (double)nlevels));
// ratio: curr_scale/all correction since the series doesnt sum to infinity
Our projects needs the corrected functionality
under Android too. I do not know when will I be able to
get my GIT working properly, so if anybody would be so kind
to modify the source please do it and give feedback!
Best regards
zol
Associated revisions
Merge pull request #3017 from f-morozov:akaze
History
Updated by Rui Marques over 11 years ago
This seems like a useful patch, anyone cares to make a pull request?
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4569