Top Banner
Digital Image Processing Digital Image Processing Course 1
822
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • Digital Image ProcessingDigital Image Processing

    Course 1

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    BibliographyBibliography

    R.C. Gonzales, R.E. Woods, Digital Image Processing, Prentice Hall,2008, 3rd ed.

    R.C. Gonzales, R.E. Woods, S.L. Eddins, Digital Image Processing Using MATLAB Prentice Hall 2003Using MATLAB, Prentice Hall, 2003

    http://www.imageprocessingplace.com/

    M. Petrou, C. Petrou, Image Processing: the fundamentals, John Wiley, 2010, 2nd ed.

    W B M J B Di it l I P i A Al ith i W. Burger, M.J. Burge, Digital Image Processing, An Algorithmic Introduction Using Java, Springer, 2008

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Image Processing Toolbox (http://www.mathworks.com/products/image/)

    C. Solomon, T. Breckon, Fundamentals of Digital Image Processing: A Practical Approach with Examples in MatlabProcessing: A Practical Approach with Examples in Matlab, Wiley-Blackwell, 2011

    W.K. Pratt, Digital Image Processing, Wiley-Interscience, 2007g g g y

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Evaluation

    MATLAB image processing test (50%)

    Articles/Books presentations (50%)

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Meet Lena!The First Lady of the Internety

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Lenna Soderberg (Sjblom) and e a Sode be g (Sjb o ) a dJeff Seideman taken in May 1997Imaging Science & Technology Conference

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Wh t i Di it l I P i ?What is Digital Image Processing?

    3: /f D

    f(x,y) = intensity, gray level of the image at spatial point (x,y)

    x, y, f(x,y) finite, discrete quantities digital image

    Digital Image Processing = processing digital images by means of a digital computer

    A digital image is composed of a finite number of elements (location, value of intensity):

    ( , , )i j ijx y f

    These elements are called picture elements, image elements, pels, pixels

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Image processing is not limited to the visual band of the electromagnetic (EM)Image processing is not limited to the visual band of the electromagnetic (EM) spectrum

    Image processing : gamma to radio waves, ultrasound, electron microscopy, computer-generated images

    image processing , image analysis , computer vision ?

    Image processing = discipline in which both the input and the output of a process are images

    C t Vi i t t l t h i i (AI)Computer Vision = use computer to emulate human vision (AI) learning, making inferences and take actions based on visual inputs

    Image analysis (image understanding) = segmentation, partitioning images into regions or objects

    (link between image processing and image analysis)

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Distinction between image processing , image analysis , computer vision :Distinction between image processing , image analysis , computer vision :

    low-level, mid-level, high-level processes

    L l l i i t d i t t h tLow-level processes: image preprocessing to reduce noise, contrast enhancement, image sharpening; both input and output are images

    Mid-level processes: segmentation, partitioning images into regions or objects, p g p g g g jdescription of the objects for computer processing, classification/recognition of individual objects; inputs are generally images, outputs are attributes extracted from the input image (e g edges contoursfrom the input image (e.g. edges, contours, identity of individual objects)

    High-level processes: making sense of a set of recognized objects; performing the cognitive functions associated with vision

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Di it l I P i (G l W d )Digital Image Processing (Gonzalez + Woods) =

    processes whose inputs and outputs are images +

    processes that extract attributes from images, recognition of individual objects

    (low and mid level processes)(low- and mid-level processes)

    Example:

    automated analysis of text = acquiring an image containing text, preprocessing the image (enhancement, sharpening), extracting (segmenting) the individual characatersextracting (segmenting) the individual characaters, describing the characters in a form suitable for computer processing, recognition of individual characters

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    The Origins of DIP

    Newspaper industry: pictures were sent by submarine cable between London and New YorkLondon and New York

    Before Bartlane cable picture transmission system (early 1920s) 1 week

    With Bartlane system: less than 3 hours

    Specialized printing equipment coded pictures for cable transmission and reconstructed them at the receiving endreconstructed them at the receiving end (1920s -5 distict levels of gray, 1929 15 levels)

    This example is not DIP , the computer is not involved

    DIP is linked and devolps in the same rhythm as digital computers (data storage, display and transmission)

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    A digital pictureproduced in 1921from a coded tapeby a telegraph printer withprinter withspecial type faces(McFarlane)

    A digital picturemade in 1922from a tapefrom a tapepunched after the signals hadcrossed the Atlantic twice(McFarlane)

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    1964, Jet Propulsion Laboratory (Pasadena, California) processed pictures of the moon transmitted by Ranger 7 (corrected image distortions)

    The first picture of the moon by a U.S. spacecraft. Ranger 7 took this image July 31, 1964, about 17 minutes before impacting the lunar surface.(Courtesy of NASA)

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    1960-1970 image processing techniques were used in medical image, remote Earth resources observations, astronomy

    1970s invention of CAT (computerized axial tomography) http://www.virtualmedicalcentre.com/videos/cat-scans/793

    CAT is a process in which a ring of detectors encircles an object (pacient), and a X-ray source, concentric with the detector ring, rotates about the object. The X-ray passes through the patient and are collected at the opposite end b th d t t A th t t th d i t dby the detectors. As the source rotates the procedure is repeted. Tomography consists of algorithms that use the sense data to construct an image that represent a slice through the object. Motion of the object in a direction perpendiculare to the ring of detectors produces a set of slices p p g pwhich can be assembled in a 3D information of the inside of the object.

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    geographers use DIP to study pollution patterns from aerial and satellite imageryg g p y p p g y

    archeology DIP allowed restoring blurred pictures that recorded rare artifacts lost or damaged after being photographed

    physics enhance images of experiments (high-energy plasmas, electron microscopy)

    astronomy, biology, nuclear medicine, law enforcement, industry

    DIP used in solving problems dealing with machine perception extracting from an image information suitable for computer processingextracting from an image information suitable for computer processing (statistical moments, Fourier transform coefficients, )

    automatic character recognition, industrial machine vision for product bl d i i ili i i i fassembly and inspection, military recognizance, automatic processing of

    fingerprints, machine processing of aerial and satellite imagery for weather prediction, Internet

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Examples of Fields that Use DIP

    Images can be classified according to their sources (visual, X-ray, )

    Energy sources for images : electromagnetic energy spectrum, acoustic, ultrasonic, electronic, computer- generated

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Electromagnetic waves can be thought as propagating sinusoidal

    waves of different wavelength, or as a stream of massless particles,

    each moving in a wavelike pattern with the speed of light Eacheach moving in a wavelike pattern with the speed of light. Each

    massless particle contains a certain amount (bundle) of energy. Each

    bundle of energy is called a photon If spectral bands are groupedbundle of energy is called a photon. If spectral bands are grouped

    according to energy per photon we obtain the spectrum shown in the

    image above, ranging from gamma-rays (highest energy) to radioimage above, ranging from gamma rays (highest energy) to radio

    waves (lowest energy).

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Gamma Ray ImagingGamma-Ray Imaging

    Nuclear medicine , astronomical observations

    Nuclear medicine

    the approach is to inject a patient with a radioactive isotope that emits gamma rays as it decaysgamma rays as it decays.

    Images are produced from the emissions collected by gamma-ray detectors

    Images of this sort are used to locate sites of bone pathology (infections, tumors)

    PET (positron emision tomography) the patient is given a radioactive isotope that emits positrons as it decaysisotope that emits positrons as it decays

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Examples of gamma-ray imaging

    Bone scan PET image

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    X-ray imaging

    Medical diagnostic,industry, astronomy

    A X-ray tube is a vacuum tube with a cathode and an anode. The cathode is heated, causing free electrons to be released. The electrons flows at high speed to the positively charged anode. g p p y gWhen the electrons strike a nucleus, energy is released in the form of a X-ray radiation. The energy (penetreting power) of the X-rays is controlled by a voltage applied across the anode, and by a curent applied to the filament in the cathodeby a curent applied to the filament in the cathode.

    The intensity of the X-rays is modified by absorbtion as they pass through the patient and the resulting energy falling develops it much in the same way that light develops photographic film.

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    A i h t t h t di hAngiography = contrast-enhancement radiography

    Angiograms = images of blood vessels

    A catheter is inserted into an artery or vin in the groin. The catheter is threaded into the blood vessel and guided to the area to be studied. When it reaches the area to be studied, a X-ray contrast medium is injected through the catheter. This enhances contrast of the blood vessels and enables radiologist to see anyThis enhances contrast of the blood vessels and enables radiologist to see anyirregularities or blockages.

    X-rays are used in CAT (computerized axial tomography)

    X-rays used in industrial processes (examine circuit boards for flows in manifacturing)

    Industrial CAT scans are useful when the parts can be penetreted by X-raysIndustrial CAT scans are useful when the parts can be penetreted by X-rays

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Examples of X-ray imagingExamples of X-ray imaging

    Chest X-rayAortic angiogram

    Head CT Cygnus LoopCircuit boards

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Imaging in the Ultraviolet BandImaging in the Ultraviolet Band

    Litography, industrial inspection, microscopy, biological imaging, astronomical observations

    Ultraviolet light is used in fluorescence microscopy

    Ultraviolet light is not visible to human eye but when a photon of ultravioletUltraviolet light is not visible to human eye but when a photon of ultraviolet radiation collides with an electron in an atom of a fluorescent material it elevates the electron to a higher energy level. After that the electron relaxes to a lower level and emits light in the form of a lower-energy

    h t i th i ibl ( d) li ht iphoton in the visible (red) light region.Fluorescence = emission of light by a substance that has absorbed light or

    other electromagentic radiation of a different wavelengthFlourescence microscope = uses an excitation light to irradiate a prepared specimen p g p p p

    and then it separates the much weaker radiating fluorescent light from the brighter excitation light.

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Imaging in the Visible and Infrared Bands

    Li ht i t t i i d t l f t Light microscopy, astronomy, remote sensing, industry, law enforcement

    LANDSAT satellite obtained and transmitted images of the Earth from space for purpose of monitoring environmental conditions p p gon the planet

    Weather observations and prediction produce major applications of multispectral image from satellitesimage from satellites

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Examples of light microscopy

    Taxol (anticancer agent) Cholesterol Microprocessor(60X)(anticancer agent)magnified 250X

    C o este o(40X)

    (60X)

    Nickel oxidethin film(600X)

    Surface of audio CD(1750X)

    Organicsuperconductor(450X)

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    A t t d i l i ti f f t d dAutomated visual inspection of manufactured goods

    a b a a circuit board controllerb k d ill

    a bc de f

    b packaged pillesc bottlesd air bubbles in clear-plastic product

    le cerealf image of intraocular implant

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Imaging in the Microwave Band

    The dominant aplicationof imageing in the microwave band radar

    radar has the ability to collect data over virtually any region at any time radar has the ability to collect data over virtually any region at any time, regardless of weather or ambient light conditions

    some radar waves can penetrate clouds, under certain conditions can penetrate vegetation, ice, dry sand

    sometimes radar is the only way to explore inaccessible regions of the Earths surfaceEarth s surface

    An imaging radar works like a flash camera : it provides its own illumination (microwave pulses) to light an area on the ground and take a snapshot image. I t d f l d t d di it l d i tInstead of a camera lens, a radar uses an antenna and a digital device to record the images. In a radar image one can see only the microwave energy that was reflected back toward the radar antenna

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Imaging in the Radio BandImaging in the Radio Band

    medicine, astronomy

    MRI = Magnetic Resonance Imaging

    This technique places the patient in a powerful magnet and passes short pulses of radio waves through his or her bodyof radio waves through his or her body.

    Each pulse causes a responding pulse of radio waves to be emited by the patinet tissues.

    The location from which these signals originate and their strength are determined by a computer, which produces a 2D picture of a section of the patient

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    f ( f ) ( )MRI images of a human knee (left) and spine (right)

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Images of the Crab Pulsar covering the electromagnetic spectrum

    Gamma X-ray Optical Infrared Radio

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Other Imaging ModalitiesOther Imaging Modalities

    acoustic imaging, electron microscopy, synthetic (computer-generated) imaging( p g ) g g

    Imaging using sound geological explorations, industry, medicine

    Mineral and oil explorationMineral and oil exploration

    For image acquisition over land one of the main approaches is to use a large truck an a large flat steel plate. The plate is pressed on the ground by the truck and the truck is vibratedthrough a frequency spectrum up to 100 Hz. The strength and the speed of the returning sound waves are determined by the composition of the Earth below the surfaceby the composition of the Earth below the surface. These are analysed by a computer and images are generated from the resulting analysis.

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Fundamental Steps in DIPFundamental Steps in DIP

    methods whose input and output are images methods whose input and output are images

    methods whose inputs are images but whose outputs are attributes extracted from those images

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    O t t iOutputs are images

    image acquisition

    image filtering and enhancement

    image restoration

    color image processing

    wavelets and multiresolution processingp g

    compression

    morphological processing morphological processing

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Outputs are attributes

    morphological processingmorphological processing

    segmentation

    representation and description

    object recognition

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    I i iti i l i h liImage acquisition - may involve preprocessing such as scaling

    Image enhancement

    manipulating an image so that the result is more suitable than the original for a specific operation

    enhancement is problem oriented enhancement is problem oriented

    there is no general theory of image enhancement

    enhancement use subjective methods for image emprovement

    enhancement is based on human subjective preferences regarding what is a good enhancement resultwhat is a good enhancement result

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Image restoration

    improving the appearance of an image

    restoration is objective - the techniques for restoration are based on j qmathematical or probabilistic models of image degradation

    Color image processing

    fundamental concept in color models

    basic color processing in a digital domain

    Wavelets and multiresolution processing

    representing images in various degree of resolution

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Compression

    reducing the storage required to save an image or the bandwidth i d t t it itrequired to transmit it

    Morphological processing

    tools for extracting image components that are useful in the representation and description of shape

    a transition from processes that output images to processes that output a transition from processes that output images to processes that outputimage attributes

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Segmentation

    partitioning an image into its constituents parts or objects

    autonomous segmentation is one of the most difficult tasks of DIP

    the more accurate the segmentation , the more likley recognition is to succeedthe more accurate the segmentation , the more likley recognition is to succeed

    Representation and description (almost always follows segmentation)

    t ti d ith th b d f i ll th it i th segmentation produces either the boundary of a region or all the poits in the region itself

    converting the data produced by segmentation to a form suitable for g p y gcomputer processing

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    boundary representation: the focus is on external shape characteristics such as corners or inflections

    l t i th f i i t l ti h t t complete region: the focus is on internal properties such as texture or skeletal shape

    description is also called feature extraction extracting attributes that result p gin some quantitative information of interest or are basic for differentiating one class of objects from another

    Object recognitionObject recognition

    the process of assigning a label (e.g. vehicle) to an object based on itsdescriptors

    Knowledge database

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Simplified diagramof a cross sectionof a cross sectionof the human eye

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Three membranes enclose the eye: the cornea and sclera outer cover the choroid the retina the retina

    The cornea is a tough, transparent tissue that covers the anterior surface of the eye.

    Continuous with the cornea, the sclera is an opaque membrane that enclosesthe remainder of the optic globe.

    The choroid lies directly below the sclera. This membrane contains a network ofThe choroid lies directly below the sclera. This membrane contains a network of blood vessels (major nutrition of the eye). The choroid is pigmented and help reduce the amount of light entering the eyeThe choroid is divided (at its anterior extreme) into the ciliary body and the iris.Th i i t t d d t t l th t f li htThe iris contracts and expands to control the amount of light

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Th l i d f t i l f fib ll d i d d bThe lens is made up of concentric layers of fibrous cells and is suspended by fibers that attach to ciliary body (60-70% water, 6% fat, protein). The lens is colored in slightly yellow. The lens absorbs approximatively 8% of the visiblelight (infrared and ultraviolet light are absorbed by proteins in lens)g ( g y p )

    The innermost membrane is the retina. When the eye is proper focused,light from an object outside the eye is imaged on the retina.Vision is possible because of the distribution of discrete light receptors on theVision is possible because of the distribution of discrete light receptors on the surface of the retina: cones and rods (6-7 milion cones, 75-150 milion rods),

    Cones: located in the central part of the retina (fovea), they are sensitive to colors, vision of detail, each cone is link to its own nervecone vision = photopic or bright-light vision

    Fovea = the place where the image of the object of interest falls on

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Rods : distributed over al the retina surface, several rods are contected toa single nerve, not specialized in detail vision, serve to give a general, overall picture of the filed of viewnot involved in color visionnot involved in color visionsensitive to low level of illumination

    Blind spot: region without receptors

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Distribution ofrods and conesin the retina

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    I f ti i thImage formation in the eye

    Ordinary photographic camera: the lens has fixed focal length, focusing atvarious distances is done by modifying the distance between the lens and thevarious distances is done by modifying the distance between the lens and the image plane (were the film or imaging chip are located)

    Human eye: the distance between the lens and the retina (the imaging region)i fi d th f l l th d d t hi f i bt i d b iis fixed, the focal length needed to achieve proper focus is obtained by varyingthe shape of the lens (the fibers in the ciliary body accomplish this, flattening or thickening the lens for distant or near objects, respectively.

    distance between lens and retina along visual axix = 17 mm

    range of focal length = 14 mm to 17 mm

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Illustration of Mach band effectPercieved intensityPercieved intensityis not a simple function of actual intensity

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    All the inner squares have the same intensity, but they appear progressively darker as the background becomes lighter

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

    Optical illusions

  • Digital Image ProcessingDigital Image Processing

    Course 1Course 1

  • Digital Image Processing

    Course 2

  • Digital Image Processing

    Course 2

    - achromatic or monochromatic light - light that is void of color - the attribute of such light is its intensity, or amount. - gray level is used to describe monochromatic intensity because

    it ranges from black, to grays, and to white. - chromatic light spans the electromagnetic energy spectrum

    from approximately 0.43 to 0.79 mm. - quantities that describe the quality of a chromatic light source:

    o radiance the total amount of energy that flows from the light source, and it is usually measured in watts (W)

    o luminance measured in lumens (lm), gives a measure of the amount of energy an observer perceives from a light source.

  • Digital Image Processing

    Course 2

    For example, light emitted from a source operating in the far infrared region of the spectrum could have significant energy (radiance), but an observer would hardly perceive it; its luminance would be almost zero.

    o brightness

    a subjective descriptor of light perception that is practically impossible to measure. It embodies the achromatic notion of intensity and is one of the key factors in describing color sensation.

  • Digital Image Processing

    Course 2

  • Digital Image Processing

    Course 2

    the physical meaning is determined by the source of the image: , ( , )f D f x y Image generated from a physical process f(x,y) proportional to the energy radiated by the physical source.

    0 ( , )f x y

    f(x,y) characterized by two components: 1. i(x,y) = illumination component, the amount of source illumination incident on the scene being viewed ; 2. r(x,y) = reflectance component, the amount of illumination reflected by the objects in the scene;

    ( , ) ( , ) ( , )f x y i x y r x y

    0 ( , ) , 0 ( , ) 1i x y r x y

  • Digital Image Processing

    Course 2

    r(x,y)=0 - total absorption , r(x,y)=1 - total reflectance

    i(x,y) determined by the illumination source r(x,y) determined by the characteristics of the imaged objects

    min 0 0 max min min min max max max( , ) , ,L l f x y L L i r L i r

    indoor values without additional illuminationmin max10 , 1000L L

    min max,L L is called gray (or intensity) scale In practice: black whitemin max0 , 1 0, 1 , 0 , 1L L L L l l L

  • Digital Image Processing

    Course 2

    Image Sampling and Quantization

    converting a continuous image f to digital form - digitizing (x,y) is called sampling

    - digitizing f(x,y) is called quantization

  • Digital Image Processing

    Course 2

    Continuous image projected onto a sensor array Result of image sampling and quantization

  • Digital Image Processing

    Course 2

    Representing Digital Images (x,y) x = 0,1,,M-1 , y = 0,1,,N-1 spatial variables or spatial coordinates

    (0,0) (0,1) (0, 1)(1,0) (1,1) (1, 1)

    ( , )

    ( 1,0) ( 1,1) ( 1, 1)

    f f f Nf f f N

    f x y

    f M f M f M N

    image element, pixel

    0,0 0,1 0, 1

    ,1,0 1,1 1, 1

    ,

    1,0 1,1 1, 1

    ( , ) ( , ),

    N

    i jN M N

    i j

    M M M N

    a a aa f x i y j f i ja a a

    Aa

    a a a

    f(0,0) the upper left corner of the image

  • Digital Image Processing

    Course 2

    M, N 0, L=2k

    , ,, [0, 1]i j i ja a L

    Dynamic range of an image = the ratio of the maximum measurable intensity to the minimum detectable intensity level in the system Upper limit determined by saturation, lower limit - noise

  • Digital Image Processing

    Course 2

    Number of bits required to store a digitized image:

    for 2, ,b M N k M N b N k

    When an image can have 2k intensity levels, the image is referred as a k-bit image 256 discrete intensity values 8-bit image

  • Digital Image Processing

    Course 2

    Spatial and Intensity Resolution Spatial resolution the smallest discernible detail in an image

    Measures: line pairs per unit distance, dots (pixels) per unit distance

    Image resolution = the largest number of discernible line pairs per unit distance

    (e.g. 100 line pairs per mm)

    Dots per unit distance are commonly used in printing and publishing

    In U.S. the measure is expressed in dots per inch (dpi)

    (newspapers are printed with 75 dpi, glossy brochures at 175 dpi)

    Intensity resolution the smallest discernible change in intensity level

    The number of intensity levels (L) is determined by hardware considerations

    L=2k most common k = 8

    Intensity resolution, in practice, is given by k (number of bits used to quantize intensity)

  • Digital Image Processing

    Course 2

    Fig.1 Reducing spatial resolution: 1250 dpi(upper left), 300 dpi (upper right)

    150 dpi (lower left), 72 dpi (lower right)

  • Digital Image Processing

    Course 2

    Reducing the number of gray levels: 256, 128, 64, 32

  • Digital Image Processing

    Course 2

    Reducing the number of gray levels: 16, 8, 4, 2

  • Digital Image Processing

    Course 2

    Image Interpolation - used in zooming, shrinking, rotating, and geometric corrections

    Shrinking, zooming image resizing image resampling methods

    Interpolation is the process of using known data to estimate values at unknown locations

    Suppose we have an image of size 500 500 pixels that has to be enlarged 1.5 times to

    750750 pixels. One way to do this is to create an imaginary 750 750 grid with the

    same spacing as the original, and then shrink it so that it fits exactly over the original

    image. The pixel spacing in the 750 750 grid will be less than in the original image.

    Problem: assignment of intensity-level in the new 750 750 grid

    Nearest neighbor interpolation: assign for every point in the new grid (750 750) the

    intensity of the closest pixel (nearest neighbor) from the old/original grid (500 500).

  • Digital Image Processing

    Course 2

    This technique has the tendency to produce undesirable effects, like severe distortion of

    straight edges.

    Bilinear interpolation assign for the new (x,y) location the following intensity: ( , )v x y a x b y c x y d

    where the four coefficients are determined from the 4 equations in 4 unknowns that can

    be written using the 4 nearest neighbors of point (x,y).

    Bilinear interpolation gives much better results than nearest neighbor interpolation, with a

    modest increase in computational effort.

    Bicubic interpolation assign for the new (x,y) location an intensity that involves the 16

    nearest neighbors of the point: 3 3

    ,0 0

    ( , ) i ji ji j

    v x y c x y

    The coefficients ci,j are obtained solving a 16x16 linear system:

  • Digital Image Processing

    Course 2

    intensity levels of the 16 nearest neighbors of 3 3

    ,0 0

    ( , )i ji ji j

    c x y x y

    Generally, bicubic interpolation does a better job of preserving fine detail than the

    bilinear technique. Bicubic interpolation is the standard used in commercial image editing

    programs, such as Adobe Photoshop and Corel Photopaint.

    Figure 2 (a) is the same as Fig. 1 (d), which was obtained by reducing the resolution of

    the 1250 dpi in Fig. 1(a) to 72 dpi (the size shrank from 3692 2812 to 213 162) and

    then zooming the reduced image back to its original size. To generate Fig. 1(d) nearest

    neighbor interpolation was used (both for shrinking and zooming).

    Figures 2(b) and (c) were generated using the same steps but using bilinear and bicubic

    interpolation, respectively. Figures 2(d)+(e)+(f) were obtained by reducing the resolution

    from 1250 dpi to 150 dpi (instead of 72 dpi)

  • Digital Image Processing

    Course 2

    Fig. 2 Interpolation examples for zooming and shrinking (nearest neighbor, linear, bicubic)

  • Digital Image Processing

    Course 2

    Neighbors of a Pixel

    A pixel p at coordinates (x,y) has 4 horizontal and vertical neighbors: horizontal: vertical:( 1, ) , ( 1, ) ; ( , 1) , ( , 1)x y x y x y x y

    This set of pixels, called the 4-neighbors of p, denoted by N4 (p).

    The 4 diagonal neighbors of p have coordinates: ( 1, 1) , ( 1, 1) , ( 1, 1) , ( 1, 1)x y x y x y x y

    and are denoted ND(p).

    The horizontal, vertical and diagonal neighbors are called the 8-neighbors of p, denoted

    N8 (p).

    If (x,y) is on the border of the image some of the neighbor locations in ND(p) and N8(p)

    fall outside the image.

  • Digital Image Processing

    Course 2

    Adjacency, Connectivity, Regions, Boundaries

    Denote by V the set of intensity levels used to define adjacency.

    - in a binary image V {0,1} (V={0} , V={1}) - in a gray-scale image with 256 possible gray-levels, V can be any subset of {0,255}

    We consider 3 types of adjacency:

    (a) 4-adjacency : two pixels p and q with values from V are 4-adjacent if 4( )q N p (b) 8-adjacency : two pixels p and q with values from V are 8-adjacent if 8( )q N p (c) m-adjacency (mixed adjacency) : two pixels p and q with values from V are

    m-adjacent if :

    4( )q N p or ( )Dq N p and the set 4 4( ) ( )N p N q has no pixels whose values are from V.

    Mixed adjacency is a modification of 8-adjacency. It is introduced to eliminate the

    ambiguities that often arise when 8-adjacency is used. Consider the example:

  • Digital Image Processing

    Course 2

    binar image

    0 1 1 0 1 1 0 1 1

    {1} , ,0 1 0 0 1 0 0 1 0

    0 0 1 0 0 1 0 0 1

    V

    The three pixels at the top (first line) in the above example show multiple (ambiguous)

    8-adjacency, as indicated by the dashed lines. This ambiguity is removed by using

    m-adjacency.

  • Digital Image Processing

    Course 2

    A (digital) path (or curve) from pixel p with coordinates (x,y) to q with coordinates (s,t)

    is a sequence of distinct pixels with coordinates:

    and are adjacent, 0 0 1 1

    1 1

    ( , ) ( , ) , ( , ), ... , ( , ) ( , )( , ) ( , ) 1,2,...,

    n n

    i i i i

    x y x y x y x y s tx y x y i n

    The length of the path is n. If 0 0( , ) ( , )n nx y x y the path is closed. Depending on the type of adjacency considered the paths are: 4-, 8-, or m-paths.

    Let S denote a subset of pixels in an image. Two pixels p and q are said to be connected

    in S if there exists a path between them consisting only of pixels from S.

    S is a connected set if there is a path in S between any 2 pixels in S.

    Let R be a subset of pixels in an image. R is a region of the image if R is a connected set.

    Two regions R1 and R2 are said to be adjacent if 1 2R R form a connected set. Regions that are not adjacent are said to be disjoint. When referring to regions only 4- and

    8-adjacency are considered.

  • Digital Image Processing

    Course 2

    Suppose that an image contains K disjoint regions, , 1, ...,kR k K , none of which touches the image border.

    the complement of 1

    , ( )K

    cu k u u

    kR R R R

    We call al the points in Ru the foreground of the image and the points in ( )cuR the

    background of the image.

    The boundary (border or contour) of a region R is the set of point that are adjacent to

    points in the complement of R, (R)c. The border of an image is the set of pixels in the

    region that have at least one background neighbor. This definition is referred to as the

    inner border to distinguish it from the notion of outer border which is the corresponding

    border in the background.

  • Digital Image Processing

    Course 2

    Distance measures

    For pixels p, q, and z, with coordinates (x,y), (s,t) and (v,w) respectively, D is a distance

    function or metric if:

    (a) D(p,q) 0 , D(p,q) = 0 iff p=q

    (b) D(p,q) = D(q,p)

    (c) D(p,z) D(p,q) + D(q,z)

    The Euclidean distance between p and q is defined as: 1

    2 2 2 22( , ) ( ) ( ) ( ) ( )eD p q x s y t x s y t The pixels q for which ( , )eD p q r are the points contained in a disk of radius r centered at (x,y).

  • Digital Image Processing

    Course 2

    The D4 distance (also called city-block distance) between p and q is defined as:

    4( , ) | | | |D p q x s y t The pixels q for which 4( , )D p q r form a diamond centered at (x,y).

    4

    22 1 2

    2 2 1 0 1 22 1 2

    2

    D

    The pixels with D4 = 1 are the 4-neighbors of (x,y).

    The D8 distance (called the chessboard distance) between p and q is defined as:

    8( , ) max{| | ,| |}D p q x s y t The pixels q for which 8( , )D p q r form a square centered at (x,y).

  • Digital Image Processing

    Course 2

    8

    2 2 2 2 22 1 1 1 2

    2 2 1 0 1 22 1 1 1 22 2 2 2 2

    D

    The pixels with D8 = 1 are the 8-neighbors of (x,y).

    D4 and D8 distances are independent of any paths that might exist between p and q

    because these distances involve only the coordinates of the point. If we consider

    m-adjacency, the distance Dm is defined as:

    Dm(p,q)= the shortest m-path between p and q

    Dm depends on the values of the pixels along the path as well as the values of their

    neighbors. Consider the following example:

  • Digital Image Processing

    Course 2

    3 4

    1 2

    {0,1} 1{0,1} 1

    1

    p pp pp

    Consider V={1}.

    If p1 = p3 = 0 then Dm(p , p4) = 2.

    If p1 = 1 , then p2 and p are no longer m-adjacent then Dm(p , p4) = 3 (p, p1, p2, p4).

    If p1 = 0, p3 = 1 then Dm(p , p4) = 3.

    If p1 = p3 = 1 then Dm(p , p4) = 4 (p, p1, p2, p3, p4).

  • Digital Image Processing

    Course 2

    Array versus Matrix Operations

    An array operation involving one or more images is carried out on a pixel-by-pixel basis.

    11 12 11 12

    21 22 21 22

    a a b ba a b b

    Array product:

    11 12 11 12 11 11 12 12

    21 22 21 22 21 21 22 21

    a a b b a b a ba a b b a b a b

    Matrix product:

    11 12 11 12 11 11 12 21 11 12 12 21

    21 22 21 22 21 11 22 21 21 12 22 22

    a a b b a b a b a b a ba a b b a b a b a b a b

    We assume array operations unless stated otherwise!

  • Digital Image Processing

    Course 2

    Linear versus Nonlinear Operations

    One of the most important classifications of image-processing methods is whether it is

    linear or nonlinear.

    ( , ) ( , )H f x y g x y H is said to be a linear operator if:

    images1 2 1 2

    1 2

    ( , ) ( , ) ( , ) ( , ), , ,

    H a f x y b f x y a H f x y b H f x ya b f f

    Example of nonlinear operator:

    the maximum value of the pixels of image max{ ( , )}H f f x y f 1 2

    0 2 6 5, , 1, 1

    2 3 4 7f f a b

  • Digital Image Processing

    Course 2

    1 2 0 2 6 5 6 3max max 1 ( 1) max 22 3 4 7 2 4a f b f

    0 2 6 51 max ( 1) max 3 ( 1)7 4

    2 3 4 7

    Arithmetic Operations in Image Processing

    Let g(x,y) denote a corrupted image formed by the addition of noise: ( , ) ( , ) ( , )g x y f x y x y

    f(x,y) the noiseless image ; (x,y) the noise, uncorrelated and has 0 average value.

  • Digital Image Processing

    Course 2

    For a random variable z with mean m, E[(z-m)2] is the variance (E( ) is the expected

    value). The covariance of two random variables z1 and z2 is defined as E[(z1-m1) (z2-m2)].

    The two random variables are uncorrelated when their covariance is 0.

    Objective: reduce noise by adding a set of noisy images ( , )ig x y (technique frequently used in image enhancement)

    1

    1( , ) ( , )K

    ii

    g x y g x yK

    If the noise satisfies the properties stated above we have:

    2 2( , ) ( , )1( , ) ( , ) , g x y x yE g x y f x y K ( ( , ))E g x y is the expected value of g , and and 2 2( , ) ( , )g x y x y are the variances of and g , respectively. The standard deviation (square root of the variance) at any point in

    the average image is:

  • Digital Image Processing

    Course 2

    ( , ) ( , )1

    g x y x yK

    As K increases, the variability (as measured by the variance or the standard deviation) of

    the pixel values at each location (x,y) decreases. Because ( , ) ( , )E g x y f x y , this means that ( , )g x y approaches f(x,y) as the number of noisy images used in the

    averaging process increases.

    An important application of image averaging is in the field of astronomy, where imaging

    under very low light levels frequently causes sensor noise to render single images

    virtually useless for analysis. Figure 2.26(a) shows an 8-bit image in which corruption

    was simulated by adding to it Gaussian noise with zero mean and a standard deviation of

    64 intensity levels. Figures 2.26(b)-(f) show the result of averaging 5, 10, 20, 50 and 100

    images, respectively.

  • Digital Image Processing

    Course 2

    Fig. 3 Image of Galaxy Pair NGC 3314 corrupted by additive Gaussian noise (left corner); Results of averaging 5, 10, 20, 50,

    100 noisy images

    a b c d e f

  • Digital Image Processing

    Course 2

    A frequent application of image subtraction is in the enhancement of differences between

    images.

    (a) (b) (c) Fig. 4 (a) Infrared image of Washington DC area; (b) Image obtained from (a) by setting to zero the least

    significant bit of each pixel; (c) the difference between the two images

    Figure 4(b) was obtained by setting to zero the least-significant bit of every pixel in

    Figure 4(a). The two images seem almost the same. Figure 4(c) is the difference between

  • Digital Image Processing

    Course 2

    images (a) and (b). Black (0) values in Figure (c) indicate locations where there is no

    difference between images (a) and (b).

    Mask mode radiography ( , ) ( , ) ( , )g x y f x y h x y

    h(x,y) , the mask, is an X-ray image of a region of a patients body, captured by an

    intensified TV camera (instead of traditional X-ray film) located opposite an X-ray

    source. The procedure consists of injecting an X-ray contrast medium into the patients

    bloodstream, taking a series of images called live images (denoted f(x,y)) of the same

    anatomical region as h(x,y), and subtracting the mask from the series of incoming live

    images after injection of the contrast medium.

    In g(x,y) we can find the differences between h and f, as enhanced detail.

  • Digital Image Processing

    Course 2

    Images being captured at TV rates, we obtain a movie showing how the contrast medium

    propagates through the various arteries in the area being observed.

    a b c d Fig. 5 Angiography subtraction example (a) mask image; (b) live image ; (c) difference between (a) and (b); (d) - image (c) enhanced

  • Digital Image Processing

    Course 2

    An important application of image multiplication (and division) is shading correction.

    Suppose that an imaging sensor produces images in the form: ( , ) ( , ) ( , )g x y f x y h x y

    f(x,y) the perfect image , h(x,y) the shading function

    When the shading function is known:

    ( , )( , )( , )

    g x yf x yh x y

    h(x,y) is unknown but we have access to the imaging system, we can obtain an

    approximation to the shading function by imaging a target of constant intensity. When the

    sensor is not available, often the shading pattern can be estimated from the image.

  • Digital Image Processing

    Course 2

    (a) (b) (c)

    Fig. 6 Shading correction (a) Shaded image of a tungsten filament, magnified 130 ; (b) - shading pattern ; (c) corrected image

  • Digital Image Processing

    Course 2

    Another use of image multiplication is in masking, also called region of interest (ROI),

    operations. The process consists of multiplying a given image by a mask image that has

    1s (white) in the ROI and 0s elsewhere. There can be more than one ROI in the mask

    image and the shape of the ROI can be arbitrary, but usually is a rectangular shape.

    (a) (b) (c)

    Fig. 7 (a) digital dental X-ray image; (b) - ROI mask for teeth with fillings; (c) product of (a) and (b)

  • Digital Image Processing

    Course 2

    In practice, most images are displayed using 8 bits the image values are in the range [0,255].

    TIFF, JPEG images conversion to this range is automatic. The conversion depends on

    the system used.

    Difference of two images can produce image with values in the range [-255,255]

    Addition of two images range [0,510]

    Many software packages simply set the negative values to 0 and set to 255 all values

    greater than 255.

    A more appropriate procedure: compute

    min( )mf f f which creates an image whose minimum value is 0, then we perform the operation:

    0 , ( 255)max( )

    ms

    m

    ff K K Kf

  • Digital Image Processing

    Course 2

    Spatial Operations

    - are performed directly on the pixels of a given image.

    There are three categories of spatial operations:

    single-pixel operations neighborhood operations geometric spatial transformations

    Single-pixel operations

    - change the values of intensity for the individual pixels ( )s T z

    where z is the intensity of a pixel in the original image and s is the intensity of the

    corresponding pixel in the processed image. Fig. 2.34 shows the transformation used to

    obtain the negative of an 8-bit image

  • Digital Image Processing

    Course 2

    Original digital mammogram Negative image of the mammogram

    Intensity transformation function for the complement of an 8-bit image

  • Digital Image Processing

    Course 2

    Neighborhood operations

    Let Sxy denote a set of coordinates of a neighborhood centered on an arbitrary point (x,y)

    in an image, f. Neighborhood processing generates an new intensity level at point (x,y)

    based on the values of the intensities of the points in Sxy. For example, if Sxy is a

    rectangular neighborhood of size m n centered in (x,y), we can assign the new value of

    intensity by computing the average value of the pixels in Sxy.

    ( , )

    1( , ) ( , )xyr c S

    g x y f r cm n

    The net effect is to perform local blurring in the original image. This type of process is

    used, for example, to eliminate small details and thus render blobs corresponding to the

    largest region of an image.

  • Digital Image Processing

    Course 2

    Aortic angiogram Result of applying an averaging filter (m=n=41)

  • Digital Image Processing

    Course 3

  • Digital Image Processing

    Course 3 Spatial Operations

    - are performed directly on the pixels of a given image.

    There are three categories of spatial operations:

    single-pixel operations neighborhood operations geometric spatial transformations

    Single-pixel operations

    - change the values of intensity for the individual pixels ( )s T z

    where z is the intensity of a pixel in the original image and s is the intensity of the

    corresponding pixel in the processed image.

  • Digital Image Processing

    Course 3

    Neighborhood operations

    Let Sxy denote a set of coordinates of a neighborhood centered on an arbitrary point (x,y)

    in an image, f. Neighborhood processing generates an new intensity level at point (x,y)

    based on the values of the intensities of the points in Sxy. For example, if Sxy is a

    rectangular neighborhood of size m x n centered in (x,y), we can assign the new value of

    intensity by computing the average value of the pixels in Sxy.

    ( , )

    1( , ) ( , )xyr c S

    g x y f r cm n

    The net effect is to perform local blurring in the original image. This type of process is

    used, for example, to eliminate small details and thus render blobs corresponding to the

    largest region of an image.

  • Digital Image Processing

    Course 3

    Geometric spatial transformations and image registration

    - modify the spatial relationship between pixels in an image

    - these transformations are often called rubber-sheet transformations (analogous to

    printing an image on a sheet of rubber and then stretching the sheer according to a

    predefined set of rules.

    A geometric transformation consists of 2 basic operations:

    (a) a spatial transformation of coordinates

    (b) intensity interpolation that assign intensity values to the spatial transformed

    pixels

    The coordinates transformation: ( , ) [( , )]x y T v w

    (v,w) pixel coordinates in the original image

    (x,y) pixel coordinates in the transformed image

  • Digital Image Processing

    Course 3

    [( , )] ( , )2 2v wT v w shrinks the original image half its size in both spatial directions

    Affine transform

    11 1211 21 31

    21 2212 22 33

    31 32

    0[ , ,1] [ , ,1] [ , ,1] 0

    1

    t tx t v t w t

    x y v w T v w t ty t v t w t

    t t

    (AT)

    This transform can scale, rotate, translate, or sheer a set of coordinate points, depending

    on the elements of the matrix T. If we want to resize an image, rotate it, and move the

    result to some location, we simply form a 3x3 matrix equal to the matrix product of the

    scaling, rotation, and translation matrices from Table 1.

  • Digital Image Processing

    Course 3

    Affine transformations

  • Digital Image Processing

    Course 3

    The preceding transformations relocate pixels on an image to new locations. To complete

    the process, we have to assign intensity values to those locations. This task is done by

    using intensity interpolation (like nearest neighbor, bilinear, bicubic interpolation).

    In practice, we can use equation (AT) in two basic ways:

    forward mapping : scanning the pixels of the input image and, at each location (v,w), computing the spatial location (x,y) of the corresponding in the image using (AT)

    directly;

    Problems:

    - intensity assignment when 2 or more pixels in the original image are transformed to the

    same location in the output image,

    - some output locations have no correspondent in the original image (no intensity

    assignment)

  • Digital Image Processing

    Course 3

    inverse mapping: scans the output pixel locations, and at each location, (x,y), computes the corresponding location in the input image (v,w)

    1( , ) ( , )v w T x y It then interpolates among the nearest input pixels to determine the intensity of the output

    pixel value.

    Inverse mapping are more efficient to implement than forward mappings and are used in

    numerous commercial implementations of spatial transformations (MATLAB for ex.).

  • Digital Image Processing

    Course 3

  • Digital Image Processing

    Course 3

    Image registration align two or more images of the same scene

    In image registration, we have available the input and output images, but the specific

    transformation that produced the output image from the input is generally unknown.

    The problem is to estimate the transformation function and then use it to register the two

    images.

    - it may be of interest to align (register) two or more image taken at approximately the

    same time, but using different imaging systems (MRI scanner, and a PET scanner).

    - align images of a given location, taken by the same instrument at different moments of

    time (satellite images)

    Solving the problem: using tie points (also called control points), which are

    corresponding points whose locations are known precisely in the input and reference

    image.

  • Digital Image Processing

    Course 3

    How to select tie points?

    - interactively selecting them

    - use of algorithms that try to detect these points

    - some imaging systems have physical artifacts (small metallic objects) embedded in the

    imaging sensors. These objects produce a set of known points (called reseau marks)

    directly on all images captured by the system, which can be used as guides for

    establishing tie points.

    The problem of estimating the transformation is one of modeling. Suppose we have a set

    of 4 tie points both on the input image and the reference image. A simple model based on

    a bilinear approximation is given by:

    1 2 3 4

    5 6 7 8

    x c v c w c v w cy c v c w c v w c

    (v,w) and (x,y) are the coordinates of the tie points (we get a 8x8 linear system for {ci })

  • Digital Image Processing

    Course 3

    When 4 tie points are insufficient to obtain satisfactory registration, an approach used

    frequently is to select a larger number of tie points and using this new set of tie points

    subdivide the image in rectangular regions marked by groups of 4 tie points. On the

    subregions marked by 4 tie points we applied the transformation model described above.

    The number of tie points and the sophistication of the model required to solve the register

    problem depend on the severity of the geometrical distortion.

  • Digital Image Processing

    Course 3

    a b c d (a) reference image (b) geometrically distorted image (c) - registered image (d) difference between (a) and (c)

  • Digital Image Processing

    Course 3

    Probabilistic Methods

    zi = the values of all possible intensities in an MxN digital image, i=0,1,,L-1

    p(zk) = the probability that the intensity level zk occurs in the given image

    ( ) kknp z

    M N

    nk = the number of times that intensity zk occurs in the image (MN is the total number of

    pixels in the image) 1

    0( ) 1

    L

    kk

    p z

    The mean (average) intensity of an image is given by: 1

    0( )

    L

    k kk

    m z p z

  • Digital Image Processing

    Course 3

    The variance of the intensities is: 1

    2 2

    0( ) ( )

    L

    k kk

    z m p z

    The variance is a measure of the spread of the values of z about the mean, so it is a

    measure of image contrast. Usually, for measuring image contrast the standard deviation

    ( ) is used. The n-th moment of a random variable z about the mean is defined as:

    1

    0( ) ( ) ( )

    Ln

    n k kk

    z z m p z

    ( 20 1 2( ) 1 , ( ) 0 , ( )z z z )

    3( ) 0z the intensities are biased to values higher than the mean ; ( 3( ) 0z the intensities are biased to values lower than the mean) ;

  • Digital Image Processing

    Course 3

    3( ) 0z the intensities are distributed approximately equally on both side of the mean

    Fig.1 (a) Low contrast (b) medium contrast (c) high contrast

    Figure 1(a) standard deviation 14.3 (variance = 204.5) Figure 1(b) standard deviation 31.6 (variance = 998.6) Figure 1(c) standard deviation 49.2 (variance = 2420.6)

  • Digital Image Processing

    Course 3

    Intensity Transformations and Spatial Filtering

    ( , ) ( , )g x y T f x y f(x,y) input image , g(x,y) output image , T an operator on f defined over a

    neighborhood of (x,y).

    - the neighborhood of the point (x,y), Sxy usually is rectangular, centered on (x,y), and

    much smaller in size than the image

  • Digital Image Processing

    Course 3

    - spatial filtering, the operator T (the neighborhood and the operation applied on it) is

    called spatial filter (spatial mask, kernel, template or window)

    {( , )}xyS x y T becomes an intensity (gray-level or mapping) transformation function ( )s T r

    s and r are denoting, respectively, the intensity of g and f at (x,y).

    Figure 2 left - T produces an output image of higher contrast than the original, by

    darkening the intensity levels below k and brightening the levels above k this technique

    is called contrast stretching.

    Fig. 2 Intensity transformation functions. left - contrast stretching right - thresholding function

  • Digital Image Processing

    Course 3

    Figure 2 right - T produces a binary output image. A mapping of this form is called

    thresholding function.

    Some Basic Intensity Transformation Functions

    Image Negatives

    The negative of an image with intensity levels in [0 , L-1] is obtain using the function ( ) 1s T r L r

    - equivalent of a photographic negative

    - technique suited for enhancing white or gray detail embedded in dark regions of an

    image

  • Digital Image Processing

    Course 3

    Fig. 3 Left original digital mammogram Right negative transformed image

  • Digital Image Processing

    Course 3

    Log Transformations - constant ,( ) log(1 ) , 0s T r c r c r

    Some basic intensity transformation functions

  • Digital Image Processing

    Course 3

    This transformation maps a narrow range of low intensity values in the input into a wider

    range. An operator of this type is used to expand the values of dark pixels in an image

    while compressing the higher-level values. The opposite is true for the inverse log

    transformation. The log functions compress the dynamic range of images with large

    variations in pixel values.

    Figure 4(a) intensity values in the range 0 to 1.5 x 106

    Figure 4(b) = log transformation of Figure 4(a) with c=1 range 0 to 6.2

    a b (a) Fourier spectrum (b) log transformation applied to (a), c=1 Fig. 4

  • Digital Image Processing

    Course 3

    Power-Law (Gamma) Transformations

    - positive constants( ) , , ( ( ) )s T r c r c s c r

    Plots of gamma transformation for different values of (c=1)

  • Digital Image Processing

    Course 3

    Power-law curves with 1 map a narrow range of dark input values into a wider range of output values, with the opposite being true for higher values of input values. The

    curves with 1 have the opposite effect of those generated with values of 1 . 1c - identity transformation.

    A variety of devices used for image capture, printing, and display respond according to a

    power law. The process used to correct these power-law response phenomena is called

    gamma correction.

  • Digital Image Processing

    Course 3

    a b c d (a) aerial image (b) (d) results of applying gamma transformation with c=1 and =3.0, 4.0 and 5.0 respectively

  • Digital Image Processing

    Course 3

    Piecewise-Linear Transformations Functions

    Contrast stretching

    - a process that expands the range of intensity levels in an image so it spans the full

    intensity range of the recording tool or display device

    a b c d Fig.5

  • Digital Image Processing

    Course 3

    11

    1

    2 1 1 21 2

    2 1 2 1

    22

    2

    [0, ]

    ( ) ( )( ) [ , ]( ) ( )

    ( 1 ) [ , 1]( 1 )

    s r r rrs r r s r rT r r r r

    r r r rs L r r r L

    L r

  • Digital Image Processing

    Course 3

    1 1 2 2,r s r s identity transformation (no change) 1 2 1 2, 0 , 1r r s s L thresholding function

    Figure 5(b) shows an 8-bit image with low contrast.

    Figure 5(c) - contrast stretching, obtained by setting the parameters 1 1 min, ,0r s r , 2 2 max, , 1r s r L where rmin and rmax denote the minimum and maximum gray levels in the image, respectively. Thus, the transformation function stretched the levels linearly

    from their original range to the full range [0, L-1].

    Figure 5(d) - the thresholding function was used 1 1, ,0r s m , 2 2, , 1r s m L where m is the mean gray level in the image.

    The original image on which these results are based is a scanning electron microscope

    image of pollen, magnified approximately 700 times.

  • Digital Image Processing

    Course 3

    Intensity-level slicing

    - highlighting a specific range of intensities in an image

    There are two approaches for intensity-level slicing:

    1. display in one value (white, for example) all the values in the range of interest and in

    another (say, black) all other intensities (Figure 3.11 (a))

    2. brighten (or darken) the desired range of intensities but leaves unchanged all other

    intensities in the image (Figure 3.11 (b)).

  • Digital Image Processing

    Course 3

    Figure 6 (left) aortic angiogram near the kidney. The purpose of intensity slicing is to

    highlight the major blood vessels that appear brighter as a result of injecting a contrast

    medium. Figure 6(middle) shows the result of applying technique 1. for a band near the

    top of the scale of intensities. This type of enhancement produces a binary image which is

    useful for studying the shape of the flow of the contrast substance (to detect blockages)

    Highlights intensity range [A ,B] and reduces all other intensities to a lower level

    Highlights range [A,B] and preserves all other intensities

  • Digital Image Processing

    Course 3

    In Figure 3.12(right) the second technique was used: a band of intensities in the mid-

    gray image around the mean intensity was set to black, the other intensities remain

    unchanged.

    Fig. 6 - Aortic angiogram and intensity sliced versions

  • Digital Image Processing

    Course 3

    Bit-plane slicing

    For a 8-bit image, f(x,y) is a number in [0,255], with 8-bit representation in base 2

    This technique highlights the contribution made to the whole image appearances by each

    of the bits. An 8-bit image may be considered as being composed of eight 1-bit planes

    (plane 1 the lowest order bit, plane 8 the highest order bit)

  • Digital Image Processing

    Course 3

  • Digital Image Processing

    Course 3

    The binary image for the 8-th bit plane of an 8-bit image can be obtained by processing the input image with a threshold intensity transformation function that maps all the intensities between 0 and 127 to 0 and maps all levels between 128 and 255 to 1. The bit-slicing technique is useful for analyzing the relative importance of each bit in the image helps in determining the proper number of bits to use when quantizing the image. The technique is also useful for image compression.

  • Digital Image Processing

    Course 3

    Histogram processing

    The histogram of a digital image is with intensity levels in [0 , L-1]:

    the -th intensity levelthe number of pixels in the image with intensity

    ( ) , 0,1,..., 1k kk

    k k

    h r n k Lr kn r

    Normalized histogram for an M x N digital image:

    ( ) , 0,1,..., 1kknp r k L

    MN

    ( )kp r = an estimate of the probability of occurrence of intensity level kr in the image

    1

    0( ) 1

    L

    kk

    p r

  • Digital Image Processing

    Course 3

    Fig. 8 dark and light images, low-contrast, and high-contrast images and their histograms

  • Digital Image Processing

    Course 3

    Histogram Equalization

    - determine a transformation function that seeks to produce an output image that has a

    uniform histogram ( ) , 0 1s T r r L

    (a) T(r) monotonically increasing

    (b) for 0 ( ) 1 0 1T r L r L T(r) monotonically increasing guarantees that intensity values in output image will not

    be less than the corresponding input values

    Relation (b) requires that both input and output images have the same range of intensities

  • Digital Image Processing

    Course 3

    Histogram equalization or histogram linearization transformation

    0 0

    ( 1)( ) 1 ( )k k

    k k r j jj j

    Ls T r L p r nM N

    The output image is obtained by mapping each pixel in the input image with intensity rk

    into a corresponding pixel with intensity sk in the output image.

    Consider the following example: 3-bit image (L=8), 64x64 image (M=N=64, MN=4096)

    Intensity distribution and histogram values for a 3-bit 6464 digital image

  • Digital Image Processing

    Course 3 0

    0 0 00

    ( ) 7 ( ) 7 ( ) 1.33r j rj

    s T r p r p r

    1

    1 1 0 10

    ( ) 7 ( ) 7 ( ) 7 ( ) 3.08r j r rj

    s T r p r p r p r

    2 3 4 5 6 74.55 , 5.67 , 6.23 , 6.65 , 6.86 , 7.00s s s s s s

    0 4

    1 5

    2 6

    3 7

    1.33 1 6.23 63.08 3 6.65 74.55 5 6.86 75.67 6 7.00 7

    s ss ss ss s

  • Digital Image Processing

    Course 3

  • Digital Image Processing

    Course 3

  • Digital Image Processing

    Course 3

    Histogram Matching (Specification)

    Sometimes is useful to be able to specify the shape of the histogram that we wish the

    output image to have. The method used to generate a processed image that has a specified

    histogram is called histogram matching or histogram specification.

    Suppose {zq;q=0,,L-1} are the new values of histogram we desire to match.

    Consider the histogram equalization transformation for the input image:

    0 0

    ( 1)( ) 1 ( ) , 0,1,..., 1k k

    k k r j jj j

    Ls T r L p r n k LM N (1)

    Consider the histogram equalization transformation for the new histogram:

    0

    ( ) 1 ( ) , 0,1, ..., 1q

    q z ii

    G z L p z q L

    (2) for some value of

    1

    ( ) ( )

    ( )k k q

    q k

    T r s G z q

    z G s

  • Digital Image Processing

    Course 3

    Histogram-specification procedure:

    1) Compute the histogram pr(r) of the input image, and compute the histogram

    equalization transformation (1). Round the resulting values sk to integers in [0, L-1]

    2) Compute all values of the transformation function G using relation (2), where pz(zi)

    are the values of the specified histogram. Round the values G(zq) to integers in the

    range [0, L-1] and store these values in a table

    3) For every value of sk ,k=0,1,,L-1 use the table for the values of G to find the

    corresponding value of zq so that G(zq) is closest to sk and store these mappings

    from s to z. When more than one value of zq satisfies the property (i.e., the mapping

    is not unique), choose the smallest value by convention.

    4) Form the histogram-specified image by first histogram-equalizing the input image

    and then mapping every equalized pixel value, sk , of this image to the corresponding

    value zq in the histogram-specified image using the mappings found at step 3).

  • Digital Image Processing

    Course 3

    The intermediate step of equalizing the input image can bin skipped by combining the

    two transformation functions T and G-1.

    Reconsider the above example:

    Fig. 9

  • Digital Image Processing

    Course 3

    Figure 9(a) shows the histogram of the original image. Figure 9 (b) is the new histogram

    to achieve.

    The first step is to obtain the scaled histogram-equalized values:

    0 4

    1 5

    2 6

    3 7

    1 63 75 76 7

    s ss ss ss s

    Then we compute the values of G: 0

    0 1 2 30

    4 5 6 7

    ( ) 7 ( ) 0.00 , ( ) ( ) 0.00 , ( ) 1.05 1

    ( ) 2.45 2 , ( ) 4.55 5, ( ) 5.95 6 , ( ) 7.00 7

    z ii

    G z p z G z G z G z

    G z G z G z G z

  • Digital Image Processing

    Course 3

    The results of performing step 3) of the procedure are summarized in the next table:

    In the last step of the algorithm, we use the mappings in the above table to map every

    pixel in the histogram equalized image into a corresponding pixel in the newly-created

  • Digital Image Processing

    Course 3

    histogram-specified image. The values of the resulting histogram are listed in the third

    column of Table 3.2, and the histogram is sketched in Figure 9(d).

    0

    1 0

    21

    32

    43 4

    5

    5 6 76

    7

    0 7901 1023 1 790 32 850 3 1023 43 656

    5 850 54 329

    6 656 329 65 2457 245 122 81 76 122

    7 81

    q

    q

    q

    q

    q

    rr s zr s zr

    s zr

    s s zrs s s zr

    r

  • Digital Image Processing

    Course 3

    Local Histogram Processing

    The histogram processing techniques previously described are easily adaptable to local enhancement. The procedure is to 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 of the neighborhood region is then moved to an adjacent pixel location and the procedure is repeated. Updating the histogram obtained in the previous location with the new data introduced at each motion step is possible.

  • Digital Image Processing

    Course 3

  • Digital Image Processing

    Course 3

    Using Histogram Statistics for Image Enhancement

    Let r denote a discrete random variable representing discrete gray-levels in [0, L-1], and

    let p(ri) 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: 1

    0( ) ( ) ( )

    Ln

    n i ii

    r r m p r

    m is the mean (average intensity) value of r:

    - measure of average intensity1

    0( )

    L

    i ii

    m r p r

    measure of contrast1

    2 22

    0( ) ( ) ( ) ,

    L

    i ii

    r r m p r

    Sample mean and sample variance:

    1 1 1 1 220 0 0 0

    1 1( , ) , ( , )M N M N

    x y x ym f x y f x y m

    M N M N

  • Digital Image Processing

    Course 3

    Spatial Filtering The name filter is borrowed from frequency domain processing, where filtering means

    accepting (passing) or rejecting certain frequency components. Filters that pass low

    frequency are called lowpass filters. A lowpass filter has the effect of blurring

    (smoothing) an image. The filters are also called masks, kernels, templates or windows.

    The Mechanics of Spatial Filtering

    A spatial filter consists of:

    1) a neighborhood (usually a small rectangle)

    2) a predefined operation performed on the pixels in the neighborhood

    Filtering creates a new pixel with the same coordinates as the pixel in the center of the

    neighborhood, and whose intensity value is modified by the filtering operation.

  • Digital Image Processing

    Course 3

    If the operation performed on the image pixels is linear, the filter is called linear spatial

    filter, otherwise the filter is nonlinear.

    Fig. 10 Linear spatial filtering with a 3 3 filter mask

  • Digital Image Processing

    Course 3

    In Figure 10 is pictured a 3 3 linear filter: ( , ) ( 1, 1) ( 1, 1) ( 1,0) ( 1, )

    (0,0) ( , ) (1,1) ( 1, 1)g x y w f x y w f x y

    w f x y w f x y

    For a mask of size m n, we assume m=2a+1 and n=2b+1, where a and b are positive integers. The general expression of a linear spatial filter of an image of size M N with a filter of size m n is:

    ( , ) ( , ) ( , )a b

    s a t bg x y w s t f x s y t

    Spatial Correlation and Convolution Correlation is the process of moving a filter mask over the image and computing the sum

    of products at each location. Convolution is similar with correlation, except that the filter

    is first rotated by 180.

  • Digital Image Processing

    Course 3

    Correlation

    ( , ) ( , ) ( , ) ( , )a b

    s a t bw x y f x y w s t f x s y t

    Convolution

    ( , ) ( , ) ( , ) ( , )a b

    s a t bw x y f x y w s t f x s y t

    A function that contains a single 1 and the rest being 0s is called a discrete unit

    impulse. Correlating a function with a discrete unit impulse produces a rotated

    version of the filter at the location of the impulse.

    Linear filters can be found in DIP literature also as: convolution filter,

    convolution mask or convolution kernel.

  • Digital Image Processing

    Course 3

    Vector Representation of Linear Filtering

    1 1 2 21

    mnT

    mn mn k kk

    R w z w z w z w z w z

    Where the w-s are the coefficients of an mn filter and the z-s are the corresponding image intensities encompassed by the filter.

    9

    91 1 2 2 9 9

    1, ,Tk k

    kR w z w z w z w z w z w z

  • Digital Image Processing

    Course 3

    Smoothing Linear Filters

    A smoothing linear filter computes the average of the pixels contained in the

    neighborhood of the filter mask. These filters are called sometimes averaging filters or

    lowpass filters.

    The process of replacing the value of every pixel in an image by the average of the

    intensity levels in the neighborhood defined by the filter mask produces an image with

    reduced sharp transitions in intensities. Usually random noise is characterized by such

    sharp transitions in intensity levels smoothing linear filters are applied for noise reduction. The problem is that edges are also characterized by sharp intensity transitions, so

    averaging filters have the undesirable effect that they blur edges.

    A major use of averaging filters is the reduction of irrelevant detail in an image (pixel

    regions that are small with respect to the size of the filter mask).

  • Digital Image Processing

    Course 3

    There is the possibility of using weighted average: the pixels are multiplied by different

    coefficients, thus giving more importance (weight) to some pixels at the expense of other.

    A general weighted averaging filter of size m n (m and n are odd) for an MN image is given by the expression:

    ( , ) ( , )( , ) 0,1, ..., 1 , 0,1,..., 1

    ( , )

    a b

    s a t ba b

    s a t b

    w s t f x s y tg x y x M y N

    w s t

  • Digital Image Processing

    Course 3

    a b c d e f (a) original image 500500 (b) (f) results of smoothing with square averaging filters of size m=3,5,9,15, and 35, respectively The black squares at the top are of size 3, 5, 9, 15, 25, 35, 45, 55. The letters at the bottom range in size from 10 cu 24 points. The vertical bars are 5 pixels wide and 100 pixels high, separated bu 20 pixels. The diameter of the circles is 25 pixels, and their borders are 15 pixels apart. The noisy rectangles are 50120 pixels.

  • Digital Image Processing

    Course 3

    An important application of spatial averaging is to blur an image for the purpose of

    getting a gross representation of objects of interest, such that the intensity of smaller

    objects blends with the background and larger object become blob like and easy to

    detect. The size of the mask establishes the relative size of the objects that will

    disappear in the background.

    Left image from the Hubble Space Telescope, 528485; Middle Image filtered with a 1515 averaging mask;

    Right result of averaging the middle image

  • Digital Image Processing

    Course 4

  • Digital Image Processing

    Course 4

    Order-Statistic (Nonlinear) Filters

    Order-statistic filters are nonlinear spatial filters based on

    ordering (ranking) the pixels contained in the image area defined

    by the selected neighborhood and replacing the value of the center

    pixel with the value determined by the ranking result. The best

    known filter in this class is the median filter, which replaces the

    value of a pixel by the median of the intensity values in the

    neighborhood of that pixel (the original value of the pixel is

    included in the computation of the median). Median filters provide

  • Digital Image Processing

    Course 4

    excellent noise-reduction capabilities, and are less blurring than

    linear smoothing filters of similar size. Median filters are

    particularly effective against impulse noise (also called

    salt-and-pepper noise).

    The median,, of a set of values is such that half the values in the set are less than or equal to , and half are greater than or equal to . For a 3 3 neighborhood with intensity values (10, 15, 20, 20, 30, 20, 20, 25, 100) the median is =20.

  • Digital Image Processing

    Course 4

    The effect of median filter is to force points with distinct intensity

    levels to be more like their neighbors. Isolated clusters of pixels

    that are light or dark with respect to their neighbors, and whose

    area is less than 2

    2m are eliminated by an m m median filter

    (eliminated means forced to the median intensity of the neighbors).

    Max/min filter is the filter which replaces the intensity value of the

    pixel with the max/min value of the pixels in the neighborhood.

    The max/min filter is useful for finding the brightest/darkest points

    in an image.

  • Digital Image Processing

    Course 4

    Min filter 0% filter

    Median filter 50% filter

    Max filter 100% filter

    (a) (b) (c) (a) X-ray image of circuit board corrupted by salt&pepper noise (b) noise reduction with a 33 averaging filter (c) noise reduction with a 33 median filter

  • Digital Image Processing

    Course 4

    Sharpening Spatial Filters

    The principal objective of sharpening is to highlight transitions in

    intensity. These filters are applied in electronic printing, medical

    imaging, industrial inspection, autonomous guidance in military

    systems.

    Averaging analogous to integration

    Sharpening spatial differentiation

    Image differentiation enhances edges and other discontinuities

    (noise, for example) and deemphasizes areas with slowly varying

    intensities.

  • Digital Image Processing

    Course 4

    For digital images, discrete approximation of derivatives are used

    ( 1) ( )f f x f xx

    2

    2 ( 1) 2 ( ) ( 1)f f x f x f x

    x

  • Digital Image Processing

    Course 4

    Illustration of the first and second derivatives of a 1-D digital function

  • Digital Image Processing

    Course 4

    Using the Second Derivative for Image Sharpening

    the Laplacian Isotropic filters the response of this filter is independent of the

    direction of the discontinuities in the image. Isotropic filters are

    rotation invariant, in the sense that rotating the image and then

    applying the filter gives the same result as applying the filter to the

    image and then rotating the result.

    The simplest isotropic derivative operator is the Laplacian: 2 2

    22 2f ff

    x y

  • Digital Image Processing

    Course 4

    This operator is linear. 2

    2 ( 1, ) 2 ( , ) ( 1, )f f x y f x y f x y

    x

    2

    2 ( , 1) 2 ( , ) ( , 1)f f x y f x y f x y

    y

    2 ( , ) ( 1, ) ( 1, ) ( , 1) ( , 1) 4 ( , )f x y f x y f x y f x y f x y f x y

  • Digital Image Processing

    Course 4

    Filter mask that approximate the Laplacian

    The Laplacian being a derivative operator highlights gray-level

    discontinuities in an image and deemphasizes regions with slowly

    varying gray levels. This will tend to produce images that have

  • Digital Image Processing

    Course 4

    grayish edge lines and other discontinuities, all superimposed on a

    dark, featureless background. Background features can be

    recovered while still preserving the sharpening effect of the

    Laplacian operation simply by adding the original and Laplacian

    images.

    The basic way to use the Laplacian for image sharpening is given

    by: 2( , ) ( , ) ( , )g x y f x y c f x y

    The (discrete) Laplacian can contain both negative and positive

    values it needs to be scaled.

  • Digital Image Processing

    Course 4

    Blurred image of the North Pole of the Moon; Lapalce filtered image

    Sharpening with c=1 and c=2

  • Digital Image Processing

    Course 4

    Unsharp Masking and Highboost Filtering

    - process used in printing and publishing industry to sharpen

    images

    - subtracting an unsharp (smoothed) version of an image from

    the original image

    1.Blur the original image

    2.Subtract the blurred image from the original (the resulting

    difference is called the mask)

    3.Add the mask to the original

  • Digital Image Processing

    Course 4

    Let ( , )f x y be the blurred image. The mask is given by:

    mask ( , ) ( , ) ( , )g x y f x y f x y mask( , ) ( , ) ( , )g x y f x y k g x y

    k = 1 unsharp masking

    k > 1 highboost filtering

  • Digital Image Processing

    Course 4

    original image

    blurred image (Gaussian filter 55, =3)

    mask difference between the above images

    unsharp masking result

    highboost filter result (k=4.5)

  • Digital Image Processing

    Course 4

    The Gradient for (Nonlinear) Image Sharpening

    ( ) xy

    fg xf grad f fg

    y

    - it points in the direction of the greatest rate of change of f at

    location (x,y).

    The magnitude (length) of the gradient is defined as:

    mag( 2 2( , ) ) x yM x y f g g

  • Digital Image Processing

    Course 4

    M(x,y) is an image of the same size as the original called the

    gradient image (or simply as the gradient). M(x,y) is rotation

    invariant (isotropic) (the gradient vector f is not isotropic). In some application the following formula is used:

    (not isotropic)( , ) x yM x y g g Different ways of approximating and x yg g produce different filter

    operators.

  • Digital Image Processing

    Course 4

    Roberts cross-gradient operator (1965)

    1( 1, 1) ( , )xg f x y f x y

    2( , 1) ( 1, )yg f x y f x y 2 21 2( , )M x y

    1 2( , )M x y

  • Digital Image Processing

    Course 4

    Sobel operators

    ( 1, 1) 2 ( , 1) ( 1, 1)

    ( 1, 1) 2 ( , 1) ( 1, 1)xg f x y f x y f x y

    f x y f x y f x y

    ( 1, 1) 2 ( 1, ) ( 1, 1)

    ( 1, 1) 2 ( 1, ) ( 1, 1)yg f x y f x y f x y

    f x y f x y f x y

  • Digital Image Processing

    Course 4

    Roberts cross gradient operators

    Sobel operators

  • Digital Image Processing

    Course 4

    Filtering in the Frequency Domain

    Filter: a device or material for suppressing or minimizing waves or

    oscillations of certain frequencies

    Frequency: the number of times that a periodic function repeats the

    same sequence of values during a unit variation of the independent

    variable

    Fourier series and Transform

    Fourier in a memoir in 1807 and published in 1822 in his book La

    Thorie Analitique de la Chaleur states that any periodic function

    can be expressed as the sum of sines and/or cosines of different

  • Digital Image Processing

    Course 4

    frequencies, each multiplied by a different coefficient (called now

    a Fourier series). Even function that are not periodic (but whose

    area under the curve is finite) can b