-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update new split of AFLW2000-3D && Update rendering demo
- Loading branch information
Showing
5 changed files
with
58 additions
and
6 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 |
---|---|---|
|
@@ -27,3 +27,5 @@ utils/cython/build | |
utils/cython/*.so | ||
utils/cython/mesh_core_cython.cpp | ||
PAF/ | ||
|
||
samples/*.obj |
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
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
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,39 @@ | ||
#!/usr/bin/env python3 | ||
# coding: utf-8 | ||
|
||
""" | ||
A demo for rendering mesh generated by `main.py` | ||
""" | ||
|
||
from rendering import cfg, _to_ctype, RenderPipeline | ||
import scipy.io as sio | ||
import imageio | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
|
||
def test(): | ||
# 1. first, using main.py to generate dense vertices, like emma_input_0.mat | ||
fp = '../samples/emma_input_0.mat' | ||
vertices = sio.loadmat(fp)['vertex'].T # 3xm | ||
print(vertices.shape) | ||
img = imageio.imread('../samples/emma_input.jpg').astype(np.float32) / 255. | ||
|
||
# 2. render it | ||
# triangles = sio.loadmat('tri_refine.mat')['tri'] # mx3 | ||
triangles = sio.loadmat('../visualize/tri.mat')['tri'].T - 1 # mx3 | ||
print(triangles.shape) | ||
triangles = _to_ctype(triangles).astype(np.int32) # for type compatible | ||
app = RenderPipeline(**cfg) | ||
img_render = app(vertices, triangles, img) | ||
|
||
plt.imshow(img_render) | ||
plt.show() | ||
|
||
|
||
def main(): | ||
test() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Binary file not shown.