我想从一张图片中提取绿色矢量。图像有红色和绿色点并制作网格
def each_green_vector(im):
pixels = im.load_image(im)
utils.apply_to_each_pixel(pixels, lambda x: 0.0 if x >10 else 1.0)
msize = m_mesh.rows*m_mesh.cols;
(x, y) = imsize
vec = []
for i in range(1,x -1):
for j in range (1, y -1):
grid = grid_at(pixels, i, j)
if grid != "none":
if grid ==1:
vec.append((i,j));
gx = list[i].x / m_mesh.gWidth;
gy = list[i].y / m_mesh.gHeight;
grid = gx + gy *m_mesh.cols;
vec[grid] == 1;
return vec