Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flip input frame instead of preview image #333

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Shift-Z | Reset camera zoom and translation
Z/C | Adjust avatar target overlay opacity.
X | Reset reference frame.
F | Toggle reference frame search mode.
R | Mirror reference window.
R | Mirror camera input.
T | Mirror output window.
L | Reload avatars.
I | Show FPS
Expand Down
11 changes: 6 additions & 5 deletions afy/cam_fomm.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def select_camera(config):
frame_offset_y = 0

overlay_alpha = 0.0
preview_flip = False
input_flip = False
output_flip = False
find_keyframe = False
is_calibrated = False
Expand Down Expand Up @@ -291,6 +291,10 @@ def select_camera(config):
break

frame = frame[..., ::-1]

if input_flip:
frame = cv2.flip(frame, 1)

frame_orig = frame.copy()

frame, (frame_offset_x, frame_offset_y) = crop(frame, p=frame_proportion, offset_x=frame_offset_x, offset_y=frame_offset_y)
Expand Down Expand Up @@ -379,7 +383,7 @@ def select_camera(config):
elif key == ord('c'):
overlay_alpha = min(overlay_alpha + 0.1, 1.0)
elif key == ord('r'):
preview_flip = not preview_flip
input_flip = not input_flip
elif key == ord('t'):
output_flip = not output_flip
elif key == ord('f'):
Expand Down Expand Up @@ -425,9 +429,6 @@ def select_camera(config):
draw_face_landmarks(preview_frame, avatar_kp, (200, 20, 10))
frame_kp = predictor.get_frame_kp(frame)
draw_face_landmarks(preview_frame, frame_kp)

if preview_flip:
preview_frame = cv2.flip(preview_frame, 1)

if green_overlay:
green_alpha = 0.8
Expand Down