Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix number of generated SIFT features #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion FriedLiver/Source/Bundler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Bundler::initSift(unsigned int widthSift, unsigned int heightSift, bool isL
{
if (isLocal) {
m_sift = new SiftGPU;
m_sift->SetParams(widthSift, heightSift, false, 150, GlobalAppState::get().s_sensorDepthMin, GlobalAppState::get().s_sensorDepthMax);
m_sift->SetParams(widthSift, heightSift, false, GlobalBundlingState::get().s_maxNumKeysPerImage, GlobalAppState::get().s_sensorDepthMin, GlobalAppState::get().s_sensorDepthMax);
m_sift->InitSiftGPU();
}
else {
Expand Down
11 changes: 10 additions & 1 deletion FriedLiver/Source/SiftGPU/SiftPyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,21 @@ void SiftPyramid::LimitFeatureCount(int have_keylist)
else
{
int i = 0, num_to_erase = 0;
//remove remaining levels before the number of features drops below the threshold.
while (_featureNum - _levelFeatureNum[i] > _FeatureCountThreshold)
{
num_to_erase += _levelFeatureNum[i];
_featureNum -= _levelFeatureNum[i];
_levelFeatureNum[i++] = 0;
}
//clamp number of features in the last contributing level.
if (_featureNum > _FeatureCountThreshold)
{
int num_to_erase_last = _featureNum - _FeatureCountThreshold;
num_to_erase += num_to_erase_last;
_featureNum -= num_to_erase_last;
_levelFeatureNum[i] -= num_to_erase_last;
}
}
}

Expand Down Expand Up @@ -745,7 +754,7 @@ void SiftPyramid::CreateGlobalKeyPointList(float4* d_keypoints, const float* d_d

//if needed, eliminate lower level keypoints first
std::vector<int> numKeysPerLevel(n, 0); int cur = 0;
const bool bHasMax = maxNumKeyPoints == (unsigned int)-1;
const bool bHasMax = maxNumKeyPoints != (unsigned int)-1;
for (int i = n - 1; i >= 0; i--) {
if (!bHasMax) numKeysPerLevel[i] = _levelFeatureNum[i];
else {
Expand Down
2 changes: 1 addition & 1 deletion FriedLiver/zParametersBundlingDefault.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ s_denseOverlapCheckSubsampleFactor = 4;

s_maxNumImages = 1200;
s_submapSize = 10;
s_maxNumKeysPerImage = 1024;
s_maxNumKeysPerImage = 150;

s_useLocalDense = true;
s_numOptPerResidualRemoval = 1;
Expand Down