Dense: Fix out of memory edge case due to footprint explosion #1236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey 👋
I've tracked down a recurring (but infrequent) issue that would cause OpenMVS to attempt to resize a depthmap to a very large size and causing:
This seems to happen when noise from an input sparse point cloud places a point really, really close to a view. When that happens, the
footprint1can end up being (focal / very very small depth value) -->very large number. In turn, this causesfScaleRatioto be set to a very large number, which pushes theavgScalevalue, and thusneighbor.scaleto be a very large number.This causes the call to:
In
InitViewsto crash the program.One possible solution here is to bump the depth checks from 0 to a reasonable epsilon (I've picked 0.01, because the dataset where I reproduced this had a depth value of 0.000001), or another one could be to track a median scale rather than average (which would filter out noisy scale values).