我正在尝试以下方法从该图像中获取蒙版,但不幸的是我失败了。
import numpy as np
import skimage.color
import skimage.filters
import skimage.io
# get filename, sigma, and threshold value from command line
filename = 'pathToImage'
# read and display the original image
image = skimage.io.imread(fname=filename)
skimage.io.imshow(image)
# blur and grayscale before thresholding
blur = skimage.color.rgb2gray(image)
blur = skimage.filters.gaussian(blur, sigma=2)
# perform inverse binary thresholding
mask = blur < 0.8
# use the mask to select the "interesting" part of the image
sel = np.ones_like(image)
sel[mask] = image[mask]
# display the result
skimage.io.imshow(sel)
我怎样才能获得面具?
Is there a general approach that would work for this image as well. without custom fine-tuning and changing parameters?
- 应用高对比度(最大可能值)
- 使用高阈值转换为黑白图像(我使用了250)
- 最小过滤器(值=8)
- 最大过滤器(值=8)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)