Skip to content
Open
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
13 changes: 10 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,26 @@

# Initialize webcam
#1

cap=cv2.VideoCapture(0)
if not cap.isOpened():
raise IOError("Cannot open webcam")
# Initialize hand tracking
#2

mp_hands = mp.solutions.hands
hands = mp_hands.Hands()
# Initialize paddle and puck positions
#3

PADDLE_WIDTH, PADDLE_HEIGHT = 100, 20
PUCK_SIZE = 20
# Initial velocity
initial_puck_velocity = [10, 10]
puck_velocity = initial_puck_velocity.copy()

# Load target image and resize it to 30,30
#4
TARGET_IMAGE = cv2.imread("target.png")
TARGET_HEIGHT, TARGET_WIDTH = TARGET_IMAGE.shape[:2]
TARGET_RADIUS = 30

# Initialize 5 target positions randomly(remember assignment 2!!)
#5
Expand Down