【发布时间】:2019-02-18 18:17:48
【问题描述】:
我想在较大图像内的多边形的像素坐标上应用高斯模糊,然后在相同坐标上对模糊的多边形做一些事情。 skimage 中的 draw polygon 函数直接为我提供了图像的坐标,而不是蒙版。理想情况下,我想在面具本身上应用过滤器,但 draw polygon 函数没有让我得到面具。
img = np.zeros((10, 10), dtype=np.uint8)
r = np.array([1, 2, 8, 1])
c = np.array([1, 7, 4, 1])
rr, cc = polygon(r, c)
# Apply Gaussian blur here on the locations specified by the polygon
img[rr, cc] = 1 # or do something else on the blurred positions.
我显然不能先在图像上运行高斯模糊,因为如果我在 rr, cc 上运行高斯模糊,我会得到十进制值,并且无法通过索引访问相同的多边形。我该如何解决这个问题?
【问题讨论】:
标签: python gaussian scikit-image