
- 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
Texture Classification Using Multi-Block Local Binary Pattern
Multi-Block Local Binary Pattern (MB-LBP) is an extension of the Local Binary Pattern (LBP) technique that allows computation on multiple scales efficiently using the integral image. In MB-LBP, an image is divided into nine equally sized rectangles, and a feature is computed for each of these rectangles. This feature is determined by comparing the sum of pixel intensities within each rectangle to that of the central rectangle, similar to how LBP operates.
The calculation of MB-LBP features follows a similar concept to local binary patterns (LBPs), with the key difference being that summed blocks are used instead of individual pixel values.
The scikit image library offers the multiblock_lbp() function within its feature module to compute multi-block local binary patterns.
Using the skimage.feature.multiblock_lbp() function
The skimage.feature.multiblock_lbp() function is used to compute the Multi-Block Local Binary Pattern (MB-LBP) feature descriptor.
Syntax
The syntax of the function is as follows −
skimage.feature.multiblock_lbp(int_image, r, c, width, height)
Parameters
Here are the parameters of this function −
int_image (N, M) array: This parameter represents the input integral image.
r (int): The row-coordinate of the top-left corner of a rectangle containing the feature.
c (int): The column-coordinate of the top-left corner of a rectangle containing the feature.
width (int): The width of one of the nine equal rectangles that will be used to compute a feature.
height (int): The height of one of the nine equal rectangles that will be used to compute a feature.
The function returns an 8-bit MB-LBP feature descriptor as an integer.
Example
First, let's generate an image to demonstrate how MB-LBP works. We'll consider a (9, 9) rectangle divided into (3, 3) blocks, and then apply MB-LBP to it using the multiblock_lbp() function.
from skimage.feature import multiblock_lbp import numpy as np from numpy.testing import assert_equal from skimage.transform import integral_image # Create a test matrix where the first and fifth rectangles starting # from the top-left corner clockwise have greater values than the central one. test_img = np.zeros((9, 9), dtype='uint8') test_img[3:6, 3:6] = 1 test_img[:3, :3] = 50 test_img[6:, 6:] = 50 # The first and fifth bits should be filled. This correct value will # be compared to the computed one. correct_answer = 0b10001000 int_img = integral_image(test_img) # Compute the MB-LBP code for the specified rectangle lbp_code = multiblock_lbp(int_img, 0, 0, 3, 3) print("Computed MB-LBP Code:", bin(lbp_code)) print("Correct MB-LBP Code:", bin(correct_answer)) # Compare the computed value to the correct one using assert_equal try: assert_equal(correct_answer, lbp_code) # If the assertion doesn't raise an exception, the values match print('Computed value and the correct one are the same.') except AssertionError: # If the assertion raises an exception, the values don't match print("Computed value and the correct one are not the same.")
Output
Computed MB-LBP Code: 0b10001000 Correct MB-LBP Code: 0b10001000 Computed value and the correct one are the same.
Example
Now, let's apply the operator to a real image and visualize the results.
from skimage import io, data from matplotlib import pyplot as plt from skimage.feature import multiblock_lbp from skimage.feature import draw_multiblock_lbp from skimage.transform import integral_image # Load a input image test_img = io.imread('Images/black-doted-butterflies.jpg', as_gray=True) # Calculate the integral image for efficient computation int_img = integral_image(test_img) # Compute the MB-LBP code for a specified rectangle lbp_code = multiblock_lbp(int_img, 0, 0, 90, 90) # Draw the MB-LBP visualization on the image img = draw_multiblock_lbp(test_img, 0, 0, 90, 90, lbp_code=lbp_code, alpha=0.5)# Display the resulting image with MB-LBP visualization plt.imshow(img) plt.show()
Output

In the plot above, we observe the outcome of computing an MB-LBP feature and visualizing the computed results. The rectangles with a lower sum of intensity values than the central rectangle are highlighted in cyan, while those with higher intensity values are shown in white. The central rectangle remains untouched.