From c103288610c26393c90670afd99439658100f5f1 Mon Sep 17 00:00:00 2001 From: geekyutao Date: Wed, 19 Apr 2023 13:11:40 +0800 Subject: [PATCH] add a function that can get click coordinates --- utils/get_ponit_coor.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 utils/get_ponit_coor.py diff --git a/utils/get_ponit_coor.py b/utils/get_ponit_coor.py new file mode 100644 index 0000000..1f3c3f2 --- /dev/null +++ b/utils/get_ponit_coor.py @@ -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()