File size: 771 Bytes
5ac1897
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Pytorch3D Renderer

> The code was modified from GVHMR: https://github.com/zju3dv/GVHMR/tree/main/hmr4d/utils/vis

### Dependency

```shell
pip install "git+https://github.com/facebookresearch/[email protected]"
```

### Example

```python
from lib.utils.vis import Renderer
import imageio

fps = 30
focal_length = data["cam_int"][0][0, 0]
width, height = img_hw
faces = smplh[data["gender"]].bm.faces
renderer = Renderer(width, height, focal_length, "cuda", faces)
writer = imageio.get_writer("tmp_debug.mp4", fps=fps, mode="I", format="FFMPEG", macro_block_size=1)

for i in tqdm(range(length)):
    img = np.zeros((height, width, 3), dtype=np.uint8)
    img = renderer.render_mesh(smplh_out.vertices[i].cuda(), img)
    writer.append_data(img)
writer.close()
```