-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
8,371 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# coding: utf-8 | ||
|
||
from . import _init_paths | ||
import numpy as np | ||
import Sim3DR_Cython | ||
|
||
|
||
def get_normal(vertices, triangles): | ||
normal = np.zeros_like(vertices, dtype=np.float32) | ||
Sim3DR_Cython.get_normal(normal, vertices, triangles, vertices.shape[0], triangles.shape[0]) | ||
return normal | ||
|
||
|
||
def rasterize(vertices, triangles, colors, bg=None, | ||
height=None, width=None, channel=None, | ||
reverse=False): | ||
if bg is not None: | ||
height, width, channel = bg.shape | ||
else: | ||
assert height is not None and width is not None and channel is not None | ||
bg = np.zeros((height, width, channel), dtype=np.uint8) | ||
|
||
buffer = np.zeros((height, width), dtype=np.float32) - 1e8 | ||
|
||
if colors.dtype != np.float32: | ||
colors = colors.astype(np.float32) | ||
Sim3DR_Cython.rasterize(bg, vertices, triangles, colors, buffer, triangles.shape[0], height, width, channel, | ||
reverse=reverse) | ||
return bg |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# coding: utf-8 | ||
|
||
from .Sim3DR import get_normal, rasterize | ||
from .lighting import RenderPipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# coding: utf-8 | ||
|
||
import os.path as osp | ||
import sys | ||
|
||
|
||
def add_path(path): | ||
if path not in sys.path: | ||
sys.path.insert(0, path) | ||
|
||
|
||
this_dir = osp.dirname(__file__) | ||
lib_path = osp.join(this_dir, '.') | ||
add_path(lib_path) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python3 setup.py build_ext --inplace |
Oops, something went wrong.