An implementation of inflation from silhouettes in python. Generate a height/depth map and a mesh from a single silhouette. No machine learning is included.
python inflation.py
generates sample outputs.
OpenCV, numpy and scipy are required as dependencies.
- Input
- A single silhouette (mask) image
- Output
- a depth/height map (colorized) and a mesh in .ply format (its shaded rendering is shown in the table below)
Input silhouettes | |||||
---|---|---|---|---|---|
Distance Transform | |||||
Distance Transform + Activation (tanh) | |||||
Baran's method |
Based on distance transform that computes distance from silhouette edges to pixels in the silhouette. This method tends to cause steepy surfaces. Additioanlly, you can set activation function to operate steepness but it is difficult to control.
Based on Poisson's equation. Implementation of the following paper: "Notes on Inflating Curves" Baran and Lehtinen 2009. This method generates smooth surfaces considering gradient space. Especially, a circle silhouette becomes a hemisphere mesh.