animate1978 / MB-Lab

MB-Lab is a character creation tool for Blender 4.0 and above, based off ManuelBastioniLAB
Other
1.83k stars 315 forks source link

Histogram-Preserving Blending for Measurements #227

Open torridgristle opened 4 years ago

torridgristle commented 4 years ago

Came across a paper on preserving an initial image's histogram when blending images, and I reckon this could be used to preserve some level of variance when mixing together different sets of measurements and presets and perhaps JSONs of measurements.

http://www.jcgt.org/published/0008/04/02/paper.pdf

The gist of it is both sets of data are transformed such that their histograms have a gaussian distribution, they're linearly blended, the contrast is boosted back up since the resulting histogram is just a less-wide gaussian distribution, and then the transform what set the first set of data to a gaussian distribution is inversed, restoring the original histogram.

The code for all of this is included in the paper.

It'd be neat if this was actually possible for blending images in materials in Blender but there's no access to the histograms as far as I know so the transforms would need to be created outside of the material itself.