
- 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 − Hysteresis Thresholding
Hysteresis is a concept involving delayed or lagging effects, much like inertia. In thresholding, it means that regions above a lower threshold are considered valid if they are connected to regions above a higher, more stringent, threshold. Then they can be seen as extensions of these high-confidence regions.
Hysteresis thresholding, widely used in automatic edge detection, computes both low and high thresholds to generate a final edge map. It provides better results than using single thresholding if the low and high thresholds are reasonably calculated and their thresholded images are processed properly.
The scikit image library provides a function called apply_hysteresis_threshold() within its filter module for applying the Hysteresis thresholding to images.
Using the skimage.filters.apply_hysteresis_threshold() function
The apply_hysteresis_threshold() function is used for applying the hysteresis thresholding to an image.
This algorithm identifies regions in an image where the pixel intensity is either above a high threshold or above a low threshold and is connected to a region with intensity above the high threshold.
Syntax
Following is the syntax of this function −
skimage.filters.apply_hysteresis_threshold(image, low, high)
Parameters
The function accepts the following parameters −
- Image: This parameter should be a grayscale input image, represented as a NumPy array with shape (M, [N, ..., P])
- low: The lower threshold value. It can be a single float value or an array of the same shape as the image.
- high: The higher threshold value. It can be a single float value or an array of the same shape as the image.
Return value
The function returns a thresholded array of boolean values, with the same shape as the input image. In the output array, True indicates the locations where the image's pixel values meet the hysteresis threshold.
Example
Here is an example of applying the apply_hysteresis_threshold() function to perform hysteresis thresholding on an Ndarray −
import numpy as np from skimage.filters import apply_hysteresis_threshold # define an array array = np.array([[1, 2, 4, 2, 1, 3, 1, 3, 2], [2, 4, 1, 2, 3, 2, 4, 1, 3]]) print('Input array:') print(array) # Apply hysteresis thresholding with low=1.5 and high=2.5 thresholded_result = apply_hysteresis_threshold(array, 1.5, 2.5).astype(int) # Print the result print("Array after applying the Hysteresis thresholding with low=1.5 and high=2.5:") print(thresholded_result)
Output
Input array: [[1 2 4 2 1 3 1 3 2] [2 4 1 2 3 2 4 1 3]] Array after applying the Hysteresis thresholding with low=1.5 and high=2.5: [[0 1 1 1 0 1 0 1 1] [1 1 0 1 1 1 1 0 1]]
Example
This example compares normal thresholding to hysteresis thresholding using the apply_hysteresis_threshold() function. Hysteresis thresholding can enhance edge detection by effectively ignoring noise in the image −
import matplotlib.pyplot as plt from skimage import io, filters, color # Load the input image image = io.imread('Images/black rose.jpg') # convert image to grayscale grayscale_image = color.rgb2gray(image) # Apply the Sobel filter to find edges in the image edges = filters.sobel(grayscale_image) # Define the low and high threshold values low = 0.1 high = 0.35 # Apply thresholding to the edges low_thresholded = (edges > low).astype(int) high_thresholded = (edges > high).astype(int) # Apply hysteresis thresholding to the edges hysteresis_thresholded = filters.apply_hysteresis_threshold(edges, low, high) # Plot the original and resultant images fig, ax = plt.subplots(nrows=2, ncols=2, figsize=(10,8)) # Display the original image ax[0, 0].imshow(grayscale_image, cmap='gray') ax[0, 0].set_title('Original image') ax[0, 0].axis('off') # Display the Sobel edges ax[0, 1].imshow(edges, cmap='magma') ax[0, 1].set_title('Sobel edges') ax[0, 1].axis('off') # Display the result of the low threshold ax[1, 0].imshow(low_thresholded, cmap='magma') ax[1, 0].set_title('Low threshold') ax[1, 0].axis('off') # Display the result of the hysteresis threshold ax[1, 1].imshow(high_thresholded + hysteresis_thresholded, cmap='magma') ax[1, 1].set_title('Hysteresis threshold') ax[1, 1].axis('off') plt.tight_layout() plt.show()