1
我希望在显示图像时通过右键单击鼠标来收集像素位置(第i行,第列)。使用鼠标单击/事件获取像素位置
这大约是从互联网上下载的图片一个简单的例子:
import urllib
import cv2
from win32api import GetSystemMetrics
path_image = urllib.urlretrieve("http://www.bellazon.com/main/uploads/monthly_06_2013/post-37737-0-06086500-1371727837.jpg", "local-filename.jpg")[0]
img = cv2.imread(path_image,0)
width = GetSystemMetrics(0)
height = GetSystemMetrics(1)
scale_width = width/img.shape[1]
scale_height = height/img.shape[0]
scale = min(scale_width, scale_height)
window_width = int(img.shape[1] * scale)
window_height = int(img.shape[0] * scale)
cv2.namedWindow('image', cv2.WINDOW_NORMAL)
cv2.resizeWindow('image', window_width, window_height)
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
在这一点上,我希望了解收集和储存在list
像素位置的最佳途径。