本文整理汇总了Python中skimage.morphology.convex_hull_image方法的典型用法代码示例。如果您正苦于以下问题:Python morphology.convex_hull_image方法的具体用法?Python morphology.convex_hull_image怎么用?Python morphology.convex_hull_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skimage.morphology
的用法示例。
在下文中一共展示了morphology.convex_hull_image方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getTerminationBifurcation
# 需要导入模块: from skimage import morphology [as 别名]
# 或者: from skimage.morphology import convex_hull_image [as 别名]
def getTerminationBifurcation(img, mask):
img = img == 255;
(rows, cols) = img.shape;
minutiaeTerm = np.zeros(img.shape);
minutiaeBif = np.zeros(img.shape);
for i in range(1,rows-1):
for j in range(1,cols-1):
if(img[i][j] == 1):
block = img[i-1:i+2,j-1:j+2];
block_val = np.sum(block);
if(block_val == 2):
minutiaeTerm[i,j] = 1;
elif(block_val == 4):
minutiaeBif[i,j] = 1;
mask = convex_hull_image(mask>0)
mask = erosion(mask, square(5)) # Structuing element for mask erosion = square(5)
minutiaeTerm = np.uint8(mask)*minutiaeTerm
return(minutiaeTerm, minutiaeBif)
开发者ID:Utkarsh-Deshmukh,项目名称:Fingerprint-Feature-Extraction,代码行数:22,代码来源:getTerminationBifurcation.py
示例2: process_mask
# 需要导入模块: from skimage import morphology [as 别名]
# 或者: from skimage.morphology import convex_hull_image [as 别名]
def process_mask(mask):
convex_mask = np.copy(mask)
for i_layer in range(convex_mask.shape[0]):
mask1 = np.ascontiguousarray(mask[i_layer])
if np.sum(mask1)>0:
mask2 = convex_hull_image(mask1)
if np.sum(mask2)>1.5*np.sum(mask1):
mask2 = mask1
else:
mask2 = mask1
convex_mask[i_layer] = mask2
struct = generate_binary_structure(3,1)
dilatedMask = binary_dilation(convex_mask,structure=struct,iterations=10)
return dilatedMask
示例3: patch_up_roi
# 需要导入模块: from skimage import morphology [as 别名]
# 或者: from skimage.morphology import convex_hull_image [as 别名]
def patch_up_roi(roi):
"""
After being non-linearly transformed, ROIs tend to have holes in them.
We perform a couple of computational geometry operations on the ROI to
fix that up.
Parameters
----------
roi : 3D binary array
The ROI after it has been transformed.
sigma : float
The sigma for initial Gaussian smoothing.
truncate : float
The truncation for the Gaussian
Returns
-------
ROI after dilation and hole-filling
"""
hole_filled = ndim.binary_fill_holes(roi > 0)
try:
return convex_hull_image(hole_filled)
except QhullError:
return hole_filled
示例4: wrapper_regions
# 需要导入模块: from skimage import morphology [as 别名]
# 或者: from skimage.morphology import convex_hull_image [as 别名]
def wrapper_regions(bestregions, opening_param = 3, mshape = ((0,1,0),(1,1,1),(0,1,0)) ):
zdim, xdim, ydim = bestregions.shape
wregions = np.zeros_like(bestregions)
for sidx in range(zdim):
if np.sum(bestregions[sidx]) > 0:
wregions[sidx] = convex_hull_image(bestregions[sidx])
return wregions