Skip to content

Commit 5a90d46

Browse files
authored
Merge pull request #1798 from alicevision/fix/meshing
[FuseCut] Fix: Check cam vertex validity in meshing
2 parents 2b944e2 + b706510 commit 5a90d46

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/aliceVision/fuseCut/GraphFiller.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,18 @@ void GraphFiller::rayMarchingGraphEmpty(int vertexIndex,
121121

122122
assert(cam >= 0);
123123
assert(cam < _mp.ncams);
124+
125+
if (_camsVertexes[cam] < 0)
126+
{
127+
return;
128+
}
124129

125130
// Initialisation
126131
GeometryIntersection geometry(vertexIndex); // Starting on global vertex index
127132
Point3d intersectPt = originPt;
128133
// toTheCam
129134
const double pointCamDistance = (_mp.CArr[cam] - originPt).size();
130135

131-
132-
133136
TetrahedronsRayMarching marching(_tetrahedralization, vertexIndex, _camsVertexes[cam], false);
134137

135138
Facet lastIntersectedFacet;
@@ -200,6 +203,14 @@ void GraphFiller::rayMarchingGraphFull(int vertexIndex,
200203
float fullWeight,
201204
double nPixelSizeBehind)
202205
{
206+
assert(cam >= 0);
207+
assert(cam < _mp.ncams);
208+
209+
if (_camsVertexes[cam] < 0)
210+
{
211+
return;
212+
}
213+
203214
const int maxint = std::numeric_limits<int>::max();
204215
const Point3d& originPt = _verticesCoords[vertexIndex];
205216
const double pixSize = _verticesAttr[vertexIndex].pixSize;
@@ -295,7 +306,11 @@ void GraphFiller::forceTedgesByGradientIJCV(float nPixelSizeBehind)
295306
GeometryIntersection geometry(vertexIndex); // Starting on global vertex index
296307
Point3d intersectPt = originPt;
297308
// toTheCam
298-
309+
310+
if (_camsVertexes[cam] < 0)
311+
{
312+
continue;
313+
}
299314

300315
TetrahedronsRayMarching marching(_tetrahedralization, vertexIndex, _camsVertexes[cam], false);
301316

0 commit comments

Comments
 (0)