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


Python filters.threshold_local方法代碼示例

本文整理匯總了Python中skimage.filters.threshold_local方法的典型用法代碼示例。如果您正苦於以下問題:Python filters.threshold_local方法的具體用法?Python filters.threshold_local怎麽用?Python filters.threshold_local使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在skimage.filters的用法示例。


在下文中一共展示了filters.threshold_local方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _local_thresholding

# 需要導入模塊: from skimage import filters [as 別名]
# 或者: from skimage.filters import threshold_local [as 別名]
def _local_thresholding(im, padding=2, block_size=17, offset=70):
    """Local thresholding

    Parameters
    ----------
    im :
        The camera frame with the eyes
    padding :
        padding of the camera frame (Default value = 2)
    block_size :
        param offset: (Default value = 17)
    offset :
         (Default value = 70)

    Returns
    -------
    type
        thresholded image

    """
    padded = _pad(im, padding, im.min())
    return padded > threshold_local(padded, block_size=block_size, offset=offset) 
開發者ID:portugueslab,項目名稱:stytra,代碼行數:24,代碼來源:eyes.py

示例2: adap

# 需要導入模塊: from skimage import filters [as 別名]
# 或者: from skimage.filters import threshold_local [as 別名]
def adap(data, block_size, offset):
    from skimage.filters import threshold_local
    mask = data
    for iz in range(data.shape[2]):
        adaptive_thresh = threshold_local(data[:, :, iz], block_size, method='gaussian', offset=offset)
        mask[:, :, iz] = mask[:, :, iz] > adaptive_thresh
    return mask 
開發者ID:neuropoly,項目名稱:spinalcordtoolbox,代碼行數:9,代碼來源:sct_maths.py

示例3: get_bin_threshold

# 需要導入模塊: from skimage import filters [as 別名]
# 或者: from skimage.filters import threshold_local [as 別名]
def get_bin_threshold(self, percent, high=True, adaptive=False, binary=True, img=False):
        """
        Threshold the image into binary values
        
        Parameters
        ----------
        percent : float
            The percentage where the thresholding is made
        high : bool
            If high a value of 1 is returned for values > percent
        adaptive : bool
            If True, performs an adaptive thresholding (see skimage.filters.threshold_adaptive)
        binary : bool
            If True return bool data (True/False) otherwise  numeric (0/1)
        img : bool
            If True return a SPM_image otherwise a numpy array
        """
        if adaptive:
            if binary:
                return self.pixels > threshold_local(self.pixels, percent)
            return threshold_local(self.pixels, percent)
        mi = np.min(self.pixels)
        norm = (self.pixels-mi)/(np.max(self.pixels)-mi)
        if high:
            r = norm > percent
        else:
            r = norm < percent
        if not img:
            if binary:
                return r
            return np.ones(self.pixels.shape)*r
        else:
            I = copy.deepcopy(self)
            I.channel = "Threshold from "+I.channel
            if binary:
                I.pixels = r
            else:
                I.pixels = np.ones(self.pixels.shape)*r
            return I 
開發者ID:scholi,項目名稱:pySPM,代碼行數:41,代碼來源:SPM.py

示例4: binarize_images

# 需要導入模塊: from skimage import filters [as 別名]
# 或者: from skimage.filters import threshold_local [as 別名]
def binarize_images(data):
    binarized_data = []
    for image in data:
        image = image.reshape((62, 47))
        image_threshold = threshold_local(image, block_size=15)
        binary_adaptive_image = image > image_threshold
        binarized_data.append(binary_adaptive_image.ravel())
    return asfloat(binarized_data) 
開發者ID:itdxer,項目名稱:neupy,代碼行數:10,代碼來源:rbm_faces_sampling.py


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