Python skimage.exposure 模块,equalize_adapthist() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用skimage.exposure.equalize_adapthist()

项目:kaggle-dstl-satellite-imagery-feature-detection    作者:u1234x1234    | 项目源码 | 文件源码
def get_data(image_id, a_size, m_size, p_size, sf):
    rgb_data = get_rgb_data(image_id)
    rgb_data = cv2.resize(rgb_data, (p_size*sf, p_size*sf),
                          interpolation=cv2.INTER_LANCZOS4)

#    rgb_data = rgb_data.astype(np.float) / 2500.
#    print(np.max(rgb_data), np.mean(rgb_data))

#    rgb_data[:, :, 0] = exposure.equalize_adapthist(rgb_data[:, :, 0], clip_limit=0.04)
#    rgb_data[:, :, 1] = exposure.equalize_adapthist(rgb_data[:, :, 1], clip_limit=0.04)
#    rgb_data[:, :, 2] = exposure.equalize_adapthist(rgb_data[:, :, 2], clip_limit=0.04)    

    A_data = get_spectral_data(image_id, a_size*sf, a_size*sf, bands=['A'])
    M_data = get_spectral_data(image_id, m_size*sf, m_size*sf, bands=['M'])
    P_data = get_spectral_data(image_id, p_size*sf, p_size*sf, bands=['P'])

#    lab_data = cv2.cvtColor(rgb_data, cv2.COLOR_BGR2LAB)
    P_data = np.concatenate([rgb_data, P_data], axis=2)

    return A_data, M_data, P_data
项目:pypiv    作者:jr7    | 项目源码 | 文件源码
def clahe_normalization(img, kernel_size=3, nbins=1024, clip_limit=0.3):
    '''Contrast Limited Adaptive Histogram Equalization (CLAHE).'''
    return equalize_adapthist(img, kernel_size, nbins, clip_limit)
项目:pisap    作者:neurospin    | 项目源码 | 文件源码
def scaling(image, method="stretching"):
    """
    Change the image dynamic.

    Parameters
    ----------
    image: Image
        the image to be transformed.
    method: str, default 'stretching'
        the normalization method: 'stretching', 'equalization' or 'adaptive'.

    Returns
    -------
    normalize_image: Image
        the normalized image.
    """
    # Contrast stretching
    if method == "stretching":
        p2, p98 = np.percentile(image.data, (2, 98))
        norm_data = exposure.rescale_intensity(image.data, in_range=(p2, p98))

    # Equalization
    elif method == "equalization":
        norm_data = exposure.equalize_hist(image.data)

    # Adaptive Equalization
    elif method == "adaptive":
        norm_data = exposure.equalize_adapthist(image.data, clip_limit=0.03)

    # Unknown method
    else:
        raise ValueError("Unknown normalization '{0}'.".format(method))

    normalize_image = pisap.Image(data=norm_data)

    return normalize_image
项目:nuts-ml    作者:maet3608    | 项目源码 | 文件源码
def normalize_histo(image, gamma=1.0):
    """
    Perform histogram normalization on image.

    :param numpy array image: Numpy array with range [0,255] and dtype 'uint8'.
    :param float gamma: Factor for gamma adjustment.
    :return: Normalized image
    :rtype: numpy array with range [0,255] and dtype 'uint8'
    """
    image = ske.equalize_adapthist(image)
    image = ske.adjust_gamma(image, gamma=gamma)
    return floatimg2uint8(image)
项目:stomatameasurer    作者:TeamMacLean    | 项目源码 | 文件源码
def equalize_adapthist(img, val=None):
    return exposure.equalize_adapthist(img)