当前位置: 首页>>代码示例>>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;未经允许,请勿转载。