This commit is contained in:
Andrzej Preibisz 2023-01-30 16:08:54 +01:00
parent d64dcf5c1d
commit ba72218df5

View File

@ -1,6 +1,8 @@
import cv2
import tensorflow as tf
import numpy as np
from crop_hands_skeleton import crop_hands
from cvzone.HandTrackingModule import HandDetector
class_names = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'del', 'nothing', 'space']
@ -29,9 +31,10 @@ def segment_video(video, fps=5):
return result, num
def save_frames(frames, dir):
detector = HandDetector(maxHands=1, mode=True, detectionCon=0.7, minTrackCon=0.8)
for i, frame in enumerate(frames):
print(i)
cv2.imwrite(f"{dir}/frame{i}.jpg", frame)
cv2.imwrite(f"{dir}/frame{i}.jpg", crop_hands(frame, detector))
def classify(img, model):