/UVTextureConverter

To convert atlas texuture (defined in Densepose) to normal texture (defined in SMPL), and vice versa.

Primary LanguageJupyter NotebookMIT LicenseMIT

UVTextureConverter

This library is converter to convert atlas texuture (defined in Densepose) to normal texture (defined in SMPL), and vice versa.

License: MIT PyPI version Python Versions Downloads Test@master

1. Install

$ pip install UVTextureConverter
(or $ pip install uvtextureconverter)

2. How To Use

2.1. Quick Use

nomal texture -> atlas texture

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)

atlas texture -> normal texture

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)

2.2. Notebooks (for details and examples)

See the following notebooks for details and examples.

3. developers install

3.1. docker build & run

$ docker-compose build
$ docker-compose run --rm uvtex

3.2. notebook usage

$ 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

3.3. flake8 & test

$ docker-compose run --rm uvtex
(in docker)
$ flake8
$ python -m unittest