cdcseacave / openMVS

open Multi-View Stereo reconstruction library
http://cdcseacave.github.io
GNU Affero General Public License v3.0
3.35k stars 908 forks source link

Filtered depth maps are being discarded #290

Open mitjap opened 6 years ago

mitjap commented 6 years ago

Specifications like the version of the project, operating system, and hardware

Running master branch

Steps to reproduce the problem

Looking at the code we found this weird behavior after filtering the depth maps.

Filtered depth and confidence maps are being save to disk (here) so that original values are not overwritten until safe. Later on these files are read from disk (here) thus overwriting actual data in memory and removing these files. But few lines later this same data is removed from memory (presumably to save memory) - this happens here <-- this is the problematic part

When fusing the depthmaps we again read original (non-filtered) depthmaps (*.dmap) from disk (here).

Our solution

We are now saving depthData to *new.dmap just before releasing its memory and loading that same file when fusing and the results we get are much better.

Sorry that this is not a pull request :)

cdcseacave commented 6 years ago

Thx @mitjap, great finding, you are right! This is very weird, so I checked the first version of the code (pre-github version) and there is correct, there is this line depthData.Save(ComposeDepthFilePath(idx, "dmap")); just before depthData.DecRef(); ... no idea when/why I deleted it.

cdcseacave commented 6 years ago

pls check if the latest version works similar to your fix

if you have other ideas how to improve the code, please contribute