Digital Image Processing Part 2: Image Enhancement in the Spatial Domain AASS Learning Systems Lab, Dep. Teknik Room T1209 (Fr, 11-12 o'clock) achim.lilienthal@oru.se Course Book Chapter 3 2011-04-06
Contents 1. Image Enhancement in the Spatial Domain 2. Grey Level Transformations 3. Histogram Processing 4. Operations Involving Multiple Images 5. Spatial Filtering
Contents Image Enhancement in the Spatial Domain
1 Image Enhancement in the Spatial Domain Image Enhancement image processing the result is supposed to be "more suitable" "more suitable" according to a certain application more suitable for visual interpretation
1 Image Enhancement in the Spatial Domain We want to create an image which is "better" in some sense. helps visual interpretation (brightening, sharpening ) subjective pre-processing for a subsequent image analysis algorithm performance metric (performance of a task) make the image more "specific" application dependent T f(x,y) g(x,y) original image (or set of images) new image
1 Image Enhancement in the Spatial Domain Spatial Domain versus Frequency Domain spatial domain direct manipulation of the pixels discussed in this lecture two types of transformations in the spatial domain: pixel brightness transformations, point processing (depend only on the pixel value itself) spatial filters, local transformations or local processing (depend on a small neighbourhood around the pixel) frequency domain: modifications of the Fourier transform discussed in the next lectures
1 Image Enhancement in the Spatial Domain Transformations in the Spatial Domain g( x, y) T[ f ( x, y)] standard approach: T is applied to a sub-image centred at (x,y) sub-image is called mask (kernel, filter, template, window) mask processing or filtering T can operate on a set of images
1 Image Enhancement in the Spatial Domain Transformations in the Spatial Domain g( x, y) T[ f ( x, y)] fill new array with weighted sum of pixel values from the locations surrounding the corresponding location in the image using the same set of weights each time
Contents Gray Level Transformations
2 Grey Level Transformations Grey Level Transformations simplest case: each pixel in the output image depends only on the corresponding pixel in the input image 1x1 neighbourhood (point processing) example: contrast stretching s T (r) s T (r)
2 Grey Level Transformations Grey Level Transformations contrast stretching thresholding
2 Grey Level Transformations Grey Level Transformations f = imread('bubbles.tif'); fp = imadjust(f, [0.1 0.9], [1.0 0.0], 0.5); imshow(fp); imadjust parameters always specified in [0,1] values below 0.1 clipped to 1.0 values above 0.9 clipped to 0.0 image intensity reversed since 0.0 < 1.0
2 Grey Level Transformations Grey Level Transformations f = imread('bubbles.tif'); fp = imadjust(f, [0.1 0.9], [1.0 0.0], 0.5); imshow(fp); imadjust parameters always specified in [0,1] values below 0.1 clipped to 1.0 values above 0.9 clipped to 0.0 image intensity reversed since 0.0 < 1.0 gamma function parameter < 1 g f
2 Grey Level Transformations Grey Level Transformations f = imread('bubbles.tif'); fp = imadjust(f, [0.1 0.9], [1.0 0.0], 0.5); imshow(fp); fp = imadjust(f, [0.55 0.9], [1.0 0.0], 3);
2 Grey Level Transformations Grey Level Transformations f = imread('bubbles.tif'); fp = imadjust(f, [0.1 0.9], [1.0 0.0], 0.5); imshow(fp); fp = imadjust(f, [0.55 0.9], [1.0 0.0], 3); imadjust gamma function parameter > 1 g f
2 Grey Level Transformations Contrast Stretching piecewise linear function power law transformation (gamma transformation) s cr
2 Grey Level Transformations Common Grey Level Transformations (Single Image) linear identity inverse (negative) power law n. power n. root logarithmic
2 Grey Level Transformations Common Grey Level Transformations (Single Image) inverse transform
2 Grey Level Transformations Contrast Stretching piecewise linear function
2 Grey Level Transformations Common Grey Level Transformations (Single Image) linear identity inverse power law (gamma) n. power n. root logarithmic... with more than one input image sum, mean statistical operations (variance, t-test )
Contents Histogram Processing
3 Histogram Processing Grey Scale Histogram shows the number of pixels per grey level f = imread('bubbles.tif'); imhist(f); % displays the histogram % histogram display default
3 Histogram Processing Grey Scale Histogram shows the number of pixels per grey level f = imread('bubbles.tif'); h1 = imhist(f); % default number of bins = 256 imhist(f,8); % number of bins = 8
3 Histogram Processing Grey Scale Histogram shows the number of pixels per grey level f = imread('bubbles.tif'); h1 = imhist(f); % default number of bins = 256 h = imhist(f,16); % number of bins = 16 hn = h/numel(f); % normalized histogram % numel num. of elements (pixels) bar(hn) % normalized histogram
3 Histogram Processing Grey Scale Histogram shows the number of pixels per grey level f = imread('bubbles.tif'); h1 = imhist(f); % default number of bins = 256 h = imhist(f,16); % number of bins = 16 hn = h/numel(f); % normalized histogram % numel num. of elements (pixels) bar(hn) % normalized histogram
3 Histogram Processing Grey Scale Histogram neutral transform
3 Histogram Processing Grey Scale Histogram neutral transform inverse transform
3 Histogram Processing Grey Scale Histogram neutral transform inverse transform logarithmic transform
3 Histogram Processing Histogram Equalization contrast / brightness adjustments sometimes need to be automatised "optimal" contrast for an image? flat histogram histogram matching to get a given shape for the histogram (see GW 3.3.2)
3 Histogram Processing Histogram Equalization consider the continuous case: probability density functions (PDFs) of s and r are related by transformation function = cumulative density function (CDF) ds dr s T (r) p s ( s) r p r ( r) s, r [0,1] dr ds T ( r) p r ( ) d 0 gray levels as random variables! p r 1 ( r) T( r) r d T( r) pr ( ) d pr ( r) p s ( s) 1 dr 0
Histogram Equalization discrete case does not generally produce a uniform PDF tends to spread the histogram enables automatic contrast stretching n n r p k k r ) ( k j j k j j r k k n n r p r T s 0 0 ) ( ) ( Histogram Processing 3
3 Histogram Processing Histogram Equalization CDF
3 Histogram Processing Histogram Equalization
3 Histogram Processing Histogram Equalization f = imread('bubbles.tif'); g = histeq(f, 256); imshow(g); f = imread('bubbles.tif'); g = histeq(f, 4); % 4 output levels imshow(g);
3 Histogram Processing Adaptive / Localized Histogram Equalization transform a single pixel by histogram equalization calculated over a square or rectangular neighbourhood original image http://www.cromwell-intl.com/3d/histogram/index.html global histogram equalization
3 Histogram Processing Adaptive / Localized Histogram Equalization transform a single pixel by histogram equalization calculated over a square or rectangular neighbourhood original image local histogram equalization (radius = 100)
3 Histogram Processing Adaptive / Localized Histogram Equalization transform a single pixel by histogram equalization calculated over a square or rectangular neighbourhood original image local histogram equalization (radius = 50)
3 Histogram Processing Adaptive / Localized Histogram Equalization transform a single pixel by histogram equalization calculated over a square or rectangular neighbourhood original image local histogram equalization (radius = 25)
3 Histogram Processing Adaptive / Localized Histogram Equalization transform a single pixel by histogram equalization calculated over a square or rectangular neighbourhood original image local histogram equalization (radius = 12)
Contents Operations Involving Multiple Images
4 Operations Involving Multiple Images Operations Between Two or More Images image subtraction Arteriography tracking
4 Operations Involving Multiple Images Image Subtraction DSA (Digital Subtraction Arteriography) mask image live image DSA image
4 Operations Involving Multiple Images Operations Between Two or More Images image subtraction Arteriography tracking image averaging (GW 3.4.2) noise reduction background modeling image subtraction
4 Operations Involving Multiple Images Image Subtraction tracking with a stationary camera background image live image difference image
4 Operations Involving Multiple Images Operations Between Two or More Images image subtraction Arteriography tracking image averaging (GW 3.4.2) noise reduction background modeling image subtraction time constant of averaging? (stability plasticity dilemma) recency weighted averaging sample-based background modelling
4 Operations Involving Multiple Images Sample-Based Background Modelling stationary camera no assumptions about the distribution required not sensitive to outliers (robust statistics) Dynamic Sample Set Representation representation as a set of measurements (samples) sample set S(t i ) evolves by replacing samples randomly p u n samples replaced between two time steps probability to have been added n t timesteps before: ln1 u t u e n t (update rate u) t 2 ln ln 1 1/ 2 u ln 2
4 Operations Involving Multiple Images Interpretation of a Dynamic Sample Set! dynamic sample sets correspond to a time scale t 1/ 2 ln 2 n ct c t : time constant p u c t T t : time interval since the last frame p u : sample set update probability Deriving Foreground Probability Images estimate background distribution calculate kernel estimator (Parzen window) background probability according to intensity density estimate foreground probability = 1 - background probability
4 Operations Involving Multiple Images Foreground Probability Images t 1/2 = 1.5 s, = 20 t 1/2 = 115 s, = 20
Contents Introduction Applications People Tracking
1 Introduction Applications Imaging in the Visible and Infrared Bands person tracking in mobile robotics
1 Example: Person Tracking in Mobile Robotics PeopleBoy (ActiveMedia PeopleBot) thermal cam: 320 240 pixels 15 Hz colour camera 320 240 pixels 15 Hz
1 Person Tracking in Mobile Robotics Thermal Camera humans have a distinctive thermal profile not influenced by changing lighting conditions works in darkness Thermo Tracer TH7302, NEC visible range: 24 C to 36 C
1 Person Tracking in Mobile Robotics Thermal Camera humans have a distinctive thermal profile not influenced by changing lighting conditions works in darkness Colour Camera improves accuracy helps to resolve occlusions dynamical colour model
1 Person Tracking in Mobile Robotics Person Tracking no occlusions
1 Person Tracking in Mobile Robotics Person Tracking distinguish persons using an elliptic contour model
1 Person Tracking in Mobile Robotics Person Tracking Measurement Model elliptic contour model! applicable if the person is far away! applicable if side-view is visible
1 Person Tracking in Mobile Robotics Person Tracking no occlusions
1 Person Tracking in Mobile Robotics Person Tracking thermal and colour information occlusions
1 Person Tracking in Mobile Robotics Person Tracking stationary webcam sample-based background subtraction (motion heat) occlusions