この画像の輪郭の塗りつぶされたバイナリ マスクを取得しようとしています。
この質問を見てみましたSciPy Create 2D Polygon Mask ; ただし、私のデータセットが気に入らないようです。
import numpy as np
from matplotlib.nxutils import points_inside_poly
nx, ny = 10, 10
poly_verts = [(1,1), (5,1), (5,9),(3,2),(1,1)]
# Create vertex coordinates for each grid cell...
# (<0,0> is at the top left of the grid in this system)
x, y = np.meshgrid(np.arange(nx), np.arange(ny))
x, y = x.flatten(), y.flatten()
points = np.vstack((x,y)).T
grid = points_inside_poly(points, poly_verts)
grid = grid.reshape((ny,nx))
print grid
ポイント_インサイド_ポリの制限を説明するために、バイナリマスクまたは誰かを返すことを試みることができる別の方法があるのだろうか
こんな仕上がりになりそうだから