Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial ma
sudo apt update
sudo apt install --install-recommends winehq-stable
```
- Tested on Ubuntu 22.04 (Linux Mint 21.x) & Using a virtual display in a headless server environment.
```
sudo dpkg --add-architecture i386
wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ jammy main'
sudo apt update

sudo apt install --install-recommends winehq-stable
nohup xvfb-run winecfg > winecfg.log 2>&1 &
```

## Pre-trained Models

Expand Down
23 changes: 12 additions & 11 deletions facewarp/gen_puppet_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def draw_curve(shape, idx_list, loop=False, x_offset=0.0, c=None):
if (show_now):
plt.show()

vis_landmark_on_plt(std_face_id, show_now=show)
# vis_landmark_on_plt(std_face_id, show_now=show)



Expand Down Expand Up @@ -162,11 +162,12 @@ def draw_voronoi(img, subdiv):
def delauney_tri(ROOT_DIR, test_data, INNER_ONLY=False):
# Define window names
win_delaunay = "Delaunay Triangulation"
cv2.namedWindow(win_delaunay, cv2.WINDOW_NORMAL)
# cv2.namedWindow(win_delaunay, cv2.WINDOW_NORMAL)
win_voronoi = "Voronoi Diagram"

# Turn on animation while drawing triangles
animate = True
# animate = True
animate = False

# Define colors for drawing.
delaunay_color = (255, 255, 255)
Expand Down Expand Up @@ -234,8 +235,8 @@ def delauney_tri(ROOT_DIR, test_data, INNER_ONLY=False):
cv2.imshow(win_delaunay, img_copy)
cv2.waitKey(100)

# Draw delaunay triangles
draw_delaunay(img, subdiv, (255, 255, 0))
# # Draw delaunay triangles
# draw_delaunay(img, subdiv, (255, 255, 0))
triangleList = subdiv.getTriangleList()

p_dict = {} # Initialize empty dictionary.
Expand All @@ -249,13 +250,13 @@ def delauney_tri(ROOT_DIR, test_data, INNER_ONLY=False):
# Allocate space for voronoi Diagram
img_voronoi = np.zeros(img.shape, dtype=img.dtype)

# Draw voronoi diagram
draw_voronoi(img_voronoi, subdiv)
# # Draw voronoi diagram
# draw_voronoi(img_voronoi, subdiv)

# Show results
cv2.imshow(win_delaunay, img)
print("Press any key to quit...")
cv2.waitKey(0)
# # Show results
# cv2.imshow(win_delaunay, img)
# print("Press any key to quit...")
# cv2.waitKey(0)

new_tri = [];

Expand Down
2 changes: 1 addition & 1 deletion main_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

''' STEP 1: preprocess input single image '''
img =cv2.imread('examples/' + opt_parser.jpg)
predictor = face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, device='cuda', flip_input=True)
predictor = face_alignment.FaceAlignment(face_alignment.LandmarksType.Three_D, device='cuda', flip_input=True)
shapes = predictor.get_landmarks(img)
if (not shapes or len(shapes) != 1):
print('Cannot detect face landmarks. Exit.')
Expand Down
2 changes: 1 addition & 1 deletion main_end2end_cartoon.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
'-novsync -dump'))
else:
''' linux '''
os.system('wine {} {} {} {} {} {}'.format(
os.system('xvfb-run -a wine {} {} {} {} {} {}'.format(
warp_exe,
os.path.join(cur_dir, '..', '..', opt_parser.jpg),
os.path.join(cur_dir, '..', 'triangulation.txt'),
Expand Down
19 changes: 10 additions & 9 deletions main_gen_new_puppet.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ def update_img(node, button_up=False):

draw_landmarks(img, pts)

cv2.namedWindow("img", cv2.WINDOW_NORMAL)
cv2.setMouseCallback("img", click_adjust_wireframe)
# cv2.namedWindow("img", cv2.WINDOW_NORMAL)
# cv2.setMouseCallback("img", click_adjust_wireframe)

while(True):
cv2.imshow('img', img)
key = cv2.waitKey(1)
if key == ord("q"):
break
cv2.destroyAllWindows()
# while(True):
# cv2.imshow('img', img)
# key = cv2.waitKey(1)
# if key == ord("q"):
# break
# cv2.destroyAllWindows()

print('vis and refine landmark Done!')
pts = np.concatenate([pts, np.ones((68, 1))], axis=1)
Expand All @@ -180,7 +180,8 @@ def update_img(node, button_up=False):
================================================================= '''


norm_anno(data_dir, CH, param=[0.7, 0.4, 0.5, 0.5], show=True)
# norm_anno(data_dir, CH, param=[0.7, 0.4, 0.5, 0.5], show=True)
norm_anno(data_dir, CH, param=[0.7, 0.4, 0.5, 0.5], show=False)


''' =================================================================
Expand Down