-
-
Save amarlearning/839998daf078d459cd238c78f9a814cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def draw_rect(frame): | |
rows, cols, _ = frame.shape | |
global total_rectangle, hand_rect_one_x, hand_rect_one_y, hand_rect_two_x, hand_rect_two_y | |
hand_rect_one_x = np.array( | |
[6 * rows / 20, 6 * rows / 20, 6 * rows / 20, 9 * rows / 20, 9 * rows / 20, 9 * rows / 20, 12 * rows / 20, | |
12 * rows / 20, 12 * rows / 20], dtype=np.uint32) | |
hand_rect_one_y = np.array( | |
[9 * cols / 20, 10 * cols / 20, 11 * cols / 20, 9 * cols / 20, 10 * cols / 20, 11 * cols / 20, 9 * cols / 20, | |
10 * cols / 20, 11 * cols / 20], dtype=np.uint32) | |
hand_rect_two_x = hand_rect_one_x + 10 | |
hand_rect_two_y = hand_rect_one_y + 10 | |
for i in range(total_rectangle): | |
cv2.rectangle(frame, (hand_rect_one_y[i], hand_rect_one_x[i]), | |
(hand_rect_two_y[i], hand_rect_two_x[i]), | |
(0, 255, 0), 1) | |
return frame |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment