Edited Interface
Browse files
app.py
CHANGED
|
@@ -26,7 +26,7 @@ def hex2rgb(hex):
|
|
| 26 |
if is_hex(hex):
|
| 27 |
return ImageColor.getcolor(hex, "RGB")
|
| 28 |
else:
|
| 29 |
-
return (
|
| 30 |
|
| 31 |
|
| 32 |
def find_hands(brain, img):
|
|
@@ -80,7 +80,7 @@ def clear(landmarks): # brute force finger orientation checking
|
|
| 80 |
return False
|
| 81 |
|
| 82 |
|
| 83 |
-
def show(video, dominant_hand,
|
| 84 |
cam = cv2.VideoCapture(video) # get the video file from path
|
| 85 |
width = cam.get(cv2.CAP_PROP_FRAME_WIDTH)
|
| 86 |
height = cam.get(cv2.CAP_PROP_FRAME_HEIGHT)
|
|
@@ -90,6 +90,7 @@ def show(video, dominant_hand, color): # main
|
|
| 90 |
paper = np.zeros((int(height), int(width), 3), dtype=np.uint8) # create blank page
|
| 91 |
paper.fill(255)
|
| 92 |
|
|
|
|
| 93 |
past_holder = () # hold previous index coordinates
|
| 94 |
palette = cv2.imread('palette_small.jpg')
|
| 95 |
|
|
@@ -206,7 +207,7 @@ iface = gr.Interface(
|
|
| 206 |
inputs=[
|
| 207 |
gr.inputs.Video(source="webcam", label="Record from Webcam"),
|
| 208 |
gr.inputs.Radio(['Right', 'Left'], label="Dominant Hand"),
|
| 209 |
-
gr.inputs.Textbox(placeholder="#355C7D", label="Hex
|
| 210 |
],
|
| 211 |
outputs='video',
|
| 212 |
title=title,
|
|
|
|
| 26 |
if is_hex(hex):
|
| 27 |
return ImageColor.getcolor(hex, "RGB")
|
| 28 |
else:
|
| 29 |
+
return (0, 0, 0)
|
| 30 |
|
| 31 |
|
| 32 |
def find_hands(brain, img):
|
|
|
|
| 80 |
return False
|
| 81 |
|
| 82 |
|
| 83 |
+
def show(video, dominant_hand, hex_color): # main
|
| 84 |
cam = cv2.VideoCapture(video) # get the video file from path
|
| 85 |
width = cam.get(cv2.CAP_PROP_FRAME_WIDTH)
|
| 86 |
height = cam.get(cv2.CAP_PROP_FRAME_HEIGHT)
|
|
|
|
| 90 |
paper = np.zeros((int(height), int(width), 3), dtype=np.uint8) # create blank page
|
| 91 |
paper.fill(255)
|
| 92 |
|
| 93 |
+
color = hex2rgb(hex_color)
|
| 94 |
past_holder = () # hold previous index coordinates
|
| 95 |
palette = cv2.imread('palette_small.jpg')
|
| 96 |
|
|
|
|
| 207 |
inputs=[
|
| 208 |
gr.inputs.Video(source="webcam", label="Record from Webcam"),
|
| 209 |
gr.inputs.Radio(['Right', 'Left'], label="Dominant Hand"),
|
| 210 |
+
gr.inputs.Textbox(placeholder="#355C7D", label="Hex Color")
|
| 211 |
],
|
| 212 |
outputs='video',
|
| 213 |
title=title,
|