-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
35 lines (25 loc) · 915 Bytes
/
example.py
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
30
31
32
33
34
35
import os
import sys
import cv2
import argparse
from googly_eyes.backend.lib.GooglyEyes import GooglifyEyes
from googly_eyes.backend.lib.utils import io_utils
def parse_args():
parser = argparse.ArgumentParser(description="Googlify Eyes")
parser.add_argument("image_path", type=str, nargs="?", default="assets/misc/multi_face.png",
help="Path to the input image file")
return parser.parse_args()
def main():
args = parse_args()
if not os.path.isfile(args.image_path):
print(f"Error: The file '{args.image_path}' does not exist.")
sys.exit(1)
params = io_utils.load_config()
googlify_eyes = GooglifyEyes(params)
img = cv2.imread(args.image_path, cv2.IMREAD_COLOR)
out = googlify_eyes.generate(img)
cv2.imshow("Googlify Eyes", out)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == "__main__":
sys.exit(main())