Normalize an Image in OpenCV Python Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Normalization involves adjusting the range of pixel intensity values in an image. Normalization can be beneficial for various purposes, such as improving the contrast or making the image more suitable for processing by other algorithms. In this article, we will explore how to normalize images using OpenCV in Python. What is Image Normalization?Image normalization is the process of adjusting the pixel intensity values of an image to a predefined range. This range is typically between 0 and 255 for images with 8-bit depth, where 0 represents black and 255 represents white. Normalization can be performed to improve the contrast of an image or to standardize the pixel values for further processing. In OpenCV Python, the normalize() function from the cv2 module is used to normalize images. This function allows us to specify the desired range for the pixel intensity values. Normalize an Image in OpenCV PythonBelow are some of the examples by which we can understand about normalizing images in OpenCV Python: Example 1: Normalizing Grayscale ImageIn this example, a grayscale image is read and normalized to enhance contrast using the NORM_MINMAX normalization method. Both the original and normalized images are displayed using OpenCV imshow() function. Python import cv2 # Read grayscale image image = cv2.imread('kl.png', cv2.IMREAD_GRAYSCALE) # Normalize image normalized_image = cv2.normalize( image, None, alpha=0, beta=255, norm_type=cv2.NORM_MINMAX) # Display original and normalized images cv2.imshow('Original Image', image) cv2.imshow('Normalized Image', normalized_image) cv2.waitKey(0) cv2.destroyAllWindows() Output: Example 2: Normalizing Color ImageIn this example, a color image is converted to grayscale, then normalized to enhance contrast. The normalized grayscale image is converted back to color and displayed alongside the original image using OpenCV. Python import cv2 # Read color image image = cv2.imread('kl.png') # Convert image to grayscale gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Normalize grayscale image normalized_gray_image = cv2.normalize( gray_image, None, alpha=0, beta=255, norm_type=cv2.NORM_MINMAX) # Convert normalized grayscale image back to color normalized_color_image = cv2.cvtColor( normalized_gray_image, cv2.COLOR_GRAY2BGR) # Display original and normalized images cv2.imshow('Original Image', image) cv2.imshow('Normalized Image', normalized_color_image) cv2.waitKey(0) cv2.destroyAllWindows() Output: Create Quiz Comment R rs736tjxi Follow 0 Improve R rs736tjxi Follow 0 Improve Article Tags : Computer Vision OpenCV Explore Introduction to Computer VisionComputer Vision - Introduction 4 min read A Quick Overview to Computer Vision 3 min read Applications of Computer Vision 6 min read Fundamentals of Image Formation 7 min read Satellite Image Processing 2 min read Image Formats 5 min read Image Processing & TransformationDigital Image Processing Basics 7 min read Difference Between RGB, CMYK, HSV, and YIQ Color Models 3 min read Image Enhancement Techniques using OpenCV - Python 15+ min read Image Transformations using OpenCV in Python 5 min read How to find the Fourier Transform of an image using OpenCV Python? 5 min read Python | Intensity Transformation Operations on Images 5 min read Histogram Equalization in Digital Image Processing 5 min read Python - Color Inversion using Pillow 4 min read Image Sharpening using Laplacian, High Boost Filtering in MATLAB 3 min read Wand sharpen() function - Python 2 min read Python OpenCV - Smoothing and Blurring 7 min read Python PIL | GaussianBlur() method 1 min read Apply a Gauss filter to an image with Python 2 min read Spatial Filtering and its Types 3 min read Python PIL | MedianFilter() and ModeFilter() method 1 min read Python | Bilateral Filtering 2 min read Python OpenCV - Morphological Operations 5 min read Erosion and Dilation of images using OpenCV in Python 3 min read Introduction to Resampling methods 8 min read Python | Image Registration using OpenCV 3 min read Feature Extraction and DescriptionFeature Extraction Techniques - NLP 10 min read SIFT Interest Point Detector Using Python - OpenCV 4 min read Feature Matching using Brute Force in OpenCV 13 min read Feature detection and matching with OpenCV-Python 5 min read Feature matching using ORB algorithm in Python-OpenCV 3 min read Mahotas - Speeded-Up Robust Features 2 min read Create Local Binary Pattern of an image using OpenCV-Python 5 min read Deep Learning for Computer VisionImage Classification using CNN 5 min read What is Transfer Learning? 8 min read Top 5 PreTrained Models in Natural Language Processing (NLP) 7 min read ML | Introduction to Strided Convolutions 2 min read Dilated Convolution 5 min read Continuous Kernel Convolution 6 min read CNN | Introduction to Pooling Layer 5 min read CNN | Introduction to Padding 5 min read What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow? 14 min read Convolutional Neural Network (CNN) Architectures 11 min read Deep Transfer Learning - Introduction 8 min read Introduction to Residual Networks 4 min read Residual Networks (ResNet) - Deep Learning 9 min read ML | Inception Network V1 4 min read Understanding GoogLeNet Model - CNN Architecture 3 min read Image Recognition with Mobilenet 4 min read VGG-16 | CNN model 6 min read Autoencoders in Machine Learning 7 min read How Autoencoders works ? 6 min read Difference Between Encoder and Decoder 9 min read Implementing an Autoencoder in PyTorch 4 min read Generative Adversarial Network (GAN) 11 min read Deep Convolutional GAN with Keras 9 min read StyleGAN - Style Generative Adversarial Networks 5 min read Object Detection and RecognitionDetect an object with OpenCV-Python 4 min read Haar Cascades for Object Detection - Python 3 min read R-CNN - Region-Based Convolutional Neural Networks 8 min read YOLO v2 - Object Detection 7 min read Face recognition using Artificial Intelligence 15+ min read Deep Face Recognition 8 min read ML | Face Recognition Using Eigenfaces (PCA Algorithm) 4 min read Emojify using Face Recognition with Machine Learning 7 min read Object Detection with Detection Transformer (DETR) by Facebook 7 min read Image SegmentationImage Segmentation Using TensorFlow 5 min read Thresholding-Based Image Segmentation 7 min read Region and Edge Based Segmentation 4 min read Image Segmentation with Watershed Algorithm - OpenCV Python 9 min read Mask R-CNN | ML 9 min read 3D ReconstructionPython OpenCV - Depth map from Stereo Images 2 min read Top 7 Modern-Day Applications of Augmented Reality (AR) 10 min read Virtual Reality, Augmented Reality, and Mixed Reality 3 min read Camera Calibration with Python - OpenCV 4 min read Python OpenCV - Pose Estimation 7 min read 40+ Top Computer Vision Projects [2025 Updated] 4 min read Like