我的工作是
imagemagick
(收集黑色像素的坐标)将图像转换为(x,y)坐标SciPy
脚本加载数据。我想知道是否有一个函数可以在同一个SciPy
脚本中执行任何步骤1-4。
由于SciPy
具有一系列用于图像识别的功能,我想知道是否存在将图像转换为创建曲线的黑色像素的(x,y)坐标的功能,因此上。
答案 0 :(得分:1)
首先,使用sp.misc.imread
或PIL加载图像,使其位于我将在下面称为if
的numpy数组中。 (如果是彩色图像,请使用boolean
将其转换为灰度。然后:
checkbutton
img
img = np.mean(img, axis=-1)
img = img[:-k, :] # Erase axes manually, k is the height of the axis in pixels
假定进口:
y, x = np.where(img == 0) # Find x and y coordinates of all black pixels