import cv2
import os
def on_EVENT_LBUTTONDOWN(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
xy = "%d,%d" % (x, y)
info = '{}, {}, {}'.format(path, x, y)
with open('./data/loc.txt', 'a') as f:
f.write(info + "\n")
cv2.circle(img, (x, y), 1, (255, 0, 0), thickness=-1)
cv2.putText(img, xy, (x, y), cv2.FONT_HERSHEY_PLAIN,
1.0, (0, 0, 0), thickness=1)
cv2.imshow("image", img)
data_path = ‘./data/hand_pose_test’
signal = os.listdir(data_path)
for fsingal in signal:
filepath = data_path + ‘/’ + fsingal
filename = os.listdir(filepath)
for fname in filename:
ffpath = filepath + “/” + fname
path = ffpath
print(path)
im_gray = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
im_gray = im_gray * 16
im_color = cv2.applyColorMap(im_gray, cv2.COLORMAP_JET)
img = im_color
cv2.namedWindow("image", 0)
cv2.resizeWindow('image', 1024, 848)
loc = cv2.setMouseCallback("image", on_EVENT_LBUTTONDOWN)
cv2.imshow("image", img)
cv2.waitKey(0)