
- 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 - Conversion to CIE-LAB Colorspace
The CIELAB color space also referred to as L*a*b*, is a color space defined by the International Commission on Illumination (abbreviated CIE) in 1976. The LAB stands for Lightness, position between red and green, and position between yellow and blue.
It represents colors using three values: L* for perceptual lightness, and a* and b* for the four unique colors of human vision: red, green, blue, and yellow. The primary goal of CIELAB was to create a perceptually uniform color space, where a specific numerical change corresponds to a similar perceived change in color.
It is widely used in various applications, including color image processing, computer vision, color management, and detecting small differences in color.
The Scikit-Image library provides functions like color.rgb2lab(), color.lch2lab(), and color.xyz2lab() to do conversions from RGB, LCH, and XYZ color space to LAB color space.
Converting RGB image to CIE-LAB
The skimage.color.rgb2lab() method is used to perform the conversion of an image from the RGB color space to the CIE Lab color space under the given illuminant and observer.
Syntax
Following is the syntax of this function −
skimage.color.rgb2lab(rgb, illuminant='D65', observer='2', *, channel_axis=-1)
The method accepts the following parameters −
- rgb: It is an array-like object representing the image in RGB format. The shape of the array should be at least 2-D with the last dimension having a size of 3, representing the three channels (Red, Green, and Blue).
- illuminant: An optional string parameter representing the name of the illuminant {A, B, C, D50, D55, D65, D75, E}. The default value is 'D65'.
- Observer: An optional string parameter representing the aperture angle of the observer {2, 10, R}. The default value is '2'.
- channel_axis: An optional parameter indicating which axis of the array corresponds to channels. By default, it is set to -1, which corresponds to the last axis. This parameter was introduced in scikit-image new version 0.19.
The method returns a ndarray representing the output image in Lab format. The dimensions of the output array are the same as the input array.
And the method will raise the ValueError. If the rgb input is not at least 2-D with a shape of (..., 3, ...), indicating the presence of the three channels.
Example
The following example demonstrates the conversion of sRGB color space to the CIE Lab color space using color.rgb2lab() method.
import numpy as np from skimage import color, io, util import matplotlib.pyplot as plt # Read a RGB image rgb_image = io.imread('Images/Fruits.jpg') # Convert RGB to LAB lab_image = color.rgb2lab(rgb_image) # Display the RGB and CIE-LAB images using Matplotlib fig, axes = plt.subplots(nrows=2, ncols=1, figsize=(10, 5)) axes[0].imshow(rgb_image) axes[0].set_title('Input RGB Image') axes[0].axis('off') axes[1].imshow(lab_image) axes[1].set_title('Output CIE-LAB Image') axes[1].axis('off') plt.tight_layout() plt.show()
Output
When you run the above program, it will produce the following output −

Converting XYZ image to CIE-LAB
The skimage.color.xyz2lab method is used to perform the conversion of an image from the XYZ color space to the CIE Lab color space.
Syntax
Following is the syntax of this function −
skimage.color.xyz2lab(xyz, illuminant='D65', observer='2', *, channel_axis=-1)
The method accepts the following parameters −
- xyz (array_like): The input image array in XYZ format. The shape of the array should be at least 2-D with the last dimension having a size of 3, representing the three channels (X, Y, and Z).
- Illuminant: it is an optional string parameter representing the name of the illuminant {A, B, C, D50, D55, D65, D75, E}. The default value is 'D65'.
- Observer: An optional string parameter representing the aperture angle of the observer {2, 10, R}. The default value is '2'.
- channel_axis: An optional parameter indicating which axis of the array corresponds to channels. By default, it is set to -1, which corresponds to the last axis. This parameter was introduced in scikit-image new version 0.19.
The method returns a ndarray representing the output image in CIE Lab format. The dimensions of the output array are the same as the input array.
And the method will raise the ValueError if −
- The xyz input is not at least 2-D with a shape of (..., 3, ...), indicating the presence of the three channels.
- Or, either the illuminant or the observer angle is unsupported or unknown.
Example
The following example demonstrates the conversion of an image from XYZ to CIE-LAB color space using color.xyz2lab() method.
import numpy as np from skimage import color, io import matplotlib.pyplot as plt # Read a XYZ image xyz_image = color.rgb2xyz(io.imread('Images/Fruits.jpg')) # Convert XYZ to LAB lab_image = color.xyz2lab(xyz_image) # Display the XYZ and CIE-LAB images using Matplotlib fig, axes = plt.subplots(nrows=2, ncols=1, figsize=(10, 5)) axes[0].imshow(xyz_image) axes[0].set_title('Input XYZ Image') axes[0].axis('off') axes[1].imshow(lab_image) axes[1].set_title('Output CIE-LAB Image') axes[1].axis('off') plt.tight_layout() plt.show()
Output
On executing the above program, you will get the following output −

Converting LCH image to CIE-LAB
The skimage.color.lch2lab() method is used to perform the conversion of an image from the CIE-LCh color space to the CIE-LAB (Cartesian) color space.
Syntax
Following is the syntax of this function −
skimage.color.lch2lab(lch, *, channel_axis=-1)
The method accepts the following parameters −
- lch (array_like): The input image in CIE-LCh color space. The shape of the array should be at least 3-D with the last dimension having a size of 3, representing the CIE-LCh channels.
- channel_axis: This parameter indicates which axis of the array corresponds to the channels. By default, it is set to -1, which corresponds to the last axis.
The method returns a ndarray representing the output image in CIE Lab format. The dimensions of the output array are the same as the input array. And the method will raise the ValueError if the lch input does not have at least 3 channels.
It's important to note that the lch2lab function assumes the Hue channel (i.e., h) is expressed as an angle in the range (0, 2*pi).
Example
The following example demonstrates the conversion of an image from CIE-LCh color space to CIE-LAB color space using color.lab2lch() method.
import numpy as np from skimage import color, io import matplotlib.pyplot as plt # Read a RGB image as lab lab_image = color.rgb2lab(io.imread('Images/Fruits.jpg')) # Convert LAB to LCH image lch_image = color.lab2lch(lab_image) # Convert LCH to LAB lab_image = color.lch2lab(lch_image) # Display the LCH and CIE-LAB images using Matplotlib fig, axes = plt.subplots(nrows=2, ncols=1, figsize=(10, 5)) axes[0].imshow(lch_image) axes[0].set_title('Input CIE-LCH Image') axes[0].axis('off') axes[1].imshow(lab_image) axes[1].set_title('Output CIE-LAB Image') axes[1].axis('off') plt.tight_layout() plt.show()
Output
On executing the above program, you will get the following output −
