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


Python exposure.equalize_hist方法代码示例

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


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

示例1: rgb2illumination_invariant

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def rgb2illumination_invariant(img, alpha, hist_eq=False):
    """
    this is an implementation of the illuminant-invariant color space published
    by Maddern2014
    http://www.robots.ox.ac.uk/~mobile/Papers/2014ICRA_maddern.pdf

    :param img:
    :param alpha: camera paramete
    :return:
    """
    ii_img = 0.5 + np.log(img[:, :, 1] + 1e-8) - \
        alpha * np.log(img[:, :, 2] + 1e-8) - \
        (1 - alpha) * np.log(img[:, :, 0] + 1e-8)

    # ii_img = exposure.rescale_intensity(ii_img, out_range=(0, 1))
    if hist_eq:
        ii_img = exposure.equalize_hist(ii_img)

    print np.max(ii_img)
    print np.min(ii_img)

    return ii_img 
开发者ID:fvisin,项目名称:reseg,代码行数:24,代码来源:helper_dataset.py

示例2: three_band_image

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def three_band_image(ds, bands, time=0, figsize=[10, 10], projection='projected'):
    '''
    three_band_image takes three spectral bands and plots them on the RGB bands of an image.

    Inputs:
    ds -   Dataset containing the bands to be plotted
    bands - list of three bands to be plotted

    Optional:
    time - Index value of the time dimension of ds to be plotted
    figsize - dimensions for the output figure
    projection - options are 'projected' or 'geographic'. To determine if the image is in degrees or northings
    '''
    t, y, x = ds[bands[0]].shape
    rawimg = np.zeros((y, x, 3), dtype=np.float32)
    for i, colour in enumerate(bands):
        rawimg[:, :, i] = ds[colour][time].values
    rawimg[rawimg == -9999] = np.nan
    img_toshow = exposure.equalize_hist(rawimg, mask=np.isfinite(rawimg))

    return img_toshow 
开发者ID:opendatacube,项目名称:cube-in-a-box,代码行数:23,代码来源:utils.py

示例3: loadDataGeneral

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def loadDataGeneral(df, path, im_shape):
    X, y = [], []
    for i, item in df.iterrows():
        img = img_as_float(io.imread(path + item[0]))
        mask = io.imread(path + item[1])
        img = transform.resize(img, im_shape)
        img = exposure.equalize_hist(img)
        img = np.expand_dims(img, -1)
        mask = transform.resize(mask, im_shape)
        mask = np.expand_dims(mask, -1)
        X.append(img)
        y.append(mask)
    X = np.array(X)
    y = np.array(y)
    X -= X.mean()
    X /= X.std()

    print '### Dataset loaded'
    print '\t{}'.format(path)
    print '\t{}\t{}'.format(X.shape, y.shape)
    print '\tX:{:.1f}-{:.1f}\ty:{:.1f}-{:.1f}\n'.format(X.min(), X.max(), y.min(), y.max())
    print '\tX.mean = {}, X.std = {}'.format(X.mean(), X.std())
    return X, y 
开发者ID:imlab-uiip,项目名称:lung-segmentation-2d,代码行数:25,代码来源:demo.py

示例4: loadDataGeneral

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def loadDataGeneral(df, path, im_shape):
    """Function for loading arbitrary data in standard formats"""
    X, y = [], []
    for i, item in df.iterrows():
        img = img_as_float(io.imread(path + item[0]))
        mask = io.imread(path + item[1])
        img = transform.resize(img, im_shape)
        img = exposure.equalize_hist(img)
        img = np.expand_dims(img, -1)
        mask = transform.resize(mask, im_shape)
        mask = np.expand_dims(mask, -1)
        X.append(img)
        y.append(mask)
    X = np.array(X)
    y = np.array(y)
    X -= X.mean()
    X /= X.std()

    print '### Dataset loaded'
    print '\t{}'.format(path)
    print '\t{}\t{}'.format(X.shape, y.shape)
    print '\tX:{:.1f}-{:.1f}\ty:{:.1f}-{:.1f}\n'.format(X.min(), X.max(), y.min(), y.max())
    print '\tX.mean = {}, X.std = {}'.format(X.mean(), X.std())
    return X, y 
开发者ID:imlab-uiip,项目名称:lung-segmentation-2d,代码行数:26,代码来源:load_data.py

示例5: LSTConvolue

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def LSTConvolue(self):
        kernel_rate= np.array([[1/8, 1/8 , 1/8],
                              [1/8, -1, 1/8],
                              [1/8, 1/8, 1/8]])  #卷积核    
        kernel_id= np.array([[-1, -1 ,-1],
                                [-1 ,8, -1],
                                [-1, -1, -1]])  #卷积核        
        kernel=kernel_rate
        t0=time.time()
#        print(self.LST)
        array_convolve2d=convolve2d(self.LST,kernel,mode='same')*-1
#        print(array_convolve2d.max(),array_convolve2d.min())
#        array_convolve2d=exposure.equalize_hist(array_convolve2d)
        p2, p98 = np.percentile(array_convolve2d, (2,96))
        array_convolve2dRescale = exposure.rescale_intensity(array_convolve2d, in_range=(p2, p98))
#        print()
        array_convolve2dZero=np.copy(array_convolve2d)
        array_convolve2dZero[array_convolve2dZero>0]=1
        array_convolve2dZero[array_convolve2dZero<0]=-1
        array_convolve2dZero[array_convolve2dZero==0]=0
        
        
        t1=time.time()
        t_convolve2d=t1-t0
        print("lasting time:",t_convolve2d)
        
        self.imgShow(imges=(self.LST,array_convolve2dRescale,array_convolve2dZero),titleName=("array","array_convolve2d_rescale","0",),xyticksRange=(1,1))
      
        return array_convolve2d,array_convolve2dZero
        
##显示图像 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:33,代码来源:LST.py

示例6: loadDataMontgomery

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def loadDataMontgomery(df, path, im_shape):
    """Function for loading Montgomery dataset"""
    X, y = [], []
    for i, item in df.iterrows():
        img = img_as_float(io.imread(path + item[0]))
        gt = io.imread(path + item[1])
        l, r = np.where(img.sum(0) > 1)[0][[0, -1]]
        t, b = np.where(img.sum(1) > 1)[0][[0, -1]]
        img = img[t:b, l:r]
        mask = gt[t:b, l:r]
        img = transform.resize(img, im_shape)
        img = exposure.equalize_hist(img)
        img = np.expand_dims(img, -1)
        mask = transform.resize(mask, im_shape)
        mask = np.expand_dims(mask, -1)
        X.append(img)
        y.append(mask)
    X = np.array(X)
    y = np.array(y)
    X -= X.mean()
    X /= X.std()

    print '### Data loaded'
    print '\t{}'.format(path)
    print '\t{}\t{}'.format(X.shape, y.shape)
    print '\tX:{:.1f}-{:.1f}\ty:{:.1f}-{:.1f}\n'.format(X.min(), X.max(), y.min(), y.max())
    print '\tX.mean = {}, X.std = {}'.format(X.mean(), X.std())
    return X, y 
开发者ID:imlab-uiip,项目名称:lung-segmentation-2d,代码行数:30,代码来源:load_data.py

示例7: make_lungs

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def make_lungs():
    path = '/path/to/JSRT/All247images/'
    for i, filename in enumerate(os.listdir(path)):
        img = 1.0 - np.fromfile(path + filename, dtype='>u2').reshape((2048, 2048)) * 1. / 4096
        img = exposure.equalize_hist(img)
        io.imsave('/path/to/JSRT/new/' + filename[:-4] + '.png', img)
        print 'Lung', i, filename 
开发者ID:imlab-uiip,项目名称:lung-segmentation-2d,代码行数:9,代码来源:preprocess_JSRT.py

示例8: adaptive_equalize

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_hist [as 别名]
def adaptive_equalize(img):
        # Adaptive Equalization
        img = img_as_float(img)
        img_adapteq = exposure.equalize_hist(img)
        return img_adapteq 
开发者ID:921kiyo,项目名称:3d-dl,代码行数:7,代码来源:AugmentationPipeline.py


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