Introduction to Digital Image Processing and Computer

Document Sample
Introduction to Digital Image Processing and Computer Powered By Docstoc
					        CSC464/564 - Fall 2009

    Introduction to Digital
    Image Processing and
   Computer Vision - Part I
              John M. Weiss, Ph.D.
Department of Mathematics and Computer Science
 South Dakota School of Mines and Technology
       Rapid City, SD 57701-3995, USA
What Is Image Processing?
Some Definitions…
An image can often be defined in
terms of a 2-D intensity function f(x,y)
A digital image has been discretized
in both space and intensity
Digital image processing involves the
display and manipulation of digital
image data. In general, both the input
and output are digital images.
               Digital Image Formation

(Gonzalez & Woods, Digital Image Processing, 2002)
 Why Study Image
The human brain is “hard-wired” for rapid
processing of visual information.
Many important application areas: desktop
publishing, medical imaging, remote sensing,
scientific data visualization.
Compelling illustration of many fundamental
concepts in computer science and mathematics.
Digital photography is rapidly replacing film.
Image processing is fun!
Major Topic Areas in
Digital Image Processing
 Image digitization and display
 Image enhancement
 Image restoration
 Image encoding
 Image analysis
 Related Fields of Study

 computer graphics = image synthesis
image processing = image manipulation
   computer vision = image analysis
Image Digitization

 A continuous image f(x,y) is digitized
 in both space and intensity.
 Digitization is similar to placing a
 rectangular grid over the image, and
 storing the average intensity value in
 each grid element.
 Grid elements are known as pixels.
  Image Digitization

(Gonzalez & Woods, Digital Image Processing, 2002)

 Digitization in space is known as
 Spatial resolution of the digitized
 image is determined by the grid
 spacing (pixel size):
   M rows * N columns → MN pixels
Spatial Artifacts

Inadequate spatial resolution produces
artifacts. In an extreme case, individual
pixels may be resolved, and the image
takes on a blocky, pixellated appearance.
Sampling theory relates spatial resolution
to pixel size. Inadequate sampling can
produce aliasing artifacts.
Digitization Artifacts:
Inadequate Spatial Resolution

Intensity digitization is known as quantization,
and produces a set of discrete intensity levels.
Continuous image has continuous intensity
    0 ≤ f(x,y) < ∞
Digital image has K discrete intensity levels
    f(x,y) = 0, 1, 2, …, K-1
Intensity Artifacts

The human visual system is capable of
distinguishing 90-100 shades of gray,
and thousands of different colors.
Fewer shades can lead to false
contouring artifacts in objects that
should show a smooth gradation of
intensity values.
Digitization Artifacts:
Inadequate Intensity Resolution
Human Visual System

 Rods provide monochromatic vision in
 low light conditions (nighttime).
 Cones provide color vision under
 conditions of high illumination
 (daylight). There are three types of
 cones, with peak sensitivity to
 reddish-orange, greenish-yellow, and
 blue wavelengths of visible light.
Human Color Visual Response

(Gonzalez & Woods, Digital Image Processing, 2002)
   Binary, Gray, Color Images
1 bit per pixel yields a binary image with
21=2 intensity levels (black and white).
8 bits per pixel yields an image with 28=256
intensity levels (grayscale or color mapped
images). For medical applications, 12 bits
(4096 intensity levels) may be required.
24 bits per pixel yields an image with
224=16,777,216 intensity levels (true color).
Color Tristimulus Theory

 Tristimulus theory of color vision:
 a combination of three color primaries
 (red, green, blue light) can produce
 the same color sensation as any pure
 monochromatic wavelength.
 Color display hardware is typically
 based upon the RGB color model.
RGB Color Components
RGB Color Components
Image Enhancement

 Digital images may be enhanced in a
 variety of ways:
   Sharpness and smoothness
   Image geometry
Image Enhancement

 Many image enhancement techniques
 fall into the following categories:
   Point processes
   Neighborhood processes
   Global processes
Point Processes

 Point processes rely only on an
 individual pixel value for input:
     g(x,y) = T{ f(x,y) }
  where T is a transformation function.
 Brightness, contrast, and color
 enhancements are typically point
Point Processes and LUTs

 Point processes are most efficiently
 implemented via lookup tables. This
 allows a computation to be performed
 once for each intensity (256 grayscale
 values) rather than every pixel.
 LUT values are displayed as a plot of
 input vs. output intensity.
Default LUT Gray Scale


                                                                T(i) = i
output intensity



                         0   64        128          192   256
                                  input intensity
Image Negation


                                                                T(i) = 255 - i
output intensity



                         0   64        128          192   256
                                  input intensity
Image Negation

 Image brightness may be changed by
 adding (to brighten) or subtracting (to
 darken) a constant to every pixel.
 Pixel values outside the allowed range
 (e.g., 0-255 for an 8-bit grayscale
 image) are usually clipped.
Adjusting Brighteness


                                                                 T(i) = i + 64
 output intensity



                          0   64        128          192   256
                                   input intensity

 Image contrast may be increased or
 decreased by a multiplicative factor
 and an additive offset.
 Typically, contrast enhancement is
 implemented by applying a linear
 ramp to pixel intensities via LUTs.
Adjusting Contrast


                                                                   T(i) = 2 ∗ ( i – 64 )
 output intensity



                          0   64         128           192   256
                                   input inte ns ity

Posterization is a quantization technique
that reduces 256 gray levels to a much
smaller number (e.g., 4 or 8).
This produces false contouring artifacts,
which may be desirable for highlighting
image structures, or in graphics arts
8-Level Posterization

 output intensity



                          0   64         128           192   256
                                   input inte ns ity
  Binary Thresholding

In binary thresholding, all pixel values
below a specified intensity threshold are
set to black; pixel values above the
threshold are set to white.
Binary thresholding produces a binary
image (one bit per pixel). This is often the
first step in segmentation, connectivity,
and other image analysis approaches.
Binary Thresholding

 output intensity



                          0   64         128           192   256
                                   input inte ns ity

T(i) = 0 if i < threshold, 255 otherwise
Binary Thresholding

A grayscale image may be displayed in
color by assigning a 24-bit RGB color
value to each of the 256 grayscale
intensity values.
These color values may represent an
approximation to “true” color, or may be
arbitrary color choices.
Pseudocolor may be implemented by
storing color values in RGB LUTs.
Discrete Pseudocolor
Continuous Pseudocolor
Image Histograms

 An image histogram is a frequency
 distribution function, containing the
 number of pixels at each intensity.
 Enhancements based on image
 histograms are typically point
 processes. Contrast stretching and
 histogram equalization are powerful
 histogram-based enhancements.
Image Histograms
Image Histograms
Contrast Stretching
Automated form of contrast enhancement,
based upon the image histogram.
Transformation function is a linear ramp
between the minimum and maximum
values in the histogram:

                         × (i − imin )
    T (i ) =
             imax − imin
Contrast Stretching
Histogram Equalization
Goal is maximal global image contrast.
Equalized image approximates a flat
histogram, in which each intensity level is
equally likely (same number of pixels).
Transformation function is the cumulative
distribution function (CDF):
    T (k ) = CDF (k ) = ∑ h(i )
                        i =0
Histogram Equalization
9000                                                                 100%






  0                                                                  0%
       1      32     63     94     125    156     187    218   249

       Blue = frequency distribution (histogram) in pixels
       Red = cumulative frequency distribution (CDF) in percent
Histogram Equalization
Histogram Equalization
 Color Image Processing

Color images are often represented using
the RGB color model.
Each 24-bit pixel consists of three 8-bit
color components (red, green, blue).
How do we process a color image?
 Simple Approach to Color IP

For each pixel, process the RGB components
         R’=T(R), G’=T(G), B’=T(B)
But most image processing techniques are
designed to operate on image intensity
(brightness) information, not color.
Since each component is processed
separately, this approach can lead to
undesirable processing artifacts (color shifts).
Color Histogram Equalization



Better Approach to Color IP

 The RGB color model is unsuitable for
 color image processing.
 Select a color model that separates
 the intensity information from the
 chromaticity (color).
 Process the intensity component and
 leave chromaticity unchanged.
 Color Image Processing

Color image processing approach:
  Convert from RGB: RGB → IC1C2
  Process intensity: I’ = T(I)
  Convert back to RGB: I’ C1C2 → R’G’B’
C1 and C2 represent chromaticity, and I
represents intensity. Only the intensity
component is processed. (Note that all three
RGB color components will generally change.)
     Popular Color Models

   RGB (red, green, blue) – standard additive color
   model, used in most display systems
   CMY(K) (cyan, magenta, yellow, black) – standard
   subtractive color model, used in printing
   YIQ (luminance, inphase, quadrature)* – NTSC
   color TV broadcast standard
   IHS (intensity, hue, saturation)* – most similar to
   human description of color information

* suitable for color image processing