The scripts expects to find the face texture at the location
DAZ_BASE_DIR/G8M_TEX_DIR/G8M_DIFFUSE_TEXTURE
These variables are defined in the file config.txt in the autoface directory. The default values are
DAZ_BASE_DIR = "C:/Users/Public/Documents/My DAZ 3D Library/"
G8M_TEX_DIR = "/Runtime/Textures/DAZ/Characters/Genesis8/MaleBase/"
G8M_DIFFUSE_TEXTURE = "G8MBaseFaceMapD01_1001.jpg"
If you have installed DAZ Studio with the default settings on Windows 7, these values should work.
The modified face texture is stored in the location
AUTOFACE_DIR/textures/<character name>.png
where AUTOFACE_DIR is defined in in config.txt. The default value is
AUTOFACE_DIR = "~/Documents/Autoface/",
where "~" is a shorthand notation for you home directory. The character name is deduced from the name of the input image.
For a female character, G8M is replaced by G8F everywhere above.
The patch.py script uses OpenCV. If you installed OpenCV following the instructions, it will not be found by Python unless you first activate the OpenCV environment. In the terminal window, type
activate OpenCV-master-py3
You can tell that your are in the OpenCV environment when the command prompt is preceeded by (OpenCV-master-py3).
Patch the texture by issuing the command
python patch.py <input image> <basemesh> [-d <directory>]
The base mesh is either g8m or g8f depending on the character's gender, and the input image must be located in either:
- A directory explicitly specified with the optional -d (or --dir) keyword.
- In the directory AUTOFACE_DIR/inputs/.
- In the example folder, autoface/exprnet/figures/ included with the add-on.
python patch.py donald_trump.jpg g8m
python patch.py hillary_clinton.jpg g8f
When the script has completed, a smaller version of the patched texture is shown in a new window.
Clearly the textures are not perfect, in particular in the mouth region. Some manual retouch is needed for optimal results.
The Dlib library is not available in the OpenCV environment, so it must be deactivated if you want to run the landmarks script again. This is done with the deactivate command.
deactivate
python landmarks.py donald_trump.jpg g8m