Skip to content

Commit

Permalink
Fix PNCC
Browse files Browse the repository at this point in the history
  • Loading branch information
cleardusk committed Dec 27, 2018
1 parent c320de1 commit d4f758e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
Binary file modified samples/demo_pncc_paf.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added train.configs/pncc_code.npy
Binary file not shown.
3 changes: 3 additions & 0 deletions utils/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ def make_abs_path(d):
u_filter = paf.get('mu_filter')
w_filter = paf.get('w_filter')
w_exp_filter = paf.get('w_exp_filter')

# pncc code (mean shape)
pncc_code = _load(osp.join(d, 'pncc_code.npy'))
16 changes: 16 additions & 0 deletions utils/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import numpy as np
from .cython import mesh_core_cython
from .params import pncc_code


def is_point_in_tri(point, tri_points):
Expand Down Expand Up @@ -189,6 +190,21 @@ def ncc(vertices):


def cpncc(img, vertices_lst, tri):
"""cython version for PNCC render: original paper"""
h, w = img.shape[:2]
c = 3

pnccs_img = np.zeros((h, w, c))
for i in range(len(vertices_lst)):
vertices = vertices_lst[i]
pncc_img = crender_colors(vertices, tri, pncc_code, h, w, c)
pnccs_img[pncc_img > 0] = pncc_img[pncc_img > 0]

pnccs_img = pnccs_img.squeeze() * 255
return pnccs_img


def cpncc_v2(img, vertices_lst, tri):
"""cython version for PNCC render"""
h, w = img.shape[:2]
c = 3
Expand Down

0 comments on commit d4f758e

Please sign in to comment.