-
-
Save amarlearning/9c554ebb244c11653b44c9c4e5c1f2dc 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 manage_image_opr(frame, hand_hist): | |
hist_mask_image = hist_masking(frame, hand_hist) | |
contour_list = contours(hist_mask_image) | |
max_cont = max_contour(contour_list) | |
cnt_centroid = centroid(max_cont) | |
cv2.circle(frame, cnt_centroid, 5, [255, 0, 255], -1) | |
if max_cont is not None: | |
hull = cv2.convexHull(max_cont, returnPoints=False) | |
defects = cv2.convexityDefects(max_cont, hull) | |
far_point = farthest_point(defects, max_cont, cnt_centroid) | |
print("Centroid : " + str(cnt_centroid) + ", farthest Point : " + str(far_point)) | |
cv2.circle(frame, far_point, 5, [0, 0, 255], -1) | |
if len(traverse_point) < 20: | |
traverse_point.append(far_point) | |
else: | |
traverse_point.pop(0) | |
traverse_point.append(far_point) | |
draw_circles(frame, traverse_point) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment