This library is converter to convert atlas texuture (defined in Densepose) to normal texture (defined in SMPL), and vice versa.
$ pip install UVTextureConverter
(or $ pip install uvtextureconverter)
from UVTextureConverter import Normal2Atlas
from PIL import Image
import numpy as np
normal_tex = np.array(Image.open('input/normal.jpg'))
converter = Normal2Atlas(normal_size=512, atlas_size=200)
atlas_tex = converter.convert(normal_tex)
from UVTextureConverter import Atlas2Normal
from PIL import Image
import numpy as np
im = np.array(Image.open('input/atlas.png').convert('RGB')).transpose(1, 0, 2)
atlas_tex_stack = Atlas2Normal.split_atlas_tex(im)
converter = Atlas2Normal(atlas_size=200, normal_size=512)
normal_tex = converter.convert(atlas_tex_stack)
See the following notebooks for details and examples.
- convert_texture_between_normal_and_altas.ipynb: how to convert from atlas texture to normal texture, and vice versa.
- create_uv_texture_from_image_by_using_densepose.ipynb: how to convert a single rgb image to atlas texute by densepose and convert to normal texture.
- create_uv_texture_from_video_by_using_densepose.ipynb: how to convert video to atlas texture.
$ docker-compose build
$ docker-compose run --rm uvtex
$ export UVTEX_PORT=8888
$ docker-compose run --rm -p $UVTEX_PORT:$UVTEX_PORT uvtex jupyter notebook --port $UVTEX_PORT --ip=0.0.0.0 --allow-root
$ docker-compose run --rm uvtex
(in docker)
$ flake8
$ python -m unittest