当前位置: 首页>>代码示例>>Python>>正文


Python filters.gaussian_filter方法代码示例

本文整理汇总了Python中skimage.filters.gaussian_filter方法的典型用法代码示例。如果您正苦于以下问题:Python filters.gaussian_filter方法的具体用法?Python filters.gaussian_filter怎么用?Python filters.gaussian_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在skimage.filters的用法示例。


在下文中一共展示了filters.gaussian_filter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: unsharp

# 需要导入模块: from skimage import filters [as 别名]
# 或者: from skimage.filters import gaussian_filter [as 别名]
def unsharp(img):
        ''' unsharp(img)
        
        apply unsharp mask to the image
        img: original image array
        Return: image after unsharp masking, array like'''
        def unsharp2d(img):
                if len(img.shape) == 2:
                        blur = gaussian_filter(img, 50) 
                        blur = -0.1*blur
                        return blur + img
                else:
                        raise Exception('The image size is not recognized.')
        if len(img.shape) == 3 and img.shape[2] == 3:
                img[:, :, 0] = unsharp2d(img[:, :, 0])
                img[:, :, 1] = unsharp2d(img[:, :, 1])
                img[:, :, 2] = unsharp2d(img[:, :, 2])
        elif len(img.shape) == 2:
                img = unsharp2d(img)
        else:
                raise Exception('The image size  is not recognized.')
        return img 
开发者ID:zchengquan,项目名称:TextDetector,代码行数:24,代码来源:imgOp.py

示例2: _resize

# 需要导入模块: from skimage import filters [as 别名]
# 或者: from skimage.filters import gaussian_filter [as 别名]
def _resize(args):
    img, rescale_size, bbox = args
    img = img[bbox[0]:bbox[1], bbox[2]:bbox[3]]
    # Smooth image before resize to avoid moire patterns
    scale = img.shape[0] / float(rescale_size)
    sigma = np.sqrt(scale) / 2.0
    img = filters.gaussian_filter(img, sigma=sigma, multichannel=True)
    img = transform.resize(img, (rescale_size, rescale_size, 3), order=3)
    img = (img*255).astype(np.uint8)
    return img 
开发者ID:andersbll,项目名称:autoencoding_beyond_pixels,代码行数:12,代码来源:celeba.py

示例3: get_blend_map

# 需要导入模块: from skimage import filters [as 别名]
# 或者: from skimage.filters import gaussian_filter [as 别名]
def get_blend_map(img, att_map, blur=True, overlap=True):
    att_map -= att_map.min()
    if att_map.max() > 0:
        att_map /= att_map.max()
    att_map = transform.resize(att_map, (img.shape[:2]), order = 3, mode='nearest')
    if blur:
        att_map = filters.gaussian_filter(att_map, 0.02*max(img.shape[:2]))
        att_map -= att_map.min()
        att_map /= att_map.max()
    cmap = plt.get_cmap('jet')
    att_map_v = cmap(att_map)
    att_map_v = np.delete(att_map_v, 3, 2)
    if overlap:
        att_map = 1*(1-att_map**0.7).reshape(att_map.shape + (1,))*img + (att_map**0.7).reshape(att_map.shape+(1,)) * att_map_v
    return att_map 
开发者ID:channelCS,项目名称:Audio-Vision,代码行数:17,代码来源:visualize_atten.py

示例4: difference_of_gaussian

# 需要导入模块: from skimage import filters [as 别名]
# 或者: from skimage.filters import gaussian_filter [as 别名]
def difference_of_gaussian(self, imin, bigsize=30.0, smallsize=3.0):
        g1 = filters.gaussian_filter(imin, bigsize)
        g2 = filters.gaussian_filter(imin, smallsize)
        diff = 255*(g1 - g2)

        diff[diff < 0] = 0.0
        diff[diff > 255.0] = 255.0
        diff = diff.astype(np.uint8) 
               
        return diff 
开发者ID:PeterJackNaylor,项目名称:DRFNS,代码行数:12,代码来源:segmentation_test.py

示例5: getImage

# 需要导入模块: from skimage import filters [as 别名]
# 或者: from skimage.filters import gaussian_filter [as 别名]
def getImage(self, params):
        sigma = float(params['sigma'])
        r = float(params['red'])
        g = float(params['green'])
        b = float(params['blue'])
        image = data.coffee()
        new_image = filters.gaussian_filter(image, sigma=sigma, multichannel=True)
        new_image[:, :, 0] = r * new_image[:, :, 0]
        new_image[:, :, 1] = g * new_image[:, :, 1]
        new_image[:, :, 2] = b * new_image[:, :, 2]
        return new_image 
开发者ID:adamhajari,项目名称:spyre,代码行数:13,代码来源:image_editor.py


注:本文中的skimage.filters.gaussian_filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。