MCPcopy Create free account
hub / github.com/UZ-SLAMLab/ORB_SLAM3 / ORBextractor

Method ORBextractor

src/ORBextractor.cc:409–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407 };
408
409 ORBextractor::ORBextractor(int _nfeatures, float _scaleFactor, int _nlevels,
410 int _iniThFAST, int _minThFAST):
411 nfeatures(_nfeatures), scaleFactor(_scaleFactor), nlevels(_nlevels),
412 iniThFAST(_iniThFAST), minThFAST(_minThFAST)
413 {
414 mvScaleFactor.resize(nlevels);
415 mvLevelSigma2.resize(nlevels);
416 mvScaleFactor[0]=1.0f;
417 mvLevelSigma2[0]=1.0f;
418 for(int i=1; i<nlevels; i++)
419 {
420 mvScaleFactor[i]=mvScaleFactor[i-1]*scaleFactor;
421 mvLevelSigma2[i]=mvScaleFactor[i]*mvScaleFactor[i];
422 }
423
424 mvInvScaleFactor.resize(nlevels);
425 mvInvLevelSigma2.resize(nlevels);
426 for(int i=0; i<nlevels; i++)
427 {
428 mvInvScaleFactor[i]=1.0f/mvScaleFactor[i];
429 mvInvLevelSigma2[i]=1.0f/mvLevelSigma2[i];
430 }
431
432 mvImagePyramid.resize(nlevels);
433
434 mnFeaturesPerLevel.resize(nlevels);
435 float factor = 1.0f / scaleFactor;
436 float nDesiredFeaturesPerScale = nfeatures*(1 - factor)/(1 - (float)pow((double)factor, (double)nlevels));
437
438 int sumFeatures = 0;
439 for( int level = 0; level < nlevels-1; level++ )
440 {
441 mnFeaturesPerLevel[level] = cvRound(nDesiredFeaturesPerScale);
442 sumFeatures += mnFeaturesPerLevel[level];
443 nDesiredFeaturesPerScale *= factor;
444 }
445 mnFeaturesPerLevel[nlevels-1] = std::max(nfeatures - sumFeatures, 0);
446
447 const int npoints = 512;
448 const Point* pattern0 = (const Point*)bit_pattern_31_;
449 std::copy(pattern0, pattern0 + npoints, std::back_inserter(pattern));
450
451 //This is for orientation
452 // pre-compute the end of a row in a circular patch
453 umax.resize(HALF_PATCH_SIZE + 1);
454
455 int v, v0, vmax = cvFloor(HALF_PATCH_SIZE * sqrt(2.f) / 2 + 1);
456 int vmin = cvCeil(HALF_PATCH_SIZE * sqrt(2.f) / 2);
457 const double hp2 = HALF_PATCH_SIZE*HALF_PATCH_SIZE;
458 for (v = 0; v <= vmax; ++v)
459 umax[v] = cvRound(sqrt(hp2 - v * v));
460
461 // Make sure we are symmetric
462 for (v = HALF_PATCH_SIZE, v0 = 0; v >= vmin; --v)
463 {
464 while (umax[v0] == umax[v0 + 1])
465 ++v0;
466 umax[v] = v0;

Callers

nothing calls this directly

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected