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

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

项目:nn-segmentation-for-lar    作者:cvdlab    | 项目源码 | 文件源码
def predict_image(self, test_img):
        """
        predicts classes of input image
        :param test_img: filepath to image to predict on
        :param show: displays segmentation results
        :return: segmented result
        """
        img = np.array( rgb2gray( imread( test_img ).astype( 'float' ) ).reshape( 5, 216, 160 )[-2] ) / 256

        plist = []

        # create patches from an entire slice
        img_1 = adjust_sigmoid( img ).astype( float )
        edges_1 = adjust_sigmoid( img, inv=True ).astype( float )
        edges_2 = img_1
        edges_5_n = normalize( laplace( img_1 ) )
        edges_5_n = img_as_float( img_as_ubyte( edges_5_n ) )

        plist.append( extract_patches_2d( edges_1, (23, 23) ) )
        plist.append( extract_patches_2d( edges_2, (23, 23) ) )
        plist.append( extract_patches_2d( edges_5_n, (23, 23) ) )
        patches = np.array( zip( np.array( plist[0] ), np.array( plist[1] ), np.array( plist[2] ) ) )

        # predict classes of each pixel based on model
        full_pred = self.model.predict_classes( patches )
        fp1 = full_pred.reshape( 194, 138 )
        return fp1
项目:scanify    作者:idf    | 项目源码 | 文件源码
def run(self, imgin_path, imgout_path=None, increase_exposure=False):
        imgin_path = self.__expand_user(imgin_path)
        img = misc.imread(imgin_path)

        img_blurred = self.__blur(img)
        img = self.__divide(img, img_blurred)
        if increase_exposure:
            img = exposure.adjust_sigmoid(img)

        if not imgout_path:
            imgout_path = self.__add_suffix(imgin_path)
        misc.imsave(imgout_path, img)
        print("Saved to", imgout_path)
项目:segmentation    作者:zengyu714    | 项目源码 | 文件源码
def _augment(xs):
    """Image adjustment doesn't change image shape, but for intensity.

    Return:
        images: 4-d tensor with shape [depth, height, width, channels]
    """

    # `xs` has shape [depth, height, width] with value in [0, 1].
    brt_gamma, brt_gain = np.random.uniform(low=0.9, high=1.1, size=2)
    aj_bright = adjust_gamma(xs, brt_gamma, brt_gain)
    contrast_gain = np.random.uniform(low=5, high=10)
    aj_contrast = adjust_sigmoid(aj_bright, gain=contrast_gain)
    return aj_contrast
项目:deepsleepnet    作者:akaraspt    | 项目源码 | 文件源码
def constant(x, cutoff=0.5, gain=10, inv=False, is_random=False):
    # TODO
    x = exposure.adjust_sigmoid(x, cutoff=cutoff, gain=gain, inv=inv)
    return x
项目:dcgan    作者:zsdonghao    | 项目源码 | 文件源码
def constant(x, cutoff=0.5, gain=10, inv=False, is_random=False):
    # TODO
    x = exposure.adjust_sigmoid(x, cutoff=cutoff, gain=gain, inv=inv)
    return x
项目:Image-Captioning    作者:zsdonghao    | 项目源码 | 文件源码
def constant(x, cutoff=0.5, gain=10, inv=False, is_random=False):
    # TODO
    x = exposure.adjust_sigmoid(x, cutoff=cutoff, gain=gain, inv=inv)
    return x
项目:stomatameasurer    作者:TeamMacLean    | 项目源码 | 文件源码
def sigmoid_transform(img, cutoff=0.5):
    return exposure.adjust_sigmoid(img, cutoff)
项目:emotion-detection-in-images    作者:davidjeffwen    | 项目源码 | 文件源码
def contrast_enhance(img):
    return adjust_sigmoid(img, cutoff=0.5, gain=10)
项目:tensorlayer-chinese    作者:shorxp    | 项目源码 | 文件源码
def adjust_hue(im, hout=0.66, is_offset=True, is_clip=True, is_random=False):
    """ Adjust hue of an RGB image. This is a convenience method that converts an RGB image to float representation, converts it to HSV, add an offset to the hue channel, converts back to RGB and then back to the original data type.
    For TF, see `tf.image.adjust_hue <https://www.tensorflow.org/api_docs/python/tf/image/adjust_hue>`_ and `tf.image.random_hue <https://www.tensorflow.org/api_docs/python/tf/image/random_hue>`_.

    Parameters
    -----------
    im : should be a numpy arrays with values between 0 and 255.
    hout : float.
        - If is_offset is False, set all hue values to this value. 0 is red; 0.33 is green; 0.66 is blue.
        - If is_offset is True, add this value as the offset to the hue channel.
    is_offset : boolean, default True.
    is_clip : boolean, default True.
        - If True, set negative hue values to 0.
    is_random : boolean, default False.

    Examples
    ---------
    - Random, add a random value between -0.2 and 0.2 as the offset to every hue values.
    >>> im_hue = tl.prepro.adjust_hue(image, hout=0.2, is_offset=True, is_random=False)

    - Non-random, make all hue to green.
    >>> im_green = tl.prepro.adjust_hue(image, hout=0.66, is_offset=False, is_random=False)

    References
    -----------
    - `tf.image.random_hue <https://www.tensorflow.org/api_docs/python/tf/image/random_hue>`_.
    - `tf.image.adjust_hue <https://www.tensorflow.org/api_docs/python/tf/image/adjust_hue>`_.
    - `StackOverflow: Changing image hue with python PIL <https://stackoverflow.com/questions/7274221/changing-image-hue-with-python-pil>`_.
    """
    hsv = rgb_to_hsv(im)
    if is_random:
        hout = np.random.uniform(-hout, hout)

    if is_offset:
        hsv[...,0] += hout
    else:
        hsv[...,0] = hout

    if is_clip:
        hsv[...,0] = np.clip(hsv[...,0], 0, np.inf)  # Hao : can remove green dots

    rgb = hsv_to_rgb(hsv)
    return rgb


# # contrast
# def constant(x, cutoff=0.5, gain=10, inv=False, is_random=False):
#     # TODO
#     x = exposure.adjust_sigmoid(x, cutoff=cutoff, gain=gain, inv=inv)
#     return x
#
# def constant_multi():
#     #TODO
#     pass

# resize