
- SciPy - Home
- SciPy - Introduction
- SciPy - Environment Setup
- SciPy - Basic Functionality
- SciPy - Relationship with NumPy
- SciPy Clusters
- SciPy - Clusters
- SciPy - Hierarchical Clustering
- SciPy - K-means Clustering
- SciPy - Distance Metrics
- SciPy Constants
- SciPy - Constants
- SciPy - Mathematical Constants
- SciPy - Physical Constants
- SciPy - Unit Conversion
- SciPy - Astronomical Constants
- SciPy - Fourier Transforms
- SciPy - FFTpack
- SciPy - Discrete Fourier Transform (DFT)
- SciPy - Fast Fourier Transform (FFT)
- SciPy Integration Equations
- SciPy - Integrate Module
- SciPy - Single Integration
- SciPy - Double Integration
- SciPy - Triple Integration
- SciPy - Multiple Integration
- SciPy Differential Equations
- SciPy - Differential Equations
- SciPy - Integration of Stochastic Differential Equations
- SciPy - Integration of Ordinary Differential Equations
- SciPy - Discontinuous Functions
- SciPy - Oscillatory Functions
- SciPy - Partial Differential Equations
- SciPy Interpolation
- SciPy - Interpolate
- SciPy - Linear 1-D Interpolation
- SciPy - Polynomial 1-D Interpolation
- SciPy - Spline 1-D Interpolation
- SciPy - Grid Data Multi-Dimensional Interpolation
- SciPy - RBF Multi-Dimensional Interpolation
- SciPy - Polynomial & Spline Interpolation
- SciPy Curve Fitting
- SciPy - Curve Fitting
- SciPy - Linear Curve Fitting
- SciPy - Non-Linear Curve Fitting
- SciPy - Input & Output
- SciPy - Input & Output
- SciPy - Reading & Writing Files
- SciPy - Working with Different File Formats
- SciPy - Efficient Data Storage with HDF5
- SciPy - Data Serialization
- SciPy Linear Algebra
- SciPy - Linalg
- SciPy - Matrix Creation & Basic Operations
- SciPy - Matrix LU Decomposition
- SciPy - Matrix QU Decomposition
- SciPy - Singular Value Decomposition
- SciPy - Cholesky Decomposition
- SciPy - Solving Linear Systems
- SciPy - Eigenvalues & Eigenvectors
- SciPy Image Processing
- SciPy - Ndimage
- SciPy - Reading & Writing Images
- SciPy - Image Transformation
- SciPy - Filtering & Edge Detection
- SciPy - Top Hat Filters
- SciPy - Morphological Filters
- SciPy - Low Pass Filters
- SciPy - High Pass Filters
- SciPy - Bilateral Filter
- SciPy - Median Filter
- SciPy - Non - Linear Filters in Image Processing
- SciPy - High Boost Filter
- SciPy - Laplacian Filter
- SciPy - Morphological Operations
- SciPy - Image Segmentation
- SciPy - Thresholding in Image Segmentation
- SciPy - Region-Based Segmentation
- SciPy - Connected Component Labeling
- SciPy Optimize
- SciPy - Optimize
- SciPy - Special Matrices & Functions
- SciPy - Unconstrained Optimization
- SciPy - Constrained Optimization
- SciPy - Matrix Norms
- SciPy - Sparse Matrix
- SciPy - Frobenius Norm
- SciPy - Spectral Norm
- SciPy Condition Numbers
- SciPy - Condition Numbers
- SciPy - Linear Least Squares
- SciPy - Non-Linear Least Squares
- SciPy - Finding Roots of Scalar Functions
- SciPy - Finding Roots of Multivariate Functions
- SciPy - Signal Processing
- SciPy - Signal Filtering & Smoothing
- SciPy - Short-Time Fourier Transform
- SciPy - Wavelet Transform
- SciPy - Continuous Wavelet Transform
- SciPy - Discrete Wavelet Transform
- SciPy - Wavelet Packet Transform
- SciPy - Multi-Resolution Analysis
- SciPy - Stationary Wavelet Transform
- SciPy - Statistical Functions
- SciPy - Stats
- SciPy - Descriptive Statistics
- SciPy - Continuous Probability Distributions
- SciPy - Discrete Probability Distributions
- SciPy - Statistical Tests & Inference
- SciPy - Generating Random Samples
- SciPy - Kaplan-Meier Estimator Survival Analysis
- SciPy - Cox Proportional Hazards Model Survival Analysis
- SciPy Spatial Data
- SciPy - Spatial
- SciPy - Special Functions
- SciPy - Special Package
- SciPy Advanced Topics
- SciPy - CSGraph
- SciPy - ODR
- SciPy Useful Resources
- SciPy - Reference
- SciPy - Quick Guide
- SciPy - Cheatsheet
- SciPy - Useful Resources
- SciPy - Discussion
SciPy - Ndimage
The SciPy ndimage module is part of the scipy.ndimage sub-package which provides functions for image processing with focus on multi-dimensional (n-dimensional) arrays.
This module is very useful for scientific and engineering applications where multi-dimensional image or array processing is required. It contains various operations such as filters, transformations, measurements and more that work on n-dimensional arrays.
Features of ndimage module of SciPy
Following are the main features of ndimage module of SciPy −
- Filtering: Smooth or enhance images with the help of Gaussian filters, median filters, etc.
- Morphological Operations: Operations such as dilation, erosion, etc which are commonly used in image analysis.
- Labeling and Measurements: For labeling connected regions in an array and performing region-based measurements.
- Geometric transformations: We can perform Rotation, zoom, affine transformations, etc.
- Interpolation: The Ndimage module is used for resampling arrays or images.
- Convolution and Correlation: This module is helpful for applying custom kernels to the data.
Functions in ndimage Module
The Scipy ndimage module provides different functions which operate on N-dimensional arrays and are widely used for tasks such as filtering, interpolation, transformation and measurement in fields such as image processing, computer vision and scientific computing.
Following are the various functions of the scipy.ndimage module −
S.No. | Function & Description |
---|---|
1 |
scipy.ndimage.convolve() Convolve an input array with a given kernel (filter). |
2 |
scipy.ndimage.gaussian_filter() Apply a Gaussian filter for smoothing (blur) an image. |
3 |
scipy.ndimage.median_filter() Apply a median filter for noise reduction, especially salt-and-pepper noise. |
4 |
scipy.ndimage.rotate() Rotate an input image or n-dimensional array by a specified angle (in degrees). |
5 |
scipy.ndimage.zoom() Rescale (zoom) an array by a specified factor. |
6 |
scipy.ndimage.binary_erosion() Perform erosion on a binary image (shrinking). |
7 |
scipy.ndimage.binary_dilation() Perform dilation on a binary image (expanding). |
8 |
scipy.ndimage.binary_opening() Perform binary opening i.e., erosion followed by dilation. |
9 |
scipy.ndimage.binary_closing() Perform binary closing i.e., dilation followed by erosion. |
10 |
scipy.ndimage.label() Label connected components in a binary image or multi-dimensional array. |
11 |
scipy.ndimage.distance_transform_edt() Compute the Euclidean distance transform of a binary image. |
12 |
scipy.ndimage.interpolate() Perform interpolation when resizing an array or image. |
13 |
scipy.ndimage.fourier_gaussian() Apply a Gaussian filter in the Fourier domain. |
14 |
scipy.ndimage.fourier_shift() Apply a shift in the frequency domain. |
15 |
scipy.ndimage.mean() Compute the mean of values in an array for each labeled region. |
16 |
scipy.ndimage.variance() Compute the variance for each labeled region in an array. |
17 |
scipy.ndimage.standard_deviation() Compute the standard deviation for each labeled region in an array. |
18 |
scipy.ndimage.find_objects() Return slice objects corresponding to the labeled regions in an array. |
19 |
scipy.ndimage.grey_erosion() Shrinks bright regions in the image. |
20 |
scipy.ndimage.grey_dilation() Expands bright regions in the image. |
21 |
scipy.ndimage.correlate() Performs cross-correlation with a user-defined kernel. |
22 |
scipy.ndimage.generic_gradient_magnitude() Computes the gradient magnitude using a custom gradient function. |
23 |
scipy.ndimage.prewitt() Computes the Prewitt gradient which is similar to Sobel but with simpler kernels. |
24 |
scipy.ndimage.sobel() Computes the Sobel gradient of the image along a specified axis. |
25 |
scipy.ndimage.laplace() Computes the Laplacian of the image to detect edges. |
Applications of Ndimage module
The scipy.ndimage module has a wide range of applications across various fields because to its versatile image processing and multi-dimensional data manipulation capabilities. Following are the applications of scipy.ndimage module −
Application | Key Functions used | Use Cases |
---|---|---|
Noise Reduction | gaussian_filter, median_filter | Smoothing noisy images, pre-processing for edge detection. |
Edge Detection | sobel, prewitt, laplace | Object boundary detection in images. |
Geometric Transformations | rotate, zoom, shift, affine_transform | Resizing, aligning or augmenting image data. |
Morphological Operations | binary_erosion, binary_dilation | Removing noise or filling holes in binary images. |
Object Segmentation | label, distance_transform_edt | Isolating objects for measurement or analysis. |
Interpolation and Resampling | map_coordinates, zoom | Resizing images or realigning multi-modal data. |
Data Measurement | center_of_mass, sum, mean | Quantitative analysis of labeled regions. |