Contrast Enhancement - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Contrast Enhancement

Description:

Fac. of Comp., Eng. & Tech. Staffordshire University. Outline. Introduction. Histogram ... Typically contains counts of pixels at each pixel amplitude (e.g. ... – PowerPoint PPT presentation

Number of Views:149
Avg rating:3.0/5.0
Slides: 21
Provided by: claudecch
Category:

less

Transcript and Presenter's Notes

Title: Contrast Enhancement


1
Imaging and Special Effects CE00376-2
Fac. of Comp., Eng. Tech. Staffordshire
University
Contrast Enhancement
Dr. Claude C. Chibelushi
2
Outline
  • Introduction
  • Histogram
  • Histogram stretch
  • Histogram equalisation
  • Summary

3
Introduction
or
Contrast enhancement
4
Introduction
  • Contrast enhancement
  • changes amplitude of pixels to cover wider range
  • possible techniques
  • histogram stretch
  • histogram equalisation
  • spatial coverage of information used for
    transformation
  • global based on whole image
  • local based on part of image

5
Histogram
  • Typically contains counts of pixels at each pixel
    amplitude (e.g. grey level)
  • can provide local / global information about
    image
  • hence sometimes used for image transformation
  • e.g. contrast enhancement
  • Many types of histograms
  • other image attributes can also be counted
  • e.g. edge orientation

6
Histogram
  • 1D array
  • size equal to the number of grey levels

Grey level
int histogramIM_DEPTH
7
Histogram
  • Implementation
  • for (row 0 row lt IM_HEIGHT row)
  • for (col 0 col lt IM_WIDTH col)
  • pixVal imagerowcol
  • histogrampixVal

Requires initialisation to 0
8
Histogram
  • Alternative implementation
  • for (row 0 row lt IM_HEIGHT row)
  • for (col 0 col lt IM_WIDTH col)
  • histogram imagerowcol

9
Histogram Stretch
  • Grey-level scaling (revisited)
  • Pixel grey-level scaling
  • changes amplitude of pixels to cover wider range
  • Problems scaling might introduce
  • amplitude overflow
  • side effect possible grey-level shift
  • Solutions first counter possible shift, then
    scale grey levels to fit within valid amplitude
    range

10
Histogram Stretch
  • Grey-level scaling (revisited)
  • Naïve contrast enhancement
  • for (row 0 row lt IM_HEIGHT row)
  • for (col 0 col lt IM_WIDTH col)
  • if (imagerowcol lt 255 / SCALE)
  • imagerowcol SCALE
  • else
  • imagerowcol 255

Inefficient
assumed to be positive
11
Histogram Stretch
  • Histogram stretch contrast enhancement technique

12
Histogram Stretch
  • Two transformations for simple linear stretch
  • pixel amplitude shift
  • to align current lowest pixel amplitude with
    desired lowest amplitude
  • pixel amplitude scaling
  • to stretch current histogram pixel-amplitude span
    to desired span

13
Histogram Stretch
  • General linear mapping function
  • for stretching grey levels (old value g) from
    range minold, maxold to minnew, maxnew

1. Grey-level shift
2. Grey-level scaling
3. Grey-level shift
  • Exercise
  • use above formula to modify code for naïve
    grey-level scaling
  • no need to compute histogram

14
Histogram Equalisation
  • Contrast enhancement technique
  • Tries to obtain flatter histogram

15
Histogram Equalisation
  • Pixel-amplitude reassignment requires mapping
    function
  • possible mapping function

16
Histogram Equalisation
  • where (if grey levels are to be stretched over
    full range)
  • gnew new pixel grey level (old value g)
  • t(g) count of pixels with grey level from 0 to g
  • G number of possible grey levels (normally 256)
  • N number of pixels in image

17
Histogram Equalisation
  • Example - histogram prior to equalisation

18
Histogram Equalisation
  • Example - calculations

19
Histogram Equalisation
  • Example - histogram after equalisation

20
Histogram Equalisation
  • Implementation histogram equalisation
  • prevCumCount 0
  • / Calculate cumulative count (i.e. t(g)) /
  • for (g 0 g lt IM_DEPTH g)
  • cumCountg histogramg prevCumCount
  • prevCumCount cumCountg
  • Exercise calculate new pixel grey-level using
    mapping function given earlier

21
Summary
  • Histogram counts of pixels at each pixel
    amplitude
  • useful for some transformations
  • Contrast enhancement
  • based on global or local image information
  • pixel amplitude spread over wider range
  • histogram stretch
  • fundamentally a scaling operation
  • combined with shift to counter side-effect
  • histogram equalisation
  • tries to obtain flatter histogram
Write a Comment
User Comments (0)
About PowerShow.com