neulab/docprompting-conala huggingface dataset:
skimage.draw.line_aa(r0, c0, r1, c1) [source]
 
Generate anti-aliased line pixel coordinates.  Parameters 
 
r0, c0int 

Starting position (row, column).  
r1, c1int 

End position (row, column).    Returns 
 
rr, cc, val(N,) ndarray (int, int, float) 

Indices of pixels (rr, cc) and intensity values (val). img[rr, cc] = val.     References  
1  
A Rasterizing Algorithm for Drawing Curves, A. Zingl, 2012 http://members.chello.at/easyfilter/Bresenham.pdf   Examples >>> from skimage.draw import line_aa
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> rr, cc, val = line_aa(1, 1, 8, 8)
>>> img[rr, cc] = val * 255
>>> img
array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
       [  0, 255,  74,   0,   0,   0,   0,   0,   0,   0],
       [  0,  74, 255,  74,   0,   0,   0,   0,   0,   0],
       [  0,   0,  74, 255,  74,   0,   0,   0,   0,   0],
       [  0,   0,   0,  74, 255,  74,   0,   0,   0,   0],
       [  0,   0,   0,   0,  74, 255,  74,   0,   0,   0],
       [  0,   0,   0,   0,   0,  74, 255,  74,   0,   0],
       [  0,   0,   0,   0,   0,   0,  74, 255,  74,   0],
       [  0,   0,   0,   0,   0,   0,   0,  74, 255,   0],
       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0]], dtype=uint8)
skimage.draw.line_nd(start, stop, *, endpoint=False, integer=True) [source]
 
Draw a single-pixel thick line in n dimensions. The line produced will be ndim-connected. That is, two subsequent pixels in the line will be either direct or diagonal neighbours in n dimensions.  Parameters 
 
startarray-like, shape (N,) 

The start coordinates of the line.  
stoparray-like, shape (N,) 

The end coordinates of the line.  
endpointbool, optional 

Whether to include the endpoint in the returned line. Defaults to False, which allows for easy drawing of multi-point paths.  
integerbool, optional 

Whether to round the coordinates to integer. If True (default), the returned coordinates can be used to directly index into an array. False could be used for e.g. vector drawing.    Returns 
 
coordstuple of arrays 

The coordinates of points on the line.     Examples >>> lin = line_nd((1, 1), (5, 2.5), endpoint=False)
>>> lin
(array([1, 2, 3, 4]), array([1, 1, 2, 2]))
>>> im = np.zeros((6, 5), dtype=int)
>>> im[lin] = 1
>>> im
array([[0, 0, 0, 0, 0],
       [0, 1, 0, 0, 0],
       [0, 1, 0, 0, 0],
       [0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0],
       [0, 0, 0, 0, 0]])
>>> line_nd([2, 1, 1], [5, 5, 2.5], endpoint=True)
(array([2, 3, 4, 4, 5]), array([1, 2, 3, 4, 5]), array([1, 1, 2, 2, 2]))
skimage.draw.polygon(r, c, shape=None) [source]
 
Generate coordinates of pixels within polygon.  Parameters 
 
r(N,) ndarray 

Row coordinates of vertices of polygon.  
c(N,) ndarray 

Column coordinates of vertices of polygon.  
shapetuple, optional 

Image shape which is used to determine the maximum extent of output pixel coordinates. This is useful for polygons that exceed the image size. If None, the full extent of the polygon is used. Must be at least length 2. Only the first two values are used to determine the extent of the input image.    Returns 
 
rr, ccndarray of int 

Pixel coordinates of polygon. May be used to directly index into an array, e.g. img[rr, cc] = 1.     Examples >>> from skimage.draw import polygon
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> r = np.array([1, 2, 8])
>>> c = np.array([1, 7, 4])
>>> rr, cc = polygon(r, c)
>>> img[rr, cc] = 1
>>> img
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
       [0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
       [0, 0, 0, 1, 1, 1, 1, 0, 0, 0],
       [0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
       [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
       [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
skimage.draw.polygon2mask(image_shape, polygon) [source]
 
Compute a mask from polygon.  Parameters 
 
image_shapetuple of size 2. 

The shape of the mask.  
polygonarray_like. 

The polygon coordinates of shape (N, 2) where N is the number of points.    Returns 
 
mask2-D ndarray of type ‘bool’. 

The mask that corresponds to the input polygon.     Notes This function does not do any border checking, so that all the vertices need to be within the given shape. Examples >>> image_shape = (128, 128)
>>> polygon = np.array([[60, 100], [100, 40], [40, 40]])
>>> mask = polygon2mask(image_shape, polygon)
>>> mask.shape
(128, 128)
skimage.draw.polygon_perimeter(r, c, shape=None, clip=False) [source]
 
Generate polygon perimeter coordinates.  Parameters 
 
r(N,) ndarray 

Row coordinates of vertices of polygon.  
c(N,) ndarray 

Column coordinates of vertices of polygon.  
shapetuple, optional 

Image shape which is used to determine maximum extents of output pixel coordinates. This is useful for polygons that exceed the image size. If None, the full extents of the polygon is used. Must be at least length 2. Only the first two values are used to determine the extent of the input image.  
clipbool, optional 

Whether to clip the polygon to the provided shape. If this is set to True, the drawn figure will always be a closed polygon with all edges visible.    Returns 
 
rr, ccndarray of int 

Pixel coordinates of polygon. May be used to directly index into an array, e.g. img[rr, cc] = 1.     Examples >>> from skimage.draw import polygon_perimeter
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> rr, cc = polygon_perimeter([5, -1, 5, 10],
...                            [-1, 5, 11, 5],
...                            shape=img.shape, clip=True)
>>> img[rr, cc] = 1
>>> img
array([[0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 1, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 1],
       [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
       [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
       [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
       [0, 1, 1, 0, 0, 0, 0, 0, 0, 1],
       [0, 0, 0, 1, 0, 0, 0, 1, 1, 0],
       [0, 0, 0, 0, 1, 1, 1, 0, 0, 0]], dtype=uint8)
skimage.draw.random_shapes(image_shape, max_shapes, min_shapes=1, min_size=2, max_size=None, multichannel=True, num_channels=3, shape=None, intensity_range=None, allow_overlap=False, num_trials=100, random_seed=None) [source]
 
Generate an image with random shapes, labeled with bounding boxes. The image is populated with random shapes with random sizes, random locations, and random colors, with or without overlap. Shapes have random (row, col) starting coordinates and random sizes bounded by min_size and max_size. It can occur that a randomly generated shape will not fit the image at all. In that case, the algorithm will try again with new starting coordinates a certain number of times. However, it also means that some shapes may be skipped altogether. In that case, this function will generate fewer shapes than requested.  Parameters 
 
image_shapetuple 

The number of rows and columns of the image to generate.  
max_shapesint 

The maximum number of shapes to (attempt to) fit into the shape.  
min_shapesint, optional 

The minimum number of shapes to (attempt to) fit into the shape.  
min_sizeint, optional 

The minimum dimension of each shape to fit into the image.  
max_sizeint, optional 

The maximum dimension of each shape to fit into the image.  
multichannelbool, optional 

If True, the generated image has num_channels color channels, otherwise generates grayscale image.  
num_channelsint, optional 

Number of channels in the generated image. If 1, generate monochrome images, else color images with multiple channels. Ignored if multichannel is set to False.  
shape{rectangle, circle, triangle, ellipse, None} str, optional 

The name of the shape to generate or None to pick random ones.  
intensity_range{tuple of tuples of uint8, tuple of uint8}, optional 

The range of values to sample pixel values from. For grayscale images the format is (min, max). For multichannel - ((min, max),) if the ranges are equal across the channels, and ((min_0, max_0), … (min_N, max_N)) if they differ. As the function supports generation of uint8 arrays only, the maximum range is (0, 255). If None, set to (0, 254) for each channel reserving color of intensity = 255 for background.  
allow_overlapbool, optional 

If True, allow shapes to overlap.  
num_trialsint, optional 

How often to attempt to fit a shape into the image before skipping it.  
random_seedint, optional 

Seed to initialize the random number generator. If None, a random seed from the operating system is used.    Returns 
 
imageuint8 array 

An image with the fitted shapes.  
labelslist 

A list of labels, one per shape in the image. Each label is a (category, ((r0, r1), (c0, c1))) tuple specifying the category and bounding box coordinates of the shape.     Examples >>> import skimage.draw
>>> image, labels = skimage.draw.random_shapes((32, 32), max_shapes=3)
>>> image 
array([
   [[255, 255, 255],
    [255, 255, 255],
    [255, 255, 255],
    ...,
    [255, 255, 255],
    [255, 255, 255],
    [255, 255, 255]]], dtype=uint8)
>>> labels 
[('circle', ((22, 18), (25, 21))),
 ('triangle', ((5, 6), (13, 13)))]
skimage.draw.rectangle(start, end=None, extent=None, shape=None) [source]
 
Generate coordinates of pixels within a rectangle.  Parameters 
 
starttuple 

Origin point of the rectangle, e.g., ([plane,] row, column).  
endtuple 

End point of the rectangle ([plane,] row, column). For a 2D matrix, the slice defined by the rectangle is [start:(end+1)]. Either end or extent must be specified.  
extenttuple 

The extent (size) of the drawn rectangle. E.g., ([num_planes,] num_rows, num_cols). Either end or extent must be specified. A negative extent is valid, and will result in a rectangle going along the opposite direction. If extent is negative, the start point is not included.  
shapetuple, optional 

Image shape used to determine the maximum bounds of the output coordinates. This is useful for clipping rectangles that exceed the image size. By default, no clipping is done.    Returns 
 
coordsarray of int, shape (Ndim, Npoints) 

The coordinates of all pixels in the rectangle.     Notes This function can be applied to N-dimensional images, by passing start and end or extent as tuples of length N. Examples >>> import numpy as np
>>> from skimage.draw import rectangle
>>> img = np.zeros((5, 5), dtype=np.uint8)
>>> start = (1, 1)
>>> extent = (3, 3)
>>> rr, cc = rectangle(start, extent=extent, shape=img.shape)
>>> img[rr, cc] = 1
>>> img
array([[0, 0, 0, 0, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 0, 0, 0, 0]], dtype=uint8)
 >>> img = np.zeros((5, 5), dtype=np.uint8)
>>> start = (0, 1)
>>> end = (3, 3)
>>> rr, cc = rectangle(start, end=end, shape=img.shape)
>>> img[rr, cc] = 1
>>> img
array([[0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 0, 0, 0, 0]], dtype=uint8)
 >>> import numpy as np
>>> from skimage.draw import rectangle
>>> img = np.zeros((6, 6), dtype=np.uint8)
>>> start = (3, 3)
>>>
>>> rr, cc = rectangle(start, extent=(2, 2))
>>> img[rr, cc] = 1
>>> rr, cc = rectangle(start, extent=(-2, 2))
>>> img[rr, cc] = 2
>>> rr, cc = rectangle(start, extent=(-2, -2))
>>> img[rr, cc] = 3
>>> rr, cc = rectangle(start, extent=(2, -2))
>>> img[rr, cc] = 4
>>> print(img)
[[0 0 0 0 0 0]
 [0 3 3 2 2 0]
 [0 3 3 2 2 0]
 [0 4 4 1 1 0]
 [0 4 4 1 1 0]
 [0 0 0 0 0 0]]
skimage.draw.rectangle_perimeter(start, end=None, extent=None, shape=None, clip=False) [source]
 
Generate coordinates of pixels that are exactly around a rectangle.  Parameters 
 
starttuple 

Origin point of the inner rectangle, e.g., (row, column).  
endtuple 

End point of the inner rectangle (row, column). For a 2D matrix, the slice defined by inner the rectangle is [start:(end+1)]. Either end or extent must be specified.  
extenttuple 

The extent (size) of the inner rectangle. E.g., (num_rows, num_cols). Either end or extent must be specified. Negative extents are permitted. See rectangle to better understand how they behave.  
shapetuple, optional 

Image shape used to determine the maximum bounds of the output coordinates. This is useful for clipping perimeters that exceed the image size. By default, no clipping is done. Must be at least length 2. Only the first two values are used to determine the extent of the input image.  
clipbool, optional 

Whether to clip the perimeter to the provided shape. If this is set to True, the drawn figure will always be a closed polygon with all edges visible.    Returns 
 
coordsarray of int, shape (2, Npoints) 

The coordinates of all pixels in the rectangle.     Examples >>> import numpy as np
>>> from skimage.draw import rectangle_perimeter
>>> img = np.zeros((5, 6), dtype=np.uint8)
>>> start = (2, 3)
>>> end = (3, 4)
>>> rr, cc = rectangle_perimeter(start, end=end, shape=img.shape)
>>> img[rr, cc] = 1
>>> img
array([[0, 0, 0, 0, 0, 0],
       [0, 0, 1, 1, 1, 1],
       [0, 0, 1, 0, 0, 1],
       [0, 0, 1, 0, 0, 1],
       [0, 0, 1, 1, 1, 1]], dtype=uint8)
 >>> img = np.zeros((5, 5), dtype=np.uint8)
>>> r, c = rectangle_perimeter(start, (10, 10), shape=img.shape, clip=True)
>>> img[r, c] = 1
>>> img
array([[0, 0, 0, 0, 0],
       [0, 0, 1, 1, 1],
       [0, 0, 1, 0, 1],
       [0, 0, 1, 0, 1],
       [0, 0, 1, 1, 1]], dtype=uint8)
skimage.draw.set_color(image, coords, color, alpha=1) [source]
 
Set pixel color in the image at the given coordinates. Note that this function modifies the color of the image in-place. Coordinates that exceed the shape of the image will be ignored.  Parameters 
 
image(M, N, D) ndarray 

Image  
coordstuple of ((P,) ndarray, (P,) ndarray) 

Row and column coordinates of pixels to be colored.  
color(D,) ndarray 

Color to be assigned to coordinates in the image.  
alphascalar or (N,) ndarray 

Alpha values used to blend color with image. 0 is transparent, 1 is opaque.     Examples >>> from skimage.draw import line, set_color
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> rr, cc = line(1, 1, 20, 20)
>>> set_color(img, (rr, cc), 1)
>>> img
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]], dtype=uint8)
skimage.dtype_limits(image, clip_negative=False) [source]
 
Return intensity limits, i.e. (min, max) tuple, of the image’s dtype.  Parameters 
 
imagendarray 

Input image.  
clip_negativebool, optional 

If True, clip the negative range (i.e. return 0 for min intensity) even if the image dtype allows negative values.    Returns 
 
imin, imaxtuple 

Lower and upper intensity limits.
skimage.exposure.adjust_gamma(image, gamma=1, gain=1) [source]
 
Performs Gamma Correction on the input image. Also known as Power Law Transform. This function transforms the input image pixelwise according to the equation O = I**gamma after scaling each pixel to the range 0 to 1.  Parameters 
 
imagendarray 

Input image.  
gammafloat, optional 

Non negative real number. Default value is 1.  
gainfloat, optional 

The constant multiplier. Default value is 1.    Returns 
 
outndarray 

Gamma corrected output image.      See also  
adjust_log

  Notes For gamma greater than 1, the histogram will shift towards left and the output image will be darker than the input image. For gamma less than 1, the histogram will shift towards right and the output image will be brighter than the input image. References  
1  
https://en.wikipedia.org/wiki/Gamma_correction   Examples >>> from skimage import data, exposure, img_as_float
>>> image = img_as_float(data.moon())
>>> gamma_corrected = exposure.adjust_gamma(image, 2)
>>> # Output is darker for gamma > 1
>>> image.mean() > gamma_corrected.mean()
True
skimage.exposure.adjust_log(image, gain=1, inv=False) [source]
 
Performs Logarithmic correction on the input image. This function transforms the input image pixelwise according to the equation O = gain*log(1 + I) after scaling each pixel to the range 0 to 1. For inverse logarithmic correction, the equation is O = gain*(2**I - 1).  Parameters 
 
imagendarray 

Input image.  
gainfloat, optional 

The constant multiplier. Default value is 1.  
invfloat, optional 

If True, it performs inverse logarithmic correction, else correction will be logarithmic. Defaults to False.    Returns 
 
outndarray 

Logarithm corrected output image.      See also  
adjust_gamma

  References  
1  
http://www.ece.ucsb.edu/Faculty/Manjunath/courses/ece178W03/EnhancePart1.pdf
skimage.exposure.adjust_sigmoid(image, cutoff=0.5, gain=10, inv=False) [source]
 
Performs Sigmoid Correction on the input image. Also known as Contrast Adjustment. This function transforms the input image pixelwise according to the equation O = 1/(1 + exp*(gain*(cutoff - I))) after scaling each pixel to the range 0 to 1.  Parameters 
 
imagendarray 

Input image.  
cutofffloat, optional 

Cutoff of the sigmoid function that shifts the characteristic curve in horizontal direction. Default value is 0.5.  
gainfloat, optional 

The constant multiplier in exponential’s power of sigmoid function. Default value is 10.  
invbool, optional 

If True, returns the negative sigmoid correction. Defaults to False.    Returns 
 
outndarray 

Sigmoid corrected output image.      See also  
adjust_gamma

  References  
1  
Gustav J. Braun, “Image Lightness Rescaling Using Sigmoidal Contrast Enhancement Functions”, http://www.cis.rit.edu/fairchild/PDFs/PAP07.pdf
skimage.exposure.cumulative_distribution(image, nbins=256) [source]
 
Return cumulative distribution function (cdf) for the given image.  Parameters 
 
imagearray 

Image array.  
nbinsint, optional 

Number of bins for image histogram.    Returns 
 
img_cdfarray 

Values of cumulative distribution function.  
bin_centersarray 

Centers of bins.      See also  
histogram

  References  
1  
https://en.wikipedia.org/wiki/Cumulative_distribution_function   Examples >>> from skimage import data, exposure, img_as_float
>>> image = img_as_float(data.camera())
>>> hi = exposure.histogram(image)
>>> cdf = exposure.cumulative_distribution(image)
>>> np.alltrue(cdf[0] == np.cumsum(hi[0])/float(image.size))
True
skimage.exposure.equalize_adapthist(image, kernel_size=None, clip_limit=0.01, nbins=256) [source]
 
Contrast Limited Adaptive Histogram Equalization (CLAHE). An algorithm for local contrast enhancement, that uses histograms computed over different tile regions of the image. Local details can therefore be enhanced even in regions that are darker or lighter than most of the image.  Parameters 
 
image(N1, …,NN[, C]) ndarray 

Input image.  kernel_size: int or array_like, optional

Defines the shape of contextual regions used in the algorithm. If iterable is passed, it must have the same number of elements as image.ndim (without color channel). If integer, it is broadcasted to each image dimension. By default, kernel_size is 1/8 of image height by 1/8 of its width.  
clip_limitfloat, optional 

Clipping limit, normalized between 0 and 1 (higher values give more contrast).  
nbinsint, optional 

Number of gray bins for histogram (“data range”).    Returns 
 
out(N1, …,NN[, C]) ndarray 

Equalized image with float64 dtype.      See also  
equalize_hist, rescale_intensity

  Notes  
 For color images, the following steps are performed:

 The image is converted to HSV color space The CLAHE algorithm is run on the V (Value) channel The image is converted back to RGB space and returned     For RGBA images, the original alpha channel is removed.   Changed in version 0.17: The values returned by this function are slightly shifted upwards because of an internal change in rounding behavior.  References  
1  
http://tog.acm.org/resources/GraphicsGems/  
2  
https://en.wikipedia.org/wiki/CLAHE#CLAHE
skimage.exposure.equalize_hist(image, nbins=256, mask=None) [source]
 
Return image after histogram equalization.  Parameters 
 
imagearray 

Image array.  
nbinsint, optional 

Number of bins for image histogram. Note: this argument is ignored for integer images, for which each integer is its own bin.  mask: ndarray of bools or 0s and 1s, optional

Array of same shape as image. Only points at which mask == True are used for the equalization, which is applied to the whole image.    Returns 
 
outfloat array 

Image array after histogram equalization.     Notes This function is adapted from [1] with the author’s permission. References  
1  
http://www.janeriksolem.net/histogram-equalization-with-python-and.html  
2  
https://en.wikipedia.org/wiki/Histogram_equalization
skimage.exposure.histogram(image, nbins=256, source_range='image', normalize=False) [source]
 
Return histogram of image. Unlike numpy.histogram, this function returns the centers of bins and does not rebin integer arrays. For integer arrays, each integer value has its own bin, which improves speed and intensity-resolution. The histogram is computed on the flattened image: for color images, the function should be used separately on each channel to obtain a histogram for each color channel.  Parameters 
 
imagearray 

Input image.  
nbinsint, optional 

Number of bins used to calculate histogram. This value is ignored for integer arrays.  
source_rangestring, optional 

‘image’ (default) determines the range from the input image. ‘dtype’ determines the range from the expected range of the images of that data type.  
normalizebool, optional 

If True, normalize the histogram by the sum of its values.    Returns 
 
histarray 

The values of the histogram.  
bin_centersarray 

The values at the center of the bins.      See also  
cumulative_distribution

  Examples >>> from skimage import data, exposure, img_as_float
>>> image = img_as_float(data.camera())
>>> np.histogram(image, bins=2)
(array([ 93585, 168559]), array([0. , 0.5, 1. ]))
>>> exposure.histogram(image, nbins=2)
(array([ 93585, 168559]), array([0.25, 0.75]))
skimage.exposure.is_low_contrast(image, fraction_threshold=0.05, lower_percentile=1, upper_percentile=99, method='linear') [source]
 
Determine if an image is low contrast.  Parameters 
 
imagearray-like 

The image under test.  
fraction_thresholdfloat, optional 

The low contrast fraction threshold. An image is considered low- contrast when its range of brightness spans less than this fraction of its data type’s full range. [1]  
lower_percentilefloat, optional 

Disregard values below this percentile when computing image contrast.  
upper_percentilefloat, optional 

Disregard values above this percentile when computing image contrast.  
methodstr, optional 

The contrast determination method. Right now the only available option is “linear”.    Returns 
 
outbool 

True when the image is determined to be low contrast.     References  
1  
https://scikit-image.org/docs/dev/user_guide/data_types.html   Examples >>> image = np.linspace(0, 0.04, 100)
>>> is_low_contrast(image)
True
>>> image[-1] = 1
>>> is_low_contrast(image)
True
>>> is_low_contrast(image, upper_percentile=100)
False
skimage.exposure.match_histograms(image, reference, *, multichannel=False) [source]
 
Adjust an image so that its cumulative histogram matches that of another. The adjustment is applied separately for each channel.  Parameters 
 
imagendarray 

Input image. Can be gray-scale or in color.  
referencendarray 

Image to match histogram of. Must have the same number of channels as image.  
multichannelbool, optional 

Apply the matching separately for each channel.    Returns 
 
matchedndarray 

Transformed input image.    Raises 
 ValueError

Thrown when the number of channels in the input image and the reference differ.     References  
1  
http://paulbourke.net/miscellaneous/equalisation/