first commit
This commit is contained in:
32
Vision/find_img_point.py
Normal file
32
Vision/find_img_point.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
# @Time : 2024/12/2 15:55
|
||||
# @Author : hjw
|
||||
# @File : find_img_point.py
|
||||
'''
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
img = cv2.imread('./model/data/2024_12_16_18_32_40.png')
|
||||
# img2 = img[:600, 380:]
|
||||
img = cv2.resize(img,(640,480))
|
||||
# cv2.imshow('img3',img3)
|
||||
# cv2.imshow('img2',img2)
|
||||
# cv2.imshow('img',img)
|
||||
# cv2.waitKey(0)
|
||||
|
||||
def on_EVENT_LBUTTONDOWN(event, x, y, flags, param):
|
||||
if event == cv2.EVENT_LBUTTONDOWN:
|
||||
xy = "%d,%d" % (x, y)
|
||||
cv2.circle(img, (x, y), 1, (0, 0, 255), thickness = -1)
|
||||
cv2.putText(img, xy, (x, y), cv2.FONT_HERSHEY_PLAIN,
|
||||
1.0, (0,0,255), thickness = 1)
|
||||
cv2.imshow("image", img)
|
||||
cv2.namedWindow("image")
|
||||
cv2.setMouseCallback("image", on_EVENT_LBUTTONDOWN)
|
||||
while(1):
|
||||
cv2.imshow("image", img)
|
||||
if cv2.waitKey(0)&0xFF==27:
|
||||
break
|
||||
cv2.destroyAllWindows()
|
||||
Reference in New Issue
Block a user