Skip to content

Commit

Permalink
[fuseCut] delaunayGraphCut: remove the unused JancosekCVPR11 method
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmtE committed Jul 28, 2020
1 parent 5788332 commit 7aa5b7b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 129 deletions.
124 changes: 0 additions & 124 deletions src/aliceVision/fuseCut/DelaunayGraphCut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1744,107 +1744,6 @@ void DelaunayGraphCut::fillGraphPartPtRc(int& out_nstepsFront, int& out_nstepsBe
}
}

void DelaunayGraphCut::forceTedgesByGradientCVPR11(bool fixesSigma, float nPixelSizeBehind)
{
ALICEVISION_LOG_INFO("Forcing t-edges.");
long t2 = clock();

float forceTEdgeDelta = (float)mp->userParams.get<double>("delaunaycut.forceTEdgeDelta", 0.1f);
ALICEVISION_LOG_INFO("forceTEdgeDelta: " << forceTEdgeDelta);

float beta = (float)mp->userParams.get<double>("delaunaycut.beta", 1000.0f);
ALICEVISION_LOG_INFO("beta: " << beta);

for(GC_cellInfo& c: _cellsAttr)
{
c.on = 0.0f;
}

// choose random order to prevent waiting
const unsigned int seed = (unsigned int)mp->userParams.get<unsigned int>("delaunaycut.seed", 0);
const std::vector<int> verticesRandIds = mvsUtils::createRandomArrayOfIntegers(_verticesAttr.size(), seed);

#pragma omp parallel for
for(int i = 0; i < verticesRandIds.size(); ++i)
{
const int vertexIndex = verticesRandIds[i];
GC_vertexInfo& v = _verticesAttr[vertexIndex];
if(v.isVirtual())
continue;

const Point3d& originPt = _verticesCoords[vertexIndex];
for(int c = 0; c < v.cams.size(); ++c)
{
int cam = v.cams[c];

// False here mean nearest
const bool nearestFarest = true;
Facet fFirst = getFacetFromVertexOnTheRayToTheCam(vertexIndex, cam, nearestFarest);

// get the tetrahedron next to point p on the ray from c
// False here mean farest
Facet facet = getFacetFromVertexOnTheRayToTheCam(vertexIndex, cam, false);

if((fFirst.cellIndex != GEO::NO_CELL) && (facet.cellIndex != GEO::NO_CELL) && (!isInfiniteCell(facet.cellIndex)))
{
float eFirst = _cellsAttr[fFirst.cellIndex].emptinessScore;

Point3d p = originPt; // HAS TO BE HERE !!!
float maxDist = nPixelSizeBehind * mp->getCamPixelSize(p, cam);
if(fixesSigma)
{
maxDist = nPixelSizeBehind;
}

bool ok = (facet.cellIndex != GEO::NO_CELL);
while(ok)
{
Point3d pold = p;
Point3d intersectPt;
Facet outFacet;

// Intersection with the next facet in the current tetrahedron (ci) in order to find the cell farest
// to the cam which is intersected with cam-p ray
// False here mean farest
const bool nearestFarest = false;
if(!rayCellIntersection(mp->CArr[cam], p, facet, outFacet, nearestFarest, intersectPt) ||
((originPt - pold).size() >= maxDist))
{
ok = false;
}
else
{
// Take the mirror facet to iterate over the next cell
facet = mirrorFacet(outFacet);
if(facet.cellIndex == GEO::NO_CELL)
ok = false;
p = intersectPt;
}
}

if(facet.cellIndex != GEO::NO_CELL)
{
const float eLast = _cellsAttr[facet.cellIndex].emptinessScore;
if((eFirst > eLast) && (eFirst < beta) && (eLast / eFirst < forceTEdgeDelta))
{
#pragma OMP_ATOMIC_UPDATE
_cellsAttr[facet.cellIndex].on += (eFirst - eLast);
}
}
}

} // for c

} // for i

for(GC_cellInfo& c: _cellsAttr)
{
c.cellTWeight = std::max(c.cellTWeight, std::min(1000000.0f, std::max(1.0f, c.cellTWeight) * c.on));
}

mvsUtils::printfElapsedTime(t2, "t-edges forced: ");
}

void DelaunayGraphCut::forceTedgesByGradientIJCV(bool fixesSigma, float nPixelSizeBehind)
{
ALICEVISION_LOG_INFO("Forcing t-edges");
Expand Down Expand Up @@ -2460,32 +2359,9 @@ void DelaunayGraphCut::voteFullEmptyScore(const StaticVector<int>& cams, const s
////////////////////////////////////////////////////////////////////////////////////////////////////////

bool labatutCFG09 = mp->userParams.get<bool>("global.LabatutCFG09", false);
bool jancosekCVPR11 = mp->userParams.get<bool>("global.JancosekCVPR11", false);
// jancosekIJCV: "Exploiting Visibility Information in Surface Reconstruction to Preserve Weakly Supported Surfaces", Michal Jancosek and Tomas Pajdla, 2014
bool jancosekIJCV = mp->userParams.get<bool>("global.JancosekIJCV", true);

if(jancosekCVPR11)
{
float delta = (float)mp->userParams.get<double>("delaunaycut.forceTEdgeDelta", 0.1f);

ALICEVISION_LOG_INFO("Jancosek CVPR 2011 method ( forceTEdgeDelta*100 = " << static_cast<int>(delta * 100.0f) << "):");

fillGraph(false, sigma, false, true, distFcnHeight);

addToInfiniteSw((float)maxint);

if(saveTemporaryBinFiles)
saveDhInfo(folderName + "delaunayTriangulationInfoInit.bin");

if((delta > 0.0f) && (delta < 1.0f))
{
forceTedgesByGradientCVPR11(false, sigma);
}

if(saveTemporaryBinFiles)
saveDhInfo(folderName + "delaunayTriangulationInfoAfterForce.bin");
}

if(jancosekIJCV) // true by default
{
float forceTEdgeDelta = (float)mp->userParams.get<double>("delaunaycut.forceTEdgeDelta", 0.1f);
Expand Down
1 change: 0 additions & 1 deletion src/aliceVision/fuseCut/DelaunayGraphCut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ class DelaunayGraphCut
bool fixesSigma, float nPixelSizeBehind, bool fillOut,
float distFcnHeight);

void forceTedgesByGradientCVPR11(bool fixesSigma, float nPixelSizeBehind);
void forceTedgesByGradientIJCV(bool fixesSigma, float nPixelSizeBehind);

int setIsOnSurface();
Expand Down
4 changes: 0 additions & 4 deletions src/aliceVision/fuseCut/ReconstructionPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,6 @@ mesh::Mesh* joinMeshes(int gl, LargeScale* ls)
{
subFolderName = "LabatutCFG09";
}
if(ls->mp->userParams.get<bool>("global.JancosekCVPR11", true))
{
subFolderName = "JancosekCVPR11";
}
}
subFolderName = subFolderName + "/";

Expand Down

0 comments on commit 7aa5b7b

Please sign in to comment.