File size: 677 Bytes
f31c85a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy as np
import cv2

def display_keypoints(keypoints, ganImage = False, imageID = 0):

    if ganImage:
        image = cv2.imread(f"captures/new_image_{imageID}.png")
    else:
        image = cv2.imread(f"captures/image_{imageID}.png")  
    
    if isinstance(keypoints, str):
        cv2.imwrite(f'static/keypoint_image_{imageID}.jpg', image)
        return

    print(keypoints)
    # Iterate over each keypoint and draw a circle on the image
    for kp in keypoints:
        x, y, c = kp
        if c>0.07:
            cv2.circle(image, (int(x), int(y)), 5, (0, 255, 0), -1)  # Draw a green circle

    cv2.imwrite(f'static/keypoint_image_{imageID}.jpg', image)