nmoehrle / mvs-texturing

Algorithm to texture 3D reconstructions from multi-view stereo images
Other
976 stars 336 forks source link

Color mapping #24

Closed rhiestan closed 8 years ago

rhiestan commented 9 years ago

In newer versions of texrecon, the color mapping is worse than before. As an example, I made a textured 3d reconstruction of the kermit scene (from bundler) with an old texrecon (github of around April 2015) and the current one (github of 23.09.2015). I have seen the same behaviour also with other scenes, however less drastic. Is there a way to have the new features (MVS2 compatibility, reduced memory consumption) and the old color mapping?

Old texrecon: kermit_oldtexrecon

New texrecon: kermit_newtexrecon

Both reconstructions were made with Regard3D (www.regard3d.org, I am the author).

Thanks in advance!

nmoehrle commented 9 years ago

A lot has changed since April especially regarding the handling of the input images. I am aware that the current linerar/gamma tonemapping of the HDR texture is not really robust and sometimes leads to bright textures with low contrast. I am currently thinking about how to tackle this issue btw. thanks for opening it on github :-) It's way easier to justify working on it now ;-)

Currently I use a linear mapping between the 0.005th and the 0.995th percentile min-max. On difficult datasets this appears to be to optimistic, so I will have to clamp more rigorously. I am reluctant to expose these parameters, but I might have to because they seem to be quite dataset dependent. I will look into tonemapping and contrast enhancement, however, I am not sure when I will find the time.

donlk commented 8 years ago

Have you considered switching to mosaic based texture generation instead of these chunks of atlases with variable sizes? That way pixel blending would be much more subtle and even throughout the entire mesh. Its what Agisoft Photoscan uses as well i assume, though It might be computationally expensive..

nmoehrle commented 8 years ago

To address the issue I have created a new branch "tone-mapping" and implemented the tone mapping algorithm of Reinhard et al. [2002]. I can see an enhancement of contrast on my datasets, can you confirm the effect?

donlk commented 8 years ago

Texture blending is a lot better now! Although the histogram is way off in almost every test case i have.

REFERENCE image: 20160131_161454

NEW tone mapping [only local seam levelling] new_local_seam NEW tone mapping [local and global seam levelling] new_local_global_seam

OLD method [only local seam levelling] old_local_seam OLD method [local and global seam levelling] old_local_global_seam

rhiestan commented 8 years ago

Sorry for the late answer. I see similar results like donlk. The color mapping is improved, but not yet on the same level as before. With some data sets, I see better results, however the kermit dataset has still issues: With only local seam leveling: kermit_newtexrecon2 With global and local seam leveling: kermit_newtexrecon1

Thanks for the update!

nmoehrle commented 8 years ago

@rhiestan could you provide me the kermit dataset (and this particular reconstruction), it looks like a prime example for failure... Especially the red artifact on the right looks terrible and the histogram is looks weird too.

@donlk nice capture target :-) As far as I can tell the issue with the global seam leveling starts at the handle. The geometry is overestimated and therefore parts of the white background are used to texture it (because of the edges high gradient) which results in the leveling of pixels with different colors. I am not sure how to handle this since it is essentially an issue of geometry reconstruction. However, the outlier removal method might help with this since it will discard the views observing white. I thought about down weighting gradients at depth discontinuities to cope with these artifacts, as far as I know this was first used by Callieri et al. [2008].

rhiestan commented 8 years ago

This is the kermit reconstruction, done with Regard3D: triangulation_0.zip

If the current directory is triangulation_0, then my command line looks like this: texrecon.exe --no_intermediate_results out\MVE2_SCENE_DIR::undistorted densification_0\surface_0\model_surface_trim.ply densification_0\surface_0/model_surface_text

If you would like the original pictures, they are here: kermit.zip They are distributed with bundler by Noah Snavely, see here: http://www.cs.cornell.edu/~snavely/bundler/

nmoehrle commented 8 years ago

With 58a23ef I drop the simple tone-mapping in which false assumptions on the data caused textures with low contrast. The color mapping should now be very similar to the original version. I will continue to investigate hdr textures within the tone-mapping branch. Thank you for providing the example and sorry for the inconvenience :-)

rhiestan commented 8 years ago

Thanks for the update, the results are much better. I still have local intensity differences, see attached pictures. But they are much smaller now.

kermit_newtexrecon3 sceaux_newtexrecon

nmoehrle commented 8 years ago

Which outlier removal method are you using?

rhiestan commented 8 years ago

For the kermit model I did not use any outlier removal, for the sceaux castle (see https://github.com/openMVG/ImageDataset_SceauxCastle) I used "Gauss damping". But it did not make a big difference when other settings (none, Gauss clamping) were active. The Sceaux dataset is quite special with a tree partially obstructing the view in two pictures.

xueao commented 8 years ago

Hi Nils When I test texrecon program with color mesh generated by mve, the result seems bad as following : snapshot100 The above result is achieved by setting a linear mapping 0.995th percentile min-max. If I turn down this parameter percentile = hist_qualities.get_approx_percentile(0.455f), the result gets a little better, but not good enough.While the colored mesh look like as follows: snapshot400 So how should I adjust parameters to make it done well. Thank you in advance. Regards, Xueao

nmoehrle commented 8 years ago

It appears to me that there are a lot of occluders within the scene (and the texture). Did you use a outlier removal method (e.g. --outlier_removal=gauss_clamping)?

xueao commented 8 years ago

@nmoehrle It works! Thank you!