Skip to content

Commit

Permalink
add blackground removal parameter for middlebury
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvano Galliani committed Dec 4, 2015
1 parent 6853a95 commit 1964852
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions algorithmparameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class AlgorithmParameters : public Managed{
bool storePlyFiles;
bool gt_compare;
bool gt_normal_compare;
bool remove_black_background;

//threshold for consistency check
float depthThresh;
Expand Down Expand Up @@ -77,6 +78,7 @@ class AlgorithmParameters : public Managed{
viewSelection = false;
depthMin = 2.0f; // CUDA
depthMax = 20.0f; // CUDA
remove_black_background = false; // CUDA

storePlyFiles = true;
gt_compare = false;
Expand Down
25 changes: 14 additions & 11 deletions fusibile.cu
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,24 @@ __global__ void fusibile (GlobalState &gs, int ref_camera)
// (optional) save texture
if (number_consistent >= gs.params->numConsistentThresh) {
//printf("\tEnough consistent points!\nSaving point %f %f %f", consistent_X.x, consistent_X.y, consistent_X.z);
gs.pc->points[center].coord = consistent_X;
gs.pc->points[center].normal = consistent_normal;
if (gs.params->remove_black_background && consistent_texture>20) // hardcoded for middlebury TODO FIX
{
gs.pc->points[center].coord = consistent_X;
gs.pc->points[center].normal = consistent_normal;

#ifdef SAVE_TEXTURE
if (gs.params->saveTexture)
gs.pc->points[center].texture = consistent_texture;
if (gs.params->saveTexture)
gs.pc->points[center].texture = consistent_texture;
#endif

//// Mark corresponding point on other views as "used"
for ( int i = 0; i < camParams.viewSelectionSubsetNumber; i++ ) {
int idxCurr = camParams.viewSelectionSubset[i];
if (used_list[idxCurr].x==-1)
continue;
//printf("Used list point on camera %d is %d %d\n", idxCurr, used_list[idxCurr].x, used_list[idxCurr].y);
gs.lines[idxCurr].used_pixels [used_list[idxCurr].x + used_list[idxCurr].y*cols] = 1;
//// Mark corresponding point on other views as "used"
for ( int i = 0; i < camParams.viewSelectionSubsetNumber; i++ ) {
int idxCurr = camParams.viewSelectionSubset[i];
if (used_list[idxCurr].x==-1)
continue;
//printf("Used list point on camera %d is %d %d\n", idxCurr, used_list[idxCurr].x, used_list[idxCurr].y);
gs.lines[idxCurr].used_pixels [used_list[idxCurr].x + used_list[idxCurr].y*cols] = 1;
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ static int runFusibile (int argc,
const char* gt_opt = "-gt";
const char* gt_nocc_opt = "-gt_nocc";
const char* pmvs_folder_opt = "--pmvs_folder";
const char* remove_black_background_opt = "-remove_black_background";
//read in arguments
for ( int i = 1; i < argc; i++ )
{
Expand All @@ -587,6 +588,8 @@ static int runFusibile (int argc,
else if ( strncmp ( argv[i], pmvs_folder_opt, strlen ( pmvs_folder_opt ) ) == 0 ) {
inputFiles.pmvs_folder = argv[++i];
}
else if ( strcmp ( argv[i], remove_black_background_opt ) == 0 )
algParameters.remove_black_background = true;
}

if (inputFiles.pmvs_folder.size()>0) {
Expand Down

0 comments on commit 1964852

Please sign in to comment.