當前位置: 首頁>>代碼示例>>Python>>正文


Python morphology.convex_hull_image方法代碼示例

本文整理匯總了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 
開發者ID:uci-cbcl,項目名稱:DeepLung,代碼行數:16,代碼來源:prepare.py

示例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 
開發者ID:yeatmanlab,項目名稱:pyAFQ,代碼行數:29,代碼來源:volume.py

示例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 
開發者ID:317070,項目名稱:kaggle-heart,代碼行數:13,代碼來源:segmentation_labelling.py


注:本文中的skimage.morphology.convex_hull_image方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。