SlideShare a Scribd company logo
Histogram Equalization of Grayscale and Color
Image
Mr. Saeed Ullah
Korean Institute of Science & Technology Information,
University of Science & Technology,
Daejeon, South Korea
Saeedonline12@gmail.com
Indra Kumari
Electronics and Telecommunication Research Institute,
University of Science & Technology,
Daejeon, South Korea
Kumariindra7@etri.re.kr
Summary—This report presents the Histogram Equalization of
Grayscale and Color Image. Tools used in this project are OpenCV
3.2 Library which is a library used for Computer Vision, and Visual
Studio 2015 (64 bit).
I. INTRODUCTION
Histogram is the intensity distribution of an image.
Histograms plots how many times (frequency) each intensity
value in image occurs. By looking at the histogram for a
specific image a viewer will be able to judge the entire tonal
distribution at a glance. A Histogram has two axis the x axis
and the y axis. The x axis contains event whose frequency you
have to count. The y axis contains frequency. An image
histogram is a graphical representation of the number of pixels
in an image as a function of their intensity. Histogram
equalization is used to enhance contrast. It is not necessary that
contrast will always be increase in this. There may be some
cases were histogram equalization can be worse. In that cases
the contrast is decreased.
Consider the following image. Say, depth of the image is 2 bits.
Therefore the value range for each and every pixel is from 0 to
3.
Fig.1. Sample Image (Depth = 2 bits)
Histogram of the image shows how the pixel values are
distributed. As in the above image there are 5 pixels with value
0, 7 pixels with value 1, 9 pixels with value 2 and 4 pixels with
value 3. These information is tabulated as follows.
Fig.2. Intensity Distribution of sample image
Histogram of an image usually presented as a graph. The
following graph represents the histogram of the above image.
Fig.3. Image Histogram
There are various techniques to achieve histogram equalization.
In OpenCV, there is a built OpenCV function to equalize
histogram.
II. OPENCV CODE
i) For Grayscale Image
Mat img = imread("..//data//green.JPG",
CV_LOAD_IMAGE_GRAYSCALE); //open and read the
image in Grayscale Format
Mat img_hist_equalized;
equalizeHist(img, img_hist_equalized);
//equalize the histogram
ii) For Colored Image
Mat img = imread("../data/green.jpg",
CV_LOAD_IMAGE_COLOR); //open and read the
Colored image.
vector<Mat> channels;
Mat img_hist_equalized;
cvtColor(img, img_hist_equalized, CV_BGR2YCrCb);
//change the color image from BGR to YCrCb
format
split(img_hist_equalized, channels); //split the
image into channels
equalizeHist(channels[0], channels[0]);
//equalize histogram on the 1st channel (Y)
merge(channels, img_hist_equalized); //merge 3
channels including the modified 1st channel into
one image
cvtColor(img_hist_equalized, img_hist_equalized,
CV_YCrCb2BGR); //change the color image from
YCrCb to BGR format (to display image properly)
III. RESULTS
Fig. 4. Original Image Fig. 5. Histogram Equalized Image
Fig. 6. Original Image Fig. 7. Histogram Equalized Image
CONCLUSION: - OpenCV provides many built-in functions for
Histograms and Histogram Equalizations, in which some of the
basic functions along with the source code and implementation on
images were discussed in this report.

More Related Content

PDF
Authenticate Aadhar Card Picture with Current Image using Content Based Image...
PDF
A Mat Lab built software application for similar image retrieval
PDF
International Journal of Engineering Research and Development (IJERD)
PDF
Comparative between global threshold and adaptative threshold concepts in ima...
PDF
Visual Cryptography using Image Thresholding
PPTX
Medical image enhancement using histogram processing part2
PDF
44 paper
PDF
A comparative analysis of retrieval techniques in content based image retrieval
Authenticate Aadhar Card Picture with Current Image using Content Based Image...
A Mat Lab built software application for similar image retrieval
International Journal of Engineering Research and Development (IJERD)
Comparative between global threshold and adaptative threshold concepts in ima...
Visual Cryptography using Image Thresholding
Medical image enhancement using histogram processing part2
44 paper
A comparative analysis of retrieval techniques in content based image retrieval

What's hot (17)

PPTX
Digital Image Processing (Lab 08)
PDF
Ijarcet vol-2-issue-3-1280-1284
PDF
Ijetcas14 372
PDF
Quality Assessment of Gray and Color Images through Image Fusion Technique
PDF
IRJET- Histogram Specification: A Review
PDF
Spectral approach to image projection with cubic b spline interpolation
PDF
Basics of image processing using MATLAB
PDF
A Biometric Approach to Encrypt a File with the Help of Session Key
PDF
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHM
PDF
Image segmentation using advanced fuzzy c-mean algorithm [FYP @ IITR, obtaine...
PDF
CONTRAST ENHANCEMENT TECHNIQUES USING HISTOGRAM EQUALIZATION METHODS ON COLOR...
PDF
An enhanced difference pair mapping steganography method to improve embedding...
PPT
Digital image processing lab 1
PDF
A PROPOSED HSV-BASED PSEUDOCOLORING SCHEME FOR ENHANCING MEDICAL IMAGES
PDF
Comparative Analysis of Lossless Image Compression Based On Row By Row Classi...
PPTX
Matlab Working With Images
PDF
IRJET- 3D Vision System using Calibrated Stereo Camera
Digital Image Processing (Lab 08)
Ijarcet vol-2-issue-3-1280-1284
Ijetcas14 372
Quality Assessment of Gray and Color Images through Image Fusion Technique
IRJET- Histogram Specification: A Review
Spectral approach to image projection with cubic b spline interpolation
Basics of image processing using MATLAB
A Biometric Approach to Encrypt a File with the Help of Session Key
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHM
Image segmentation using advanced fuzzy c-mean algorithm [FYP @ IITR, obtaine...
CONTRAST ENHANCEMENT TECHNIQUES USING HISTOGRAM EQUALIZATION METHODS ON COLOR...
An enhanced difference pair mapping steganography method to improve embedding...
Digital image processing lab 1
A PROPOSED HSV-BASED PSEUDOCOLORING SCHEME FOR ENHANCING MEDICAL IMAGES
Comparative Analysis of Lossless Image Compression Based On Row By Row Classi...
Matlab Working With Images
IRJET- 3D Vision System using Calibrated Stereo Camera
Ad

Similar to histogram equalization of grayscale and color image (20)

PDF
Histogram Equalization.pdf
PPTX
Histogram based Enhancement
PPTX
Histogram based enhancement
PPT
Histogram equalization
PPTX
HISTOGRAM_EQUALİZATİON FOR UNDERGRADUATE .pptx
PPTX
Discrete fourier and cosine transform (DCT,DFT)
PPTX
Image Enhacement for the image improvement
PPT
Histogram.ppt Histogram equilization to improve the image quality
PPT
chapter-2.1 Histogram.ppt
PPT
ModuleII.ppt
PPT
ModuleII.ppt
PPT
ModuleII.ppt
PPT
Image processing
PDF
Histogram Operation in Image Processing
PPTX
ch-2.2 histogram image processing .pptx
PPTX
it is dip slide made for bs student an easy way to explain dfdfdfffffff
PPTX
Histograms and Point Operations in Computer Vision
PDF
Image processing lab4.pdf image processing
PDF
ModuleII090.pdf
Histogram Equalization.pdf
Histogram based Enhancement
Histogram based enhancement
Histogram equalization
HISTOGRAM_EQUALİZATİON FOR UNDERGRADUATE .pptx
Discrete fourier and cosine transform (DCT,DFT)
Image Enhacement for the image improvement
Histogram.ppt Histogram equilization to improve the image quality
chapter-2.1 Histogram.ppt
ModuleII.ppt
ModuleII.ppt
ModuleII.ppt
Image processing
Histogram Operation in Image Processing
ch-2.2 histogram image processing .pptx
it is dip slide made for bs student an easy way to explain dfdfdfffffff
Histograms and Point Operations in Computer Vision
Image processing lab4.pdf image processing
ModuleII090.pdf
Ad

More from Saeed Ullah (9)

PDF
downsampling and upsampling of an image using pyramids (pyr up and pyrdown me...
PDF
dilating and eroding in open cv
PDF
line and circle detection using hough transform
PDF
aip shape detection and tracking using contours
PDF
aip edge detection using sobel and canny methods
PDF
captcha formation with warping and random number generation
PDF
aip basic open cv example
PDF
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
PDF
A comprehensive study on nondestructive inspection of reinforced concrete uti...
downsampling and upsampling of an image using pyramids (pyr up and pyrdown me...
dilating and eroding in open cv
line and circle detection using hough transform
aip shape detection and tracking using contours
aip edge detection using sobel and canny methods
captcha formation with warping and random number generation
aip basic open cv example
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
A comprehensive study on nondestructive inspection of reinforced concrete uti...

Recently uploaded (20)

PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPT
Project quality management in manufacturing
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Welding lecture in detail for understanding
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
additive manufacturing of ss316l using mig welding
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
web development for engineering and engineering
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Project quality management in manufacturing
Automation-in-Manufacturing-Chapter-Introduction.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
Welding lecture in detail for understanding
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
additive manufacturing of ss316l using mig welding
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Internet of Things (IOT) - A guide to understanding
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Sustainable Sites - Green Building Construction
OOP with Java - Java Introduction (Basics)
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
web development for engineering and engineering
Lecture Notes Electrical Wiring System Components
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS

histogram equalization of grayscale and color image

  • 1. Histogram Equalization of Grayscale and Color Image Mr. Saeed Ullah Korean Institute of Science & Technology Information, University of Science & Technology, Daejeon, South Korea Saeedonline12@gmail.com Indra Kumari Electronics and Telecommunication Research Institute, University of Science & Technology, Daejeon, South Korea Kumariindra7@etri.re.kr Summary—This report presents the Histogram Equalization of Grayscale and Color Image. Tools used in this project are OpenCV 3.2 Library which is a library used for Computer Vision, and Visual Studio 2015 (64 bit). I. INTRODUCTION Histogram is the intensity distribution of an image. Histograms plots how many times (frequency) each intensity value in image occurs. By looking at the histogram for a specific image a viewer will be able to judge the entire tonal distribution at a glance. A Histogram has two axis the x axis and the y axis. The x axis contains event whose frequency you have to count. The y axis contains frequency. An image histogram is a graphical representation of the number of pixels in an image as a function of their intensity. Histogram equalization is used to enhance contrast. It is not necessary that contrast will always be increase in this. There may be some cases were histogram equalization can be worse. In that cases the contrast is decreased. Consider the following image. Say, depth of the image is 2 bits. Therefore the value range for each and every pixel is from 0 to 3. Fig.1. Sample Image (Depth = 2 bits) Histogram of the image shows how the pixel values are distributed. As in the above image there are 5 pixels with value 0, 7 pixels with value 1, 9 pixels with value 2 and 4 pixels with value 3. These information is tabulated as follows. Fig.2. Intensity Distribution of sample image Histogram of an image usually presented as a graph. The following graph represents the histogram of the above image. Fig.3. Image Histogram There are various techniques to achieve histogram equalization. In OpenCV, there is a built OpenCV function to equalize histogram. II. OPENCV CODE i) For Grayscale Image Mat img = imread("..//data//green.JPG", CV_LOAD_IMAGE_GRAYSCALE); //open and read the image in Grayscale Format Mat img_hist_equalized; equalizeHist(img, img_hist_equalized); //equalize the histogram ii) For Colored Image Mat img = imread("../data/green.jpg", CV_LOAD_IMAGE_COLOR); //open and read the Colored image. vector<Mat> channels; Mat img_hist_equalized; cvtColor(img, img_hist_equalized, CV_BGR2YCrCb); //change the color image from BGR to YCrCb format split(img_hist_equalized, channels); //split the image into channels equalizeHist(channels[0], channels[0]); //equalize histogram on the 1st channel (Y)
  • 2. merge(channels, img_hist_equalized); //merge 3 channels including the modified 1st channel into one image cvtColor(img_hist_equalized, img_hist_equalized, CV_YCrCb2BGR); //change the color image from YCrCb to BGR format (to display image properly) III. RESULTS Fig. 4. Original Image Fig. 5. Histogram Equalized Image Fig. 6. Original Image Fig. 7. Histogram Equalized Image CONCLUSION: - OpenCV provides many built-in functions for Histograms and Histogram Equalizations, in which some of the basic functions along with the source code and implementation on images were discussed in this report.