Skip to content

Commit

Permalink
add a function that can get click coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
geekyutao committed Apr 19, 2023
1 parent 1a64472 commit c103288
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utils/get_ponit_coor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import cv2

def click_event(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
print("Point coordinates ({}, {})".format(x, y))
img = cv2.imread("./example/remove-anything/dog.jpg")

cv2.imshow("Image", img)
cv2.setMouseCallback("Image", click_event)
cv2.waitKey(0)

cv2.destroyAllWindows()

0 comments on commit c103288

Please sign in to comment.