
- 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 - Rotating an image
Rotating an image refers to the process of changing the orientation of the image by a certain angle around a specified point. This transformation rotates the image's pixels, rearranging them in a way that the entire image appears as if it has been rotated. When an image is rotated, each pixel is moved to a new position based on the specified rotation angle and the center point of rotation.
Rotation is a common image transformation used in various applications, including computer vision, graphics, and image processing. It can be applied for a variety of purposes, such as image alignment, object recognition, image visualization, and image augmentation in machine learning.
The Scikit-image library provides the skimage.transform.rotate() function to perform image rotation. It takes an input image, the desired rotation angle (in degrees), and optional parameters to control the behaviour of the rotation.
Using the skimage.transform.rotate() function
The rotate() function is used to rotate an input image by a certain angle around a specified center or its own center.
Syntax
Following is the syntax of this function −
skimage.transform.rotate(image, angle, resize=False, center=None, order=None, mode='constant', cval=0, clip=True, preserve_range=False)
Parameters
- image: Input image to be rotated.
- angle (float): Rotation angle in degrees in the counter-clockwise direction.
- resize (bool, optional): Determines whether the shape of the output image will be automatically calculated so that the complete rotated image exactly fits. The default value is False.
- center (iterable of length 2): The rotation center. This parameter defines the center point around which the image will be rotated. If the center is set to None, the image is rotated around its own center, which is calculated as (cols / 2 - 0.5, rows / 2 - 0.5), where cols and rows are the width and height of the input image, respectively. Please note that the center parameter uses (cols, rows) ordering, which is different from the usual (rows, cols) ordering in skimage and other libraries.
- order (int, optional): The order of spline interpolation used during the rotation. The default value is 0 if the image.dtype is bool and 1 otherwise. The order must be in the range 0-5.
- mode (str, optional): Determines how points outside the boundaries of the input image are filled. It can take one of the following values: {constant, edge, symmetric, reflect, wrap}.
- cval (float, optional): Used in conjunction with mode 'constant', it specifies the value to be used for filling points outside the image boundaries. The default value is 0.
- clip (bool, optional): Specifies whether to clip the output to the range of values of the input image. Setting the clip to True (default) ensures that the output image does not have values beyond the input range.
- preserve_range (bool, optional): Specifies whether to keep the original range of pixel values in the output image. If set to False, the input image is converted according to the conventions of img_as_float.
Return Value
It returns the rotated image as an ndarray, which is the rotated version of the input image.
Example
Here's an example of how to use the skimage.transform.rotate() function to rotate an image.
import numpy as np import matplotlib.pyplot as plt from skimage import io, transform # Load the input image image = io.imread('Images/Tajmahal.jpg') # Rotate the image by 45 degrees counter-clockwise around its center angle = 45 rotated_image = transform.rotate(image, angle, resize=True) # Display the original and rotated images side by side fig, axes = plt.subplots(1, 2, figsize=(10, 5)) axes[0].imshow(image) axes[0].set_title('Original Image') axes[1].imshow(rotated_image) axes[1].set_title('Rotated Image (Angle = 45)') # Show the plot plt.tight_layout() plt.show()
Output
On executing the above program, you will get the following output −

Example
Here's another example that demonstrates how to use skimage.transform.rotate() to rotate an image by a specified angle(clockwise direction) around a custom center point.
import numpy as np import matplotlib.pyplot as plt from skimage import io, transform # Load the input image image = io.imread('Images/Tajmahal.jpg') # Define the rotation angle and center point angle = -45 center = (image.shape[1] // 2, image.shape[0] // 2) # Center point as (x, y) # Rotate the image by the specified angle around the custom center rotated_image = transform.rotate(image, angle, center=center, resize=True) # Display the original and rotated images side by side fig, axes = plt.subplots(1, 2, figsize=(10, 5)) axes[0].imshow(image) axes[0].set_title('Original Image') axes[1].imshow(rotated_image) axes[1].set_title('Rotated Image (Angle = -45)') # Show the plot plt.tight_layout() plt.show()
Output
On executing the above program, you will get the following output −
