
- Scikit Image – Introduction
- Scikit Image - Image Processing
- Scikit Image - Numpy Images
- Scikit Image - Image datatypes
- Scikit Image - Using Plugins
- Scikit Image - Image Handlings
- Scikit Image - Reading Images
- Scikit Image - Writing Images
- Scikit Image - Displaying Images
- Scikit Image - Image Collections
- Scikit Image - Image Stack
- Scikit Image - Multi Image
- Scikit Image - Data Visualization
- Scikit Image - Using Matplotlib
- Scikit Image - Using Ploty
- Scikit Image - Using Mayavi
- Scikit Image - Using Napari
- Scikit Image - Color Manipulation
- Scikit Image - Alpha Channel
- Scikit Image - Conversion b/w Color & Gray Values
- Scikit Image - Conversion b/w RGB & HSV
- Scikit Image - Conversion to CIE-LAB Color Space
- Scikit Image - Conversion from CIE-LAB Color Space
- Scikit Image - Conversion to luv Color Space
- Scikit Image - Conversion from luv Color Space
- Scikit Image - Image Inversion
- Scikit Image - Painting Images with Labels
- Scikit Image - Contrast & Exposure
- Scikit Image - Contrast
- Scikit Image - Contrast enhancement
- Scikit Image - Exposure
- Scikit Image - Histogram Matching
- Scikit Image - Histogram Equalization
- Scikit Image - Local Histogram Equalization
- Scikit Image - Tinting gray-scale images
- Scikit Image - Image Transformation
- Scikit Image - Scaling an image
- Scikit Image - Rotating an Image
- Scikit Image - Warping an Image
- Scikit Image - Affine Transform
- Scikit Image - Piecewise Affine Transform
- Scikit Image - ProjectiveTransform
- Scikit Image - EuclideanTransform
- Scikit Image - Radon Transform
- Scikit Image - Line Hough Transform
- Scikit Image - Probabilistic Hough Transform
- Scikit Image - Circular Hough Transforms
- Scikit Image - Elliptical Hough Transforms
- Scikit Image - Polynomial Transform
- Scikit Image - Image Pyramids
- Scikit Image - Pyramid Gaussian Transform
- Scikit Image - Pyramid Laplacian Transform
- Scikit Image - Swirl Transform
- Scikit Image - Morphological Operations
- Scikit Image - Erosion
- Scikit Image - Dilation
- Scikit Image - Black & White Tophat Morphologies
- Scikit Image - Convex Hull
- Scikit Image - Generating footprints
- Scikit Image - Isotopic Dilation & Erosion
- Scikit Image - Isotopic Closing & Opening of an Image
- Scikit Image - Skelitonizing an Image
- Scikit Image - Morphological Thinning
- Scikit Image - Masking an image
- Scikit Image - Area Closing & Opening of an Image
- Scikit Image - Diameter Closing & Opening of an Image
- Scikit Image - Morphological reconstruction of an Image
- Scikit Image - Finding local Maxima
- Scikit Image - Finding local Minima
- Scikit Image - Removing Small Holes from an Image
- Scikit Image - Removing Small Objects from an Image
- Scikit Image - Filters
- Scikit Image - Image Filters
- Scikit Image - Median Filter
- Scikit Image - Mean Filters
- Scikit Image - Morphological gray-level Filters
- Scikit Image - Gabor Filter
- Scikit Image - Gaussian Filter
- Scikit Image - Butterworth Filter
- Scikit Image - Frangi Filter
- Scikit Image - Hessian Filter
- Scikit Image - Meijering Neuriteness Filter
- Scikit Image - Sato Filter
- Scikit Image - Sobel Filter
- Scikit Image - Farid Filter
- Scikit Image - Scharr Filter
- Scikit Image - Unsharp Mask Filter
- Scikit Image - Roberts Cross Operator
- Scikit Image - Lapalace Operator
- Scikit Image - Window Functions With Images
- Scikit Image - Thresholding
- Scikit Image - Applying Threshold
- Scikit Image - Otsu Thresholding
- Scikit Image - Local thresholding
- Scikit Image - Hysteresis Thresholding
- Scikit Image - Li thresholding
- Scikit Image - Multi-Otsu Thresholding
- Scikit Image - Niblack and Sauvola Thresholding
- Scikit Image - Restoring Images
- Scikit Image - Rolling-ball Algorithm
- Scikit Image - Denoising an Image
- Scikit Image - Wavelet Denoising
- Scikit Image - Non-local means denoising for preserving textures
- Scikit Image - Calibrating Denoisers Using J-Invariance
- Scikit Image - Total Variation Denoising
- Scikit Image - Shift-invariant wavelet denoising
- Scikit Image - Image Deconvolution
- Scikit Image - Richardson-Lucy Deconvolution
- Scikit Image - Recover the original from a wrapped phase image
- Scikit Image - Image Inpainting
- Scikit Image - Registering Images
- Scikit Image - Image Registration
- Scikit Image - Masked Normalized Cross-Correlation
- Scikit Image - Registration using optical flow
- Scikit Image - Assemble images with simple image stitching
- Scikit Image - Registration using Polar and Log-Polar
- Scikit Image - Feature Detection
- Scikit Image - Dense DAISY Feature Description
- Scikit Image - Histogram of Oriented Gradients
- Scikit Image - Template Matching
- Scikit Image - CENSURE Feature Detector
- Scikit Image - BRIEF Binary Descriptor
- Scikit Image - SIFT Feature Detector and Descriptor Extractor
- Scikit Image - GLCM Texture Features
- Scikit Image - Shape Index
- Scikit Image - Sliding Window Histogram
- Scikit Image - Finding Contour
- Scikit Image - Texture Classification Using Local Binary Pattern
- Scikit Image - Texture Classification Using Multi-Block Local Binary Pattern
- Scikit Image - Active Contour Model
- Scikit Image - Canny Edge Detection
- Scikit Image - Marching Cubes
- Scikit Image - Foerstner Corner Detection
- Scikit Image - Harris Corner Detection
- Scikit Image - Extracting FAST Corners
- Scikit Image - Shi-Tomasi Corner Detection
- Scikit Image - Haar Like Feature Detection
- Scikit Image - Haar Feature detection of coordinates
- Scikit Image - Hessian matrix
- Scikit Image - ORB feature Detection
- Scikit Image - Additional Concepts
- Scikit Image - Render text onto an image
- Scikit Image - Face detection using a cascade classifier
- Scikit Image - Face classification using Haar-like feature descriptor
- Scikit Image - Visual image comparison
- Scikit Image - Exploring Region Properties With Pandas
Scikit Image - Exposure
Exposure in an image indicates whether the image appears excessively dark, too bright, or well-balanced in terms of brightness. This characteristic can be estimated by analysing the histogram of intensity values across all the pixels of the image. Enhancing image exposure is a fundamental task in image processing.
Exposure adjustment techniques such as gamma correction, logarithmic correction, and sigmoid correction are used to enhance the quality and visual appeal of images.
The scikit-image library in Python provides the adjust_gamma(), adjust_log(), and adjust_sigmoid() functions in the exposure module. These functions useful to easily apply exposure adjustment techniques like gamma correction, logarithmic correction, and sigmoid correction to images.
Using the skimage.exposure.adjust_gamma() function
The exposure.adjust_gamma() function is used to perform Gamma Correction (also known as Power Law Transform) on an input image. This transformation is applied pixel by pixel, following the formula O = I**gamma, after each pixel is scaled to the range from 0 to 1.
Syntax
Following is the syntax of this function −
skimage.exposure.adjust_gamma(image, gamma=1, gain=1)
Parameters
- image: The input image in the form of an ndarray.
- gamma: A non-negative real number (default value: 1). This parameter determines the exponent for the power-law transformation.
- gain: An optional constant multiplier (default value: 1).
Return Value
It returns the gamma-corrected output image as an ndarray.
It is important to note that, if gamma is greater than 1, the histogram will shift towards the left, resulting in a darker output image compared to the input image. And if gamma is less than 1, the histogram will shift towards the right, leading to a brighter output image compared to the input image.
Example
The following example demonstrates how gamma correction affects the appearance and pixel intensity distribution of an image. The original and gamma-corrected images, along with their histograms, are displayed side by side for visual comparison.
from skimage import io, exposure, img_as_float import matplotlib.pyplot as plt import numpy as np # Load an example image image = io.imread('Images/black rose.jpg') image = img_as_float(image) # Apply gamma correction with gamma = 0.2 gamma_corrected = exposure.adjust_gamma(image, 0.2) # Display the original and gamma_corrected images side by side fig, axes = plt.subplots(2, 2, figsize=(10, 6)) ax = axes.ravel() ax[0].imshow(image, cmap=plt.cm.gray) ax[0].set_title('Original') ax[0].set_axis_off() ax[1].imshow(gamma_corrected, cmap=plt.cm.gray) ax[1].set_title('Gamma Corrected Image') ax[1].set_axis_off() ax[2].hist(image.ravel(), bins=256, histtype='step', color='blue') ax[2].set_xlim(0, 1) ax[2].set_xlabel('Pixel intensity') ax[2].set_yticks([]) ax[2].set_ylabel('Number of pixels') y_min, y_max = ax[2].get_ylim() ax[2].set_yticks(np.linspace(0, y_max, 5)) ax[3].hist(gamma_corrected.ravel(), bins=256, histtype='step', color='blue') ax[3].set_xlim(0, 1) ax[3].set_xlabel('Pixel intensity') ax[3].set_yticks([]) plt.tight_layout() plt.show()
Output
On executing the above program, you will get the following output −

Using the skimage.exposure.adjust_log() function
The function exposure.adjust_log(image, gain=1, inv=False) applies logarithmic correction to an input image. This correction transforms each pixel in the input image according to the following equations:
For logarithmic correction:
O = gain * log(1 + I)
For inverse logarithmic correction:
O = gain * (2**I - 1)
In both cases, the transformation is applied after scaling each pixel to the range between 0 and 1.
Syntax
Following is the syntax of this function −
skimage.exposure.adjust_log(image, gain=1, inv=False)
Parameters
- image: The input image as an ndarray.
- gain: An optional constant multiplier (default value: 1).
- inv: If True, inverse logarithmic correction is performed; otherwise, the correction will be logarithmic (default value: False).
Return Value
It returns the logarithmic corrected image as an ndarray.
Example
The following example demonstrates how logarithmic correction affects the appearance and pixel intensity distribution of an image. The original and logarithmic corrected images, along with their histograms, are displayed side by side for visual comparison.
from skimage import io, exposure, img_as_float import matplotlib.pyplot as plt import numpy as np # Load an example image image = io.imread('Images/black_rose.jpg') image = img_as_float(image) # Apply Logarithmic correction with gain = 2 log_corrected = exposure.adjust_log(image, gain=2) # Display the original and Logarithmic corrected images side by side fig, axes = plt.subplots(2, 2, figsize=(10, 6)) ax = axes.ravel() ax[0].imshow(image, cmap=plt.cm.gray) ax[0].set_title('Original') ax[0].set_axis_off() ax[1].imshow(log_corrected, cmap=plt.cm.gray) ax[1].set_title('Logarithmic Corrected Image') ax[1].set_axis_off() ax[2].hist(image.ravel(), bins=256, histtype='step', color='blue') ax[2].set_xlim(0, 1) ax[2].set_xlabel('Pixel intensity') ax[2].set_yticks([]) ax[2].set_ylabel('Number of pixels') y_min, y_max = ax[2].get_ylim() ax[2].set_yticks(np.linspace(0, y_max, 5)) ax[3].hist(log_corrected.ravel(), bins=256, histtype='step', color='blue') ax[3].set_xlim(0, 1) ax[3].set_xlabel('Pixel intensity') ax[3].set_yticks([]) plt.tight_layout() plt.show()
Output
On executing the above program, you will get the following output −

Using the skimage.exposure.adjust_sigmoid() function
The function skimage.exposure.adjust_sigmoid(image, cutoff=0.5, gain=10, inv=False) performs Sigmoid Correction on an input image. Sigmoid correction is also known as Contrast Adjustment. This correction transforms each pixel in the input image using the following equation:
O = 1 / (1 + exp*(gain * (cutoff - I)))
This transformation is applied after scaling each pixel to the range between 0 and 1.
Syntax
Following is the syntax of this method −
skimage.exposure.adjust_sigmoid(image, cutoff=0.5, gain=10, inv=False)
Parameters
- image: The input image in the form of an ndarray.
- cutoff: An optional parameter that determines the cutoff point of the sigmoid function, shifting the characteristic curve horizontally (default value: 0.5).
- gain: An optional constant multiplier that affects the exponential power of the sigmoid function (default value: 10).
- inv: An optional boolean parameter. If True, it returns the negative sigmoid correction; otherwise, it performs the regular sigmoid correction (default value: False).
Return Value
It returns the sigmoid corrected image as an ndarray.
Example
Here's an example of how to use the exposure.adjust_sigmoid() function to perform sigmoid correction on an image.
from skimage import io, exposure import matplotlib.pyplot as plt # Load an example image image = io.imread('Images/black_rose.jpg') # Apply sigmoid correction sigmoid_corrected = exposure.adjust_sigmoid(image, cutoff=0.6, gain=10) # Display the original and sigmoid-corrected images fig, axes = plt.subplots(1, 2, figsize=(10, 5)) ax = axes.ravel() ax[0].imshow(image, cmap=plt.cm.gray) ax[0].set_title('Original') ax[0].set_axis_off() ax[1].imshow(sigmoid_corrected, cmap=plt.cm.gray) ax[1].set_title('Sigmoid Corrected Image') ax[1].set_axis_off() plt.tight_layout() plt.show()
Output
On executing the above program, you will get the following output −
