Histogram equalization

Similar documents
Image Processing. 2. Point Processes. Computer Engineering, Sejong University Dongil Han. Spatial domain processing

Image processing. Image formation. Brightness images. Pre-digitization image. Subhransu Maji. CMPSCI 670: Computer Vision. September 22, 2016

Recovering highlight detail in over exposed NEF images

TDI2131 Digital Image Processing

Image Enhancement: Histogram Based Methods

Computer Vision. Intensity transformations

RGB colours: Display onscreen = RGB

Digital Image Processing. Lecture # 3 Image Enhancement

Preparing Remote Sensing Data for Natural Resources Mapping (image enhancement, rectifications )

Computer Programming

Image Processing Lecture 4

Computer Graphics Fundamentals

Digital Image Processing. Lecture # 4 Image Enhancement (Histogram)

Simulating Simple Reaction Mechanisms

The Noise about Noise

SECTION I - CHAPTER 2 DIGITAL IMAGING PROCESSING CONCEPTS

Chapter 3 Part 2 Color image processing

4/9/2015. Simple Graphics and Image Processing. Simple Graphics. Overview of Turtle Graphics (continued) Overview of Turtle Graphics

DIGITAL IMAGE PROCESSING Quiz exercises preparation for the midterm exam

December 28, Dr. Praveen Sankaran (Department of ECE NIT Calicut DIP)

from: Point Operations (Single Operands)

Image Enhancement using Histogram Equalization and Spatial Filtering

What are the chances?

Image Classification (Decision Rules and Classification)

DIGITAL PROCESSING METHODS OF IMAGES AND SIGNALS IN ELECTROMAGNETIC INFILTRATION PROCESS

Lane Detection in Automotive

Estimation of Debonded Area in Bearing Babbitt Metal by C-Scan Method

Revised 9/10/2015 Page 1 of 5

Programmatic Image Alterations Creating Your Own: Actions and Programs. Automation

PASS Sample Size Software

CMPSC 390 Visual Computing Spring 2014 Bob Roos Review Notes Introduction and PixelMath

CS 200 Assignment 3 Pixel Graphics Due Monday May 21st 2018, 11:59 pm. Readings and Resources

Determining MTF with a Slant Edge Target ABSTRACT AND INTRODUCTION

Prof. Feng Liu. Fall /04/2018

ADJUSTMENT LAYERS TUTORIAL

LAB 2: Sampling & aliasing; quantization & false contouring

Introduction to DSP ECE-S352 Fall Quarter 2000 Matlab Project 1

GE 113 REMOTE SENSING. Topic 7. Image Enhancement

Assignment: Light, Cameras, and Image Formation

Lane Detection in Automotive

EMVA1288 compliant Interpolation Algorithm

More than one meteorite impact during the total lunar eclipse of January 21, 2019?

Instruction Manual. Mark Deimund, Zuyi (Jacky) Huang, Juergen Hahn

How to correct a contrast rejection. how to understand a histogram. Ver. 1.0 jetphoto.net

Using QuickBird Imagery in ESRI Software Products

Chapter 12 Image Processing

Spatial Domain Processing and Image Enhancement

CS 445 HW#2 Solutions

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

Exercise 4-1 Image Exploration

Histogram equalization

Histograms and Tone Curves

USE OF HISTOGRAM EQUALIZATION IN IMAGE PROCESSING FOR IMAGE ENHANCEMENT

FTA SI-640 High Speed Camera Installation and Use

CS 376A Digital Image Processing

Histograms and Color Balancing

Link Models for Circuit Switching

Applying mathematics to digital image processing using a spreadsheet

A Basic Guide to Photoshop CS Adjustment Layers

DIGITAL IMAGE PROCESSING (COM-3371) Week 2 - January 14, 2002

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

X9 REGISTRY FOR CHECK IMAGE TESTS

Filtering. Image Enhancement Spatial and Frequency Based

ECC419 IMAGE PROCESSING

Unit 8: Color Image Processing

Image Enhancement in Spatial Domain

Digital Image Processing CSL 783 REPORT

Hello, welcome to the video lecture series on Digital Image Processing.

Index of Command Functions

What is real? What is art?

Color and More. Color basics

Implementation. Objective. Priorities. Goals. Constraints. Properties

3.9 Event Logo Primary version

1 Equations for the Breathing LED Indicator

Fig Color spectrum seen by passing white light through a prism.

An Advanced Contrast Enhancement Using Partially Overlapped Sub-Block Histogram Equalization

A Basic Guide to Photoshop Adjustment Layers

Digital Image Processing

ImageJ, A Useful Tool for Image Processing and Analysis Joel B. Sheffield

FLIR Camera Adjustments <9hz Boson

In order to manage and correct color photos, you need to understand a few

Estimating with Square Roots

APPLICATION OF COMPUTER VISION FOR DETERMINATION OF SYMMETRICAL OBJECT POSITION IN THREE DIMENSIONAL SPACE

Understanding Apparent Increasing Random Jitter with Increasing PRBS Test Pattern Lengths

Adapted from the Slides by Dr. Mike Bailey at Oregon State University

Color Correction and Enhancement

Supplementary Figure 1. Schematic setup for preparation of a splay aligned film. (i)

Image Enhancement (from Chapter 13) (V6)

Name Class Date. Introducing Probability Distributions

IMAGE ENHANCEMENT - POINT PROCESSING

Applications of satellite and airborne image data to coastal management. Part 2

Visible Light Communication-based Indoor Positioning with Mobile Devices

Understanding Color Theory Excerpt from Fundamental Photoshop by Adele Droblas Greenberg and Seth Greenberg

CS 200 Assignment 3 Pixel Graphics Due Tuesday September 27th 2016, 9:00 am. Readings and Resources

MEASUREMENT OF ROUGHNESS USING IMAGE PROCESSING. J. Ondra Department of Mechanical Technology Military Academy Brno, Brno, Czech Republic

Experiment 1 Introduction to MATLAB and Simulink

Laboratory 1: Uncertainty Analysis

BRAIN FRACTAL ANALYSIS USER S GUIDE

Lecture 4: Spatial Domain Processing and Image Enhancement

Mod. 2 p. 1. Prof. Dr. Christoph Kleinn Institut für Waldinventur und Waldwachstum Arbeitsbereich Fernerkundung und Waldinventur

Transcription:

Histogram equalization Contents Background... 2 Procedure... 3 Page 1 of 7

Background To understand histogram equalization, one must first understand the concept of contrast in an image. The contrast is defined as the difference in color or intensity between two objects in an image. If the contrast is too low, it is impossible to distinguish between two objects and they are seen as a single object. In Figure 1, the contrast is high and it is easy to separate the black from the gray. In Figure 2, it becomes much more difficult to separate the gray from the darker gray. This is because the colors are very close to each other and the human eye starts to treat the two colors as one. Figure 1 Figure 2 These two images can be regarded as having a resolution of 1x2 pixels. For the simplicity, this paper only discusses 8-bit grayscale images where the intensity can vary between and 255. This means that each pixel only have one intensity value and no color value. By looking at Figure 1, one sees that the right pixel is completely black and thus has an intensity of and the left pixel is quite bright with an intensity of 238. In Figure 2, the two pixels have the intensity values 238 and 228. There are many different formulas for calculating contrast but the main point is that, the larger difference in intensity, the larger is the contrast. To visualize the contrast in an image in another way than just looking at an image, an intensity histogram can be used. An intensity histogram is a histogram containing the distribution of all the possible intensities. An 8-bit image has 256 different intensity values and thus the x-axis will contain 256 different values and the y-axis will display how many of each intensity values there are. A typical intensity histogram from an 8-bit grayscale image could look like the histogram in Figure 3. 125 1 75 5 25 1 16 31 46 61 76 91 16 121 136 151 166 181 196 211 226 241 256 Figure 3 Page 2 of 7

This intensity histogram is a typical example of a good histogram which means that almost all of the pixels are used. This is good because the whole available range of intensities contributes to the image. Representing a color image in a histogram can be a little more difficult, and it is probably easiest to create three histograms, one for red, one for green and one for blue, this is outside the scope of this paper. Another example histogram is seen in Figure 4. The image corresponding to this histogram looks a little different than the image in the previous example. In this histogram, the pixels are much more concentrated at intensities in the middle of the spectrum. All pixels are between 95 and 18. The available intensity values outside of this range are not used. One can draw the conclusion that the contrast in this image is low because only a portion of the available pixel values are used. No point in having a large range when only a small portion of it is used. 125 1 75 5 25 1 16 31 46 61 76 91 16 121 136 151 166 181 196 211 226 241 256 Figure 4 Images having a histogram similar to the one seen in Figure 4 can be difficult for the human eye to look at. This is because the human eye is sensitive to intensity in a nonlinear manner while the sensor responsible for capturing the light works in a more linear fashion. To give the human eye best possible conditions, the image can be altered so that all the available pixel intensities are used. This is known as histogram equalization. Procedure The mathematical procedure for mapping the image pixels to new pixels values that will increase the overall contrast in the image is quite straightforward. The intensity of a pixel is represented by i and the available intensities are i L-1 where L for an 8-bit image would be 256, the available intensities are in that case to 255. An intensity (i) value of L-1 is considered as white and an i value of is considered Page 3 of 7

black. It would be good to have a function that based on the intensity value in a pixel and how many times that intensity value occurs assign a new intensity value to this pixel, this function is declared T(i). s = T(i), i L 1 Equation 1 The value s is the new pixel value based on the old pixel value. It is now clear that histogram equalization manipulates data and if one would perform histogram equalization on a grayscale image where the pixel values represented some kind of temperature, the new pixel values would have a different temperature. With better overall contrast, but nevertheless, a temperature that doesn t represent the true temperature, but rather a software assigned temperature. The function T(i) should be monotonically increasing on the interval i L-1. The demand for it to be monotonically increasing exists so that one can be assured that no pixel intensities can be reversed. For example, T(1)=5 and T(11)=4 should not be possible. Another restriction is T(i) -L, so that the range of intensities is the same in the original image and the output image. The intensity values in an image can be regarded as random variables that can have any value between and L-1. This random event has a so called cumulative distribution function (CDF) associated to itself. This function describes the likelihood that the random variable will be assigned a value less or equal to a specific value. For example, when one throws a dice the probability that the dice will end up showing a value of 2 or less than 2 is 1/6 + 1/6 = 2/6. Which means that CDF(dice 2) = probability(dice=1) + probability(dice=2). CDF(i t) = p k Equation 2 Equation 2 describes the CDF for the probability that a pixel has the intensity equal or lower than t. The probability that a random pixel has the intensity value k is the number of pixels with the intensity k divided by the total number of pixels, see Equation 3. t k= probability that a random pixel has the intensity k = P k = Equation 3 amount of pixels with intensity k total number of pixels The values are often normalized, so that p + p 1 + + p L-1 =1. The total probability that any pixel has an intensity value in the acceptable range ( i L-1) is of course 1. The goal is to create some transformation s=t(i) that creates a new image with a histogram more resembling Figure 3 than Figure 4. This means that the CDF should be more of a linear function rather than a strict increasing function as Equation 2. An image with its grayscale values and the corresponding histogram is seen in Figure 5 and Figure 6. This image has a range from to 9, which means that i 9. Page 4 of 7

6 2 3 4 5 5 5 6 7 5 5 6 4 8 6 4 7 4 3 4 8 5 6 6 7 8 6 4 2 1 2 3 4 5 6 7 8 9 Figure 5 Figure 6 The histogram of the image tells the user that most of the pixels have values around 5. One can create a table containing every intensity value and how many pixels that containing this value, this is seen in Table 1. The intensity values can be regarded as temperature generated by a thermal camera. 1 2 1 3 2 4 5 5 6 6 6 7 3 8 2 9 Table 1 Frequency Table 1 shows the same information as the histogram but it may be easier to understand if one looks at the table. Using Equation 3, the following values can be created: P = 25 = P 1 = 25 = P 2 = 1 25 =.4 P 3 = 2 25 =.8 P 4 = 5 25 =.2 P 5 = 6 25 =.24 P 6 = 6 25 =.24 P 7 = 3 25 =.12 P 8 = 2 25 =.8 P 9 = 25 = Equation 4 A check for counting errors can be made by summing all the probability values and confirming that the sum equals 1, which it does. Now comes the transformation part, the transformation T(i) is given by Equation 5. Page 5 of 7

s = T(i) = floor((l 1) p k ) = floor(9 p k ) i k= Equation 5 Where floor is the nearest integer down, 7.3 will be 7, 4.7 will be 4 and so on. This transformation uses the probability value for each intensity value and the available range to create a new pixel value (s) for every old pixel value (i). Using Equation 4 and Equation 5, it is possible to create Table 2. i T(i) 1 2 3 1 4 2 5 5 6 7 7 8 8 9 9 9 Table 2 Table 2 is the desired mapping from the input image to the output image and the new image is seen in fig. Bear in mind that the intensity values, 1 and 9 are nowhere to be found in the input image but are included anyway. The resulting image and its histogram can be found in Figure 7 and Figure 8. i k= 7 1 2 5 5 5 7 8 5 5 7 2 9 7 2 8 2 1 2 9 5 7 7 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 Figure 7 Figure 8 The resulting images histogram is much better distributed across the whole range and this will result in a much higher overall contrast across all pixels. If one would apply a grayscale palette to Figure 5 and Figure 7, the result would look like Figure 9 and Figure 1. Page 6 of 7

Figure 9 Figure 1 It could also be of interest to plot the transformation function which gives the user an intuitive way of seeing what is happening to the pixel values. In Figure 11 the transformation function is seen. Figure 11 The transformed image seen in Figure 1 has higher contrast than the original image but the pixel values have changed which means that information is lost. This one has to remember when using histogram equalization. Page 7 of 7