
- 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 - Tinting gray - scale images
Tinting an image refers to the process of adding a specific color or shade to an image to change its appearance. This process can be used to create artistic effects and highlight specific regions of an image.
Tinting grayscale images is a common image-processing technique for adding color to a black-and-white image. This process is typically achieved by manipulating the color channels of an image, often represented in the RGB color space.
In the RGB color space, a color image is represented as three 2D arrays corresponding to the Red (R), Green (G), and Blue (B) channels of the image. Each pixel in these arrays stores information about the intensity of that color channel at that particular location in the image. In grayscale images, these channels are usually the same, resulting in shades of gray.
Tinting the gray-scale images
One common method to achieve a tinted image involves adjusting the RGB channels by applying different scaling factors derived from the grayscale version of the image. For instance, by multiplying the green and blue channels by 0, it effectively removes those channels and leaves only the red channel. Likewise, when you eliminate the blue channel by multiplying it by 0, you're left with just the red and green channels, resulting in a yellow appearance as these two channels combine.
Example
The following example demonstrates how to use multipliers to artificially tint grayscale images in Python.
import matplotlib.pyplot as plt from skimage import io from skimage import color from skimage import img_as_float, img_as_ubyte # Load a grayscale image input_image = io.imread('Images/flowers.jpg', as_gray=True) grayscale_image = img_as_float(input_image) # Convert the grayscale image to a color image (RGB) image = color.gray2rgb(grayscale_image) # Define color multipliers for red and yellow tints # Red tint: R=1, G=0, B=0 red_multiplier = [1, 0, 0] # Yellow tint: R=1, G=1, B=0 yellow_multiplier = [1, 1, 0] # Create a figure with two subplots, side by side fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5)) ax1.imshow(red_multiplier * image) ax1.set_title('Red-tinted image') ax1.set_axis_off() # Display the yellow-tinted image in the second subplot ax2.imshow(yellow_multiplier * image) ax2.set_title('Yellow-tinted image') ax2.set_axis_off() plt.show()Output
On executing the above program, you will get the following output −
Example
This example demonstrates how to use numpy slicing and fancy indexing to selectively tint the image regions.
from skimage.filters import rank import matplotlib.pyplot as plt from skimage import io from skimage import color from skimage import img_as_float, img_as_ubyte import numpy as np # Load a grayscale image input_image = io.imread('Images/flowers.jpg', as_gray=True) grayscale_image = img_as_float(input_image) # Convert the grayscale image to a color image (RGB) image = color.gray2rgb(grayscale_image) # Define square regions using slices for the first two dimensions. top_left = (slice(100),) * 2 bottom_right = (slice(-100, None),) * 2 # Create a copy of the original image sliced_image = image.copy() # Define color multipliers for red and yellow tints # Red tint: R=1, G=0, B=0 red_multiplier = [1, 0, 0] # Yellow tint: R=1, G=1, B=0 yellow_multiplier = [1, 1, 0] # Apply red multiplier to the top-left square region. sliced_image[top_left] = image[top_left] * red_multiplier # Apply yellow multiplier to the bottom-right square region. sliced_image[bottom_right] = image[bottom_right] * yellow_multiplier # Calculate a mask for regions with interesting texture using entropy filtering. noisy = rank.entropy(img_as_ubyte(grayscale_image), np.ones((9, 9))) textured_regions = noisy > 4.25 # Copy the original image for selective tinting based on texture. masked_image = image.copy() # Apply tinting to the textured regions. masked_image[textured_regions, :] *= red_multiplier # Create subplots for displaying the two selectively tinted images. fig, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(12, 6)) ax1.imshow(sliced_image) ax1.set_title('Square regions tinted Image') ax1.set_axis_off() ax2.imshow(masked_image) ax2.set_title('Image with texture-based selective tinting') ax2.set_axis_off() plt.show()Output
On executing the above program, you will get the following output −
