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

Similar documents
Digital Image Processing. Lecture # 3 Image Enhancement

TDI2131 Digital Image Processing

Histogram equalization

Image Enhancement: Histogram Based Methods

Computer Vision. Intensity transformations

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

Digital Image Processing

Image Enhancement using Histogram Equalization and Spatial Filtering

Lecture 4: Spatial Domain Processing and Image Enhancement

8. Statistical properties of grayscale images

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

Image Enhancement in Spatial Domain

Image Processing for Mechatronics Engineering For senior undergraduate students Academic Year 2017/2018, Winter Semester

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

ECC419 IMAGE PROCESSING

IMAGE ENHANCEMENT - POINT PROCESSING

Last Lecture. Lecture 2, Point Processing GW , & , Ida-Maria Which image is wich channel?

BBM 413 Fundamentals of Image Processing. Erkut Erdem Dept. of Computer Engineering Hacettepe University. Point Operations Histogram Processing

Filtering. Image Enhancement Spatial and Frequency Based

BBM 413 Fundamentals of Image Processing. Erkut Erdem Dept. of Computer Engineering Hacettepe University. Point Operations Histogram Processing

Contrast Enhancement Using Bi-Histogram Equalization With Brightness Preservation

Part I Feature Extraction (1) Image Enhancement. CSc I6716 Spring Local, meaningful, detectable parts of the image.

ANALYSIS OF IMAGE ENHANCEMENT TECHNIQUES USING MATLAB

Image Processing for feature extraction

BBM 413! Fundamentals of! Image Processing!

Computer Vision. Howie Choset Introduction to Robotics

Introduction. Computer Vision. CSc I6716 Fall Part I. Image Enhancement. Zhigang Zhu, City College of New York

Spatial Domain Processing and Image Enhancement

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

CS 445 HW#2 Solutions

from: Point Operations (Single Operands)

Reading Instructions Chapters for this lecture. Computer Assisted Image Analysis Lecture 2 Point Processing. Image Processing

Computer Programming

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

Fuzzy Statistics Based Multi-HE for Image Enhancement with Brightness Preserving Behaviour

Digital Image Processing. Lecture # 8 Color Processing

SECTION I - CHAPTER 2 DIGITAL IMAGING PROCESSING CONCEPTS

Digital Image Processing CSL 783 REPORT

IMAGE ENHANCEMENT IN SPATIAL DOMAIN

Histogram equalization

Image enhancement. Image enhancement belongs to image preprocessing

Non Linear Image Enhancement

CS 89.15/189.5, Fall 2015 ASPECTS OF DIGITAL PHOTOGRAPHY COMPUTATIONAL. Image Processing Basics. Wojciech Jarosz

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

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

Frequency Domain Enhancement

EE 168 Handout # Introduction to Digital Image Processing February 5, 2012 HOMEWORK 3 SOLUTIONS

Image Enhancement by using Biogeography Based Optimization

EFFICIENT CONTRAST ENHANCEMENT USING GAMMA CORRECTION WITH MULTILEVEL THRESHOLDING AND PROBABILITY BASED ENTROPY

Histogram Equalization: A Strong Technique for Image Enhancement

Computer Graphics Fundamentals

Keywords-Image Enhancement, Image Negation, Histogram Equalization, DWT, BPHE.

Digital Image Processing

Digital Image Processing. Lecture 5 (Enhancement) Bu-Ali Sina University Computer Engineering Dep. Fall 2009

Midterm Review. Image Processing CSE 166 Lecture 10

Image Contrast Enhancement Techniques: A Comparative Study of Performance

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Image enhancement. Image enhancement belongs to image preprocessing

CS 376A Digital Image Processing

Digital Image Processing

Statistics, Probability and Noise

Digital Image Processing. Lecture # 6 Corner Detection & Color Processing

USE OF HISTOGRAM EQUALIZATION IN IMAGE PROCESSING FOR IMAGE ENHANCEMENT

Chapter 12 Image Processing

IMAGE PROCESSING: POINT PROCESSES

Introduction to Color Theory

Image restoration and color image processing

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

EE482: Digital Signal Processing Applications

What is an image? Bernd Girod: EE368 Digital Image Processing Pixel Operations no. 1. A digital image can be written as a matrix

Image Processing. Adam Finkelstein Princeton University COS 426, Spring 2019

Image Enhancement in the Spatial Domain

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

RESEARCH PROJECT TECHNICAL UNIVERSITY - SOFIA BACHELOR OF TELECOMUNICATIONS DEGREE FACULTY OF TELECOMMUNICATIONS

Joint Distributions, Independence Class 7, Jeremy Orloff and Jonathan Bloom

GE 113 REMOTE SENSING. Topic 7. Image Enhancement

Image Enhancement in spatial domain. Digital Image Processing GW Chapter 3 from Section (pag 110) Part 2: Filtering in spatial domain

RGB colours: Display onscreen = RGB

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

Image Enhancement using Histogram Approach

A simple Technique for contrast stretching by the Addition, subtraction& HE of gray levels in digital image

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

To process an image so that the result is more suitable than the original image for a specific application.

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

BBM 413 Fundamentals of Image Processing. Erkut Erdem Dept. of Computer Engineering Hacettepe University. Point Operations Histogram Processing

Reference Free Image Quality Evaluation

Image Enhancement in the Spatial Domain (Part 1)

Sampling and Reconstruction. Today: Color Theory. Color Theory COMP575

Image Processing Lecture 4

Bi-Level Weighted Histogram Equalization with Adaptive Gamma Correction

BBM 413 Fundamentals of Image Processing. Point Operations Histogram Processing. Today s topics. Digital images. Today s topics

Chapter 2 Image Enhancement in the Spatial Domain

Solution for Image & Video Processing

Image analysis. CS/CME/BIOPHYS/BMI 279 Fall 2015 Ron Dror

Multimedia Systems Giorgio Leonardi A.A Lectures 14-16: Raster images processing and filters

Digital Image Fundamentals and Image Enhancement in the Spatial Domain

Histogram and Its Processing

Weaving Density Evaluation with the Aid of Image Analysis

Histogram and Its Processing

Transcription:

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

Histogram of a Grayscale Image Let I be a 1-band (grayscale) image. I(r,c) is an 8-bit integer between 0 and 255. Histogram, h I, of I: a 256-element array, h I h I (g) = number of pixels in I that have value g. for g = 0,1, 2, 3,, 255 2

HISTOGRAM A discrete function h(r k )=n k r k is the k th gray level n k is the number of pixels having gray level r k in the image Ex: n k 0 1 2 3 1 3 3 0 0 1 3 0 3 0 3 1 6 5 4 3 2 1 0 1 2 3 r k 3

4 UNIQUENESS

Histogram of a Grayscale Image Histogram of a digital image with gray levels in the range [0,L-1] is a discrete function Where r k = k th gray level h( r ) k n k n k = number of pixels in the image having gray level r k h(r k ) = histogram of an image having r k gray levels 5

Normalized Histogram Dividing each of histogram at gray level r k by the total number of pixels in the image, n p( r ) n / n for k 0,1,, L 1 k k p(r k ) gives an estimate of the probability of occurrence of gray level r k The sum of all components of a normalized histogram is equal to 1 6

Histogram of a Grayscale Image 16-level (4-bit) image lower RHC: number of pixels with intensity g black marks pixels with intensity g 7

Histogram of a Grayscale Image Black marks pixels with intensity g Plot of histogram: number of pixels with intensity g 8

Histogram of a Grayscale Image Black marks pixels with intensity g Plot of histogram: number of pixels with intensity g 9

Histogram of a Grayscale Image hi g the number of pixels in I with graylevel g. 10

Histogram of a Color Image If I is a 3-band image then I(r,c,b) is an integer between 0 and 255. I has 3 histograms: h R (g) = # of pixels in I(:,:,1) with intensity value g h G (g) = # of pixels in I(:,:,2) with intensity value g h B (g) = # of pixels in I(:,:,3) with intensity value g 11

Histogram of a Color Image There is one histogram per color band R, G, & B. Luminosity histogram is from 1 band = (R+G+B)/3 12

Histogram of a Color Image 13

Histogram of a Color Image 14

Histogram: Example Dark Image How would the histograms of these images look like? Bright Image 15

Histogram: Example Dark image Components of histogram are concentrated on the low side of the gray scale Bright image Components of histogram are concentrated on the high side of the gray scale 16

17 HISTOGRAM INSIGHT INTO CONTRAST

Histogram: Example Low Contrast Image How would the histograms of these images look like? High Contrast Image 18

Histogram: Example Low contrast image Histogram is narrow and centered toward the middle of the gray scale High contrast image Histogram covers broad range of the gray scale and the distribution of pixels is not too far from uniform with very few vertical lines being much higher than the others 19

Contrast Stretching Improve the contrast in an image by `stretching' the range of intensity values it contains to span a desired range of values, e.g. the the full range of pixel values 20

0 127 255 Contrast Stretching If r max and r min are the maximum and minimum gray level of the input image and L is the total gray levels of output image, the transformation function for contrast stretch will be s T r r r L 1 ( ) ( min ) rmax rmin L 0 r min 127 r max 255 21

Contrast Stretching 22

Histogram Equalization Histogram equalization re-assigns the intensity values of pixels in the input image such that the output image contains a uniform distribution of intensities 23

24 HISTOGRAM EQUALIZATION

AERIAL PHOTOGRAPH OF THE PENTAGON 25 Resulting image uses more of dynamic range. Resulting histogram almost, but not completely, flat.

The Probability Distribution Function Let 255 g0 I A h g Note that since I with value g, hi g of an Image is the number of pixels in A is the number of pixels in I. That is if I is R rows by C columns then A RC. Then, 1 pi g hi g A This is the probability that an arbitrary pixel from I has value g. 26

The Probability Distribution Function of an Image p(g) is the fraction of pixels in an image that have intensity value g. p(g) is the probability that a pixel randomly selected from the given image has intensity value g. Whereas the sum of the histogram h(g) over all g from 0 to 255 is equal to the number of pixels in the image, the sum of p(g) over all g is 1. p is the normalized histogram of the image 27

The Cumulative Distribution Function of an Image Let q = I(r,c) be the value of a randomly selected pixel from I. Let g be a specific gray level. The probability that q g is given by g g 1 P g p h I I I 0 A 0 g 0 255 0 h h I I, where h I (γ ) is the histogram of image I. This is the probability that any given pixel from I has value less than or equal to g. 28

The Cumulative Distribution Function of an Image Let q = I(r,c) be the value of a randomly selected pixel from I. Let g be a specific gray level. The probability that q g is given by g g 1 P g p h I I I 0 A 0 g 0 255 0 h h I I, Also called CDF for Cumulative Distribution Function. where h I (γ ) is the histogram of image I. This is the probability that any given pixel from I has value less than or equal to g. 29

The Cumulative Distribution Function of an Image P(g) is the fraction of pixels in an image that have intensity values less than or equal to g. P(g) is the probability that a pixel randomly selected from the given band has an intensity value less than or equal to g. P(g) is the cumulative (or running) sum of p(g) from 0 through g inclusive. P(0) = p(0) and P(255) = 1; 30

Histogram Equalization Task: remap image I so that its histogram is as close to constant as possible Let PI be the cumulative (probability) distribution function of I. The CDF itself is used as the LUT. 31

Histogram Equalization pdf The CDF (cumulative distribution) is the LUT for remapping. CDF 32

Histogram Equalization pdf The CDF (cumulative distribution) is the LUT for remapping. LUT 33

Histogram Equalization pdf The CDF (cumulative distribution) is the LUT for remapping. LUT 34

Histogram Equalization 35

Histogram Equalization Luminosity before J r, c 255 PI I r, c. after 36

HISTOGRAM EQUALIZATION IMPLEMENTATION 0 0 0 0 0 2 2 2 2 2 1 1 1 1 4 4 4 4 4 5 4 5 6 6 6 5 5 7 7 7 8 8 8 8 9 9 9 9 9 9 Gray levels 0 1 2 3 4 5 6 7 8 9 Counts (h(r k )) 5 4 0 0 2 1 3 0 4 1 r 0 r 1 r 2 r 3 r 4 r 5 r 6 Normalized h (P(r k )) 5/20 4/20 0 0 2/20 1/20 3/20 0 4/20 1/20 cdf F(r k ) 5/20 9/20 11/20 12/20 15/20 19/20 20/20 s k =round(9 F(r k )) 2 4 5 5 7 9 9 s 0 s 1 s 2 s 3 s 4 s 5 s 6 37

Histogram Equalization: Example An 8x8 image 38

Histogram Equalization: Example Fill in the following table/histogram Image Histogram (Non-zero values) 39

Histogram Equalization: Example Image Histogram (Non-zero values shown) 40

Histogram Equalization: Example 41

Histogram Equalization: Example Cumulative Distribution Function (cdf) Image Histogram/Prob Mass Function 42

Histogram Equalization: Example Cumulative Distribution Function (cdf) 43

Histogram Equalization: Example Cumulative Distribution Function (cdf) 44

Histogram Equalization: Example Normalized Cumulative Distribution Function (cdf) Divide each value by total number of pixels (64) to get the normalized cdf 45

Histogram Equalization: Example If cdf is normalized If cdf is NOT normalized s s J r, c 255 PI I r, c. s round(255. cdf ( r)) cdf () r round (255. ) M N round (255. 46 / 64 ) s 183 Original Image 183 46

Histogram Equalization: Example 47

Histogram Equalization: Example Original Image Corresponding histogram (red) and cumulative histogram (black) Image after histogram equalization Corresponding histogram (red) and cumulative histogram (black) 48

Bright image Dark image Histogram Equalization: Example Equalized Histogram Equalized Histogram 49

High Contrast Low contrast Histogram Equalization: Example Equalized Histogram Equalized Histogram 50

HISTOGRAM MATCHING (SPECIFICATION) HISTOGRAM EQUALIZATION DOES NOT ALLOW INTERACTIVE IMAGE ENHANCEMENT AND GENERATES ONLY ONE RESULT: AN APPROXIMATION TO A UNIFORM HISTOGRAM. SOMETIMES THOUGH, WE NEED TO BE ABLE TO SPECIFY PARTICULAR HISTOGRAM SHAPES CAPABLE OF HIGHLIGHTING CERTAIN GRAY-LEVEL RANGES. 54

HISTOGRAM SPECIFICATION 55

HISTOGRAM SPECIFICATION THE PROCEDURE FOR HISTOGRAM-SPECIFICATION BASED ENHANCEMENT IS: EQUALIZE THE LEVELS OF THE ORIGINAL IMAGE USING: s T( r k ) k j0 n j n n: total number of pixels, nj: number of pixels with gray level rj, L: number of discrete gray levels 56

HISTOGRAM SPECIFICATION SPECIFY THE DESIRED DENSITY FUNCTION AND OBTAIN THE TRANSFORMATION FUNCTION G(z): v k k k pz zi sk G z i0 pz: specified desirable PDF for output 57

HISTOGRAM SPECIFICATION THE NEW, PROCESSED VERSION OF THE ORIGINAL IMAGE CONSISTS OF GRAY LEVELS CHARACTERIZED BY THE SPECIFIED DENSITY p z (z). In essence: z G 1 ( s) z G 1 [ T( r)] 58

59 MAPPINGS

HISTOGRAM SPECIFICATION OBTAIN THE HISTOGRAM OF THE GIVEN IMAGE MAP EACH LEVEL r K TO A LEVEL S K OBTAIN THE TRANSFORMATION FUNCTION G FROM THE GIVEN P Z (Z) PRECOMPUTE Z K FOR EACH VALUE OF S K FOR EACH PIXEL IN THE ORIGINAL IMAGE, IF THE VALUE OF THAT PIXEL IS r k MAP THIS VALUE TO ITS CORRESPONDING LEVEL S K, THEN MAP LEVEL S K INTO THE FINAL VALUE Z K 60

HISTOGRAM SPECIFICATION k n k p r (r k ) s k p z (z k ) v k n k 0 790 0.19 0.19 0 0 0 1 1023 0.25 0.44 0 0 0 2 850 0.21 0.65 0 0 0 3 656 0.16 0.81 0.15 0.15 790 4 329 0.08 0.89 0.2 0.35 1023 5 245 0.06 0.95 0.3 0.65 850 6 122 0.03 0.98 0.2 0.85 985 7 81 0.02 1.0 0.15 1.0 448 A 64X64 (4096 PIXELS) IMAGE WITH 8 GRAY LEVELS 61

62 IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

63 IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

64

GLOBAL/LOCAL HISTOGRAM EQUALIZATION IT MAY BE NECESSARY TO ENHANCE DETAILS OVER SMALL AREAS IN THE IMAGE THE NUMBER OF PIXELS IN THESE AREAS MAY HAVE NEGLIGIBLE INFLUENCE ON THE COMPUTATION OF A GLOBAL TRANSFORMATION WHOSE SHAPE DOES NOT NECESSARILY GUARANTEE THE DESIRED LOCAL ENHANCEMENT DEVISE TRANSFORMATION FUNCTIONS BASED ON THE GRAY LEVEL DISTRIBUTION IN THE NEIGHBORHOOD OF EVERY PIXEL IN THE IMAGE THE PROCEDURE IS: DEFINE A SQUARE (OR RECTANGULAR) NEIGHBORHOOD AND MOVE THE CENTER OF THIS AREA FROM PIXEL TO PIXEL. AT EACH LOCATION, THE HISTOGRAM OF THE POINTS IN THE NEIGHBORHOOD IS COMPUTED AND EITHER A HISTOGRAM EQUALIZATION OR HISTOGRAM SPECIFICATION TRANSFORMATION FUNCTION IS OBTAINED. THIS FUNCTION IS FINALLY USED TO MAP THE GRAY LEVEL OF THE PIXEL CENTERED IN THE NEIGHBORHOOD. THE CENTER IS THEN MOVED TO AN ADJACENT PIXEL LOCATION AND THE PROCEDURE IS REPEATED. 65

66 GLOBAL/LOCAL HISTOGRAM EQUALIZATION

USE OF HISTOGRAM STATISTICS FOR IMAGE ENHANCEMENT (Global) LET r REPRESENT A GRAY LEVEL IN THE IMAGE [0, L-1], AND LET p(r i ) DENOTE THE NORMALIZED HISTOGRAM COMPONENT CORRESPONDING TO THE i th VALUE OF r. THE n th MOMENT OF r ABOUT ITS MEAN IS DEFINED AS n L 1 i0 r r m pr WHERE m IS THE MEAN VALUE OF r (AVERAGE GRAY LEVEL) i n i m L 1 0 r p r i i i 67

USE OF HISTOGRAM STATISTICS FOR IMAGE ENHANCEMENT (Global) THE SECOND MOMENT IS GIVEN BY L r r m pr 2 i0 WHICH IS THE VARIANCE OF r 1 MEAN AS A MEASURE OF AVERAGE GRAY LEVEL IN THE IMAGE VARIANCE AS A MEASURE OF AVERAGE CONTRAST i 2 i 68

USE OF HISTOGRAM STATISTICS FOR IMAGE ENHANCEMENT (Local) LET (x,y) BE THE COORDINATES OF A PIXEL IN AN IMAGE, AND LET S X,Y DENOTE A NEIGBORHOOD OF SPECIFIED SIZE, CENTERED AT (x,y) THE MEAN VALUE m SXY OF THE PIXELS IN S X,Y IS m THE GRAY LEVEL VARIANCE OF THE PIXELS IN REGION S X,Y IS GIVEN BY r p r sxy s, t s, t s, t S xy S 2 2 r s t ms p r xy, s, s, t S xy xy t 69

USE OF HISTOGRAM STATISTICS FOR IMAGE ENHANCEMENT THE GLOBAL MEAN AND VARIANCE ARE MEASURED OVER AN ENTIRE IMAGE AND ARE USEFUL FOR GROSS ADJUSTMENTS OF OVERALL INTENSITY AND CONTRAST. A USE OF THESE MEASURES IN LOCAL ENHANCEMENT IS, WHERE THE LOCAL MEAN AND VARIANCE ARE USED AS THE BASIS FOR MAKING CHANGES THAT DEPEND ON IMAGE CHARACTERISTICS IN A PREDEFINED REGION ABOUT EACH PIXEL IN THE IMAGE. 70

71 TUNGSTEN FILAMENT IMAGE

USE OF HISTOGRAM STATISTICS FOR IMAGE ENHANCEMENT A PIXEL AT POINT (x,y) IS CONSIDERED IF: m SXY k 0 M G, where k0 is a positive constant less than 1.0, and M G is global mean σ sxy k 2 D G, where D G is the global standard deviation and k 2 is a positive constant k 1 D G σ sxy,, with k1 < k2 A PIXEL THAT MEETS ALL ABOVE CONDITIONS IS PROCESSED SIMPLY BY MULTIPLYING IT BY A SPECIFIED CONSTANT, E, TO INCREASE OR DECREASE THE VALUE OF ITS GRAY LEVEL RELATIVE TO THE REST OF THE IMAGE. THE VALUES OF PIXELS THAT DO NOT MEET THE ENHANCEMENT CONDITIONS ARE LEFT UNCHANGED. 72

73 IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

74 IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

Readings from Book (3 rd Edn.) 3.3 Histogram

Material in these slides has been taken from, the following resources Acknowledgements Digital Image Processing, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley, 2008 76