
- 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 - Using Plugins
A plugin refers to an extension or external software component that can enhance the functionality of the program by adding specific features to it thus improving its functionality.
Plugins in Python Scikit Image
The Python scikit-image (skimage) library comes with a variety of plugins that can be used to handle image IO operations, such as reading, writing, and displaying images. The available plugins in the scikit-image library include popular libraries like Matplotlib, PIL (Python Imaging Library), GDAL, SimpleITK, tifffile, PyFITS, and ImageIO. Each plugin specializes in a specific image IO operation.
The scikit-image library loads the plugins as needed, to ensure optimal performance, and to allow efficient resource utilization. This means that plugins are only loaded when explicitly required or when set as default. This dynamic loading mechanism ensures that only the necessary plugins are loaded, depending on the specific image I/O operation.
Also, the scikit-image library provides a range of functional tools to handle and operate plugins. These tools allow users to customize their image IO operations, lets discuss some key plugin functions available in the skimage.io module.
Listing the available plugins
The function io.find_available_plugins(loaded=False) is used to list the available plugins in scikit-image (skimage.io). And it returns a dictionary with plugin names as keys and exposed functions as values. Following is the syntax of this function −
skimage.io.find_available_plugins(loaded=False)
The parameter "loaded" takes a boolean value. If it is set to True, only the loaded plugins will be shown. By default, all plugins are displayed.
Example 1
The following example demonstrates the use of io.find_available_plugins() function to list all the available plugins and their corresponding exposed functions.
import skimage.io as io # List all available plugins available_plugins = io.find_available_plugins() # Display the plugin names and their exposed functions for plugin_name, exposed_functions in available_plugins.items(): print('Plugin:', plugin_name) print("Exposed Functions:", exposed_functions) print()
Output
Plugin: fits Exposed Functions: ['imread', 'imread_collection'] Plugin: gdal Exposed Functions: ['imread', 'imread_collection'] Plugin: gtk Exposed Functions: ['imshow'] Plugin: imageio Exposed Functions: ['imread', 'imsave', 'imread_collection'] Plugin: imread Exposed Functions: ['imread', 'imsave', 'imread_collection'] Plugin: matplotlib Exposed Functions: ['imshow', 'imread', 'imshow_collection', 'imread_collection'] Plugin: pil Exposed Functions: ['imread', 'imsave', 'imread_collection'] Plugin: qt Exposed Functions: ['imshow', 'imsave', 'imread', 'imread_collection'] Plugin: simpleitk Exposed Functions: ['imread', 'imsave', 'imread_collection'] Plugin: tifffile Exposed Functions: ['imread', 'imsave', 'imread_collection']
Example 2
Let's get the information about loaded plugins only.
from skimage import io # List loaded plugins only available_plugins = io.find_available_plugins(loaded=True) # Display the loaded plugin names and their exposed functions for plugin_name, exposed_functions in available_plugins.items(): print('Plugin:', plugin_name) print("Exposed Functions:", exposed_functions) print()
Output
Plugin: imageio Exposed Functions: ['imread', 'imsave', 'imread_collection'] Plugin: matplotlib Exposed Functions: ['imshow', 'imread', 'imshow_collection', 'imread_collection'] Plugin: tifffile Exposed Functions: ['imread', 'imsave', 'imread_collection']
Retrieving Info about a specific plugin
The function io.plugin_info(plugin) is used to retrieve information about a specific plugin. It returns a dictionary containing information about the plugin, such as the description, and provides nothing but available function names. Following is the syntax of this function −
skimage.io.plugin_info(plugin)
The parameter "plugin" takes a string representing the name of the plugin for which you want to retrieve information.
Example 1
The following example demonstrates how to use the io.plugin_info() function to retrieve the information about the 'pil' plugin.
from skimage import io # Get information about the 'pil' plugin plugin_info = io.plugin_info('pil') # Print the plugin information print("Description:", plugin_info['description']) print("Available Functions:", plugin_info['provides']) print()
Output
Description: Image reading via the Python Imaging Library Available Functions: imread, imsave
Example 2
In this example, we will get information about the 'matplotlib' plugin.
from skimage import io # Get information about the 'matplotlib' plugin plugin_info = io.plugin_info('matplotlib') # Print the plugin information print("Description:", plugin_info['description']) print("Available Functions:", plugin_info['provides']) print()
Output
Description: Display or save images using Matplotlib Available Functions: imshow, imread, imshow_collection, _app_show
Retrieving the plugin order
The io.plugin_order() function is used to obtain the currently preferred plugin order. Following is the syntax of this function −
skimage.io.plugin_order()
The function returns a dictionary with function names as keys and the corresponding values are lists of plugins in the order of preference.
Example
Following is an example of using the plugin_order() function to obtain the currently preferred plugin order.
from skimage import io # Get the currently preferred plugin order order_dict = io.plugin_order() # Print the plugin loading order print("Preferred Plugin Order:") for function_name, plugins in order_dict.items(): print("Function:", function_name) print("Plugins in order of preference:", plugins) print()
Output
Preferred Plugin Order: Function: imread Plugins in order of preference: ['imageio', 'matplotlib'] Function: imsave Plugins in order of preference: ['imageio'] Function: imshow Plugins in order of preference: ['matplotlib'] Function: imread_collection Plugins in order of preference: ['imageio', 'matplotlib'] Function: imshow_collection Plugins in order of preference: ['matplotlib'] Function: _app_show Plugins in order of preference: ['matplotlib']
Setting the default plugin
The io.use_plugin() function is used to set the default plugin for a specified operation.
The specified plugin will be loaded if it hasn't been loaded already. Following is the syntax of this function −
skimage.io.use_plugin(name, kind=None)
Here are the parameters of this function −
- name − A string representing the name of the plugin is to be set as the default.
- kind (optional) − A string represents the specific function for which the plugin is being set. It can take one of the following values: 'imsave', 'imread', 'imshow', 'imread_collection', 'imshow_collection'. By default, the plugin is set for all functions.
Example
The following example shows the change in the plugin loading order after setting the default plugin.
from skimage import io # Get the currently preferred plugin order order_dict_1 = io.plugin_order() # Print the plugin loading order print("Plugin Order before Setting the default plugin:") for function_name, plugins in order_dict_1.items(): print(function_name) print("Plugin order:", plugins) print() # Set the default plugin for all functions io.use_plugin('qt') # Get the preferred plugin order after setting the default plugin order_dict_2 = io.plugin_order() # Print the plugin loading order print("Plugin Order after setting the default plugin: ") for function_name, plugins in order_dict_2.items(): print(function_name) print("Plugin order:", plugins) print()
Output
Plugin Order before Setting the default plugin: imread Plugin order: ['imageio', 'matplotlib'] imsave Plugin order: ['imageio'] imshow Plugin order: ['matplotlib'] imread_collection Plugin order: ['imageio', 'matplotlib'] imshow_collection Plugin order: ['matplotlib'] _app_show Plugin order: ['matplotlib'] Plugin Order after setting the default plugin: imread Plugin order: ['qt', 'imageio', 'matplotlib'] imsave Plugin order: ['qt', 'imageio'] imshow Plugin order: ['qt', 'matplotlib'] imread_collection Plugin order: ['qt', 'imageio', 'matplotlib'] imshow_collection Plugin order: ['matplotlib'] _app_show Plugin order: ['qt', 'matplotlib']
Resetting the plugin to its default state
The function io.reset_plugins() is used to reset the plugin state to its default/initial state. i.e., where no plugins are loaded. Following is the syntax of this function −
skimage.io.reset_plugins()
Example
The following example demonstrates the use of io.reset_plugins() function to reset the plugin state to its default state. And it retrieves the plugin order before and after resetting the plugin state to the default.
from skimage import io # Get the currently preferred plugin order order_dict_1 = io.plugin_order() # Print the plugin loading order print("Plugin Order before Resetting to the default state:") for function_name, plugins in order_dict_1.items(): if function_name == 'imread': print('Function',function_name) print("Plugin order:", plugins) print() # Reset the plugin state to the default io.reset_plugins() # Get the preferred plugin order after Resetting to the default state order_dict_2 = io.plugin_order() # Print the plugin loading order print("Plugin Order after Resetting to the default state: ") for function_name, plugins in order_dict_2.items(): if function_name == 'imread': print('Function',function_name) print("Plugin order:", plugins) print()
Output
Plugin Order before Resetting to the default state: Function imread Plugin order: ['pil', 'imageio', 'matplotlib'] Plugin Order after Resetting to the default state: Function imread Plugin order: ['imageio', 'matplotlib']
Appropriate plugin for a specific function
The io.call_plugin() function is used to find the appropriate plugin for a specified function and execute it. Following is the syntax of this function −
skimage.io.call_plugin(kind, *args, **kwargs)
Here are the parameters of this function −
- kind (str) − The function to look up. It can take one of the following values: 'imshow', 'imsave', 'imread', 'imread_collection'.
- plugin (str, optional) − The specific plugin to load. If not provided (default is None), the first matching plugin will be used.
- *args, **kwargs − Additional arguments and keyword arguments that will be passed to the plugin function.
Example
The following example demonstrates the use of io.call_plugin() function to load an image file using the appropriate plugin for the image reading function.
import numpy as np from skimage import io img_array = io.call_plugin('imread', 'Images_/black rose.jpg') print("Image Arary Shape:",img_array.shape)
Output
Image Arary Shape: (2848, 4272, 3)
The function loads the image file and returns it as a NumPy array, which is assigned to the img_array variable.