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

Slides:



Advertisements
Similar presentations
Image Processing Lecture 4
Advertisements

Transforming images to images
Chapter 3 Image Enhancement in the Spatial Domain.
EE4H, M.Sc Computer Vision Dr. Mike Spann
1Ellen L. Walker ImageJ Java image processing tool from NIH Reads / writes a large variety of images Many image processing operations.
Chapter 4: Image Enhancement
E.G.M. PetrakisFiltering1 Linear Systems Many image processing (filtering) operations are modeled as a linear system Linear System δ(x,y) h(x,y)
Digital Image Processing In The Name Of God Digital Image Processing Lecture3: Image enhancement M. Ghelich Oghli By: M. Ghelich Oghli
5. 1 Model of Image degradation and restoration
Histograms Histogram Equalization Definition: What is a histogram? Histograms count the number of occurrences of each possible value CountGrey level.
Lecture 4 Linear Filters and Convolution
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
6/9/2015Digital Image Processing1. 2 Example Histogram.
1 Image Filtering Readings: Ch 5: 5.4, 5.5, 5.6,5.7.3, 5.8 (This lecture does not follow the book.) Images by Pawan SinhaPawan Sinha formal terminology.
CS 376b Introduction to Computer Vision 02 / 25 / 2008 Instructor: Michael Eckmann.
Image Enhancement.
Vision, Video and Virtual Reality Feature Extraction Lecture 7 Image Enhancement CSC 59866CD Fall 2004 Zhigang Zhu, NAC 8/203A
Image Analysis Preprocessing Arithmetic and Logic Operations Spatial Filters Image Quantization.
Basic Image Processing January 26, 30 and February 1.
02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.
Chapter 2. Image Analysis. Image Analysis Domains Frequency Domain Spatial Domain.
CS 376b Introduction to Computer Vision 02 / 26 / 2008 Instructor: Michael Eckmann.
Neighborhood Operations
Machine Vision ENT 273 Image Filters Hema C.R. Lecture 5.
1 Chapter 8: Image Restoration 8.1 Introduction Image restoration concerns the removal or reduction of degradations that have occurred during the acquisition.
Spatial Filtering: Basics
Digital Image Processing
Filtering and Enhancing Images. Major operations 1. Matching an image neighborhood with a pattern or mask 2. Convolution (FIR filtering)
EE663 Image Processing Dr. Samir H. Abdul-Jauwad Electrical Engineering Department King Fahd University of Petroleum & Minerals.
Digital Image Processing Lecture 5: Neighborhood Processing: Spatial Filtering Prof. Charlene Tsai.
Lecture 03 Area Based Image Processing Lecture 03 Area Based Image Processing Mata kuliah: T Computer Vision Tahun: 2010.
Image processing Fourth lecture Image Restoration Image Restoration: Image restoration methods are used to improve the appearance of an image.
انجمن دانشجویان ایران – مرجع دانلود کتاب ، نمونه سوال و جزوات درسی
School of Computer Science Queen’s University Belfast Practical TULIP lecture next Tues 12th Feb. Wed 13th Feb 11-1 am. Thurs 14th Feb am. Practical.
Digital Image Processing Lecture 10: Image Restoration March 28, 2005 Prof. Charlene Tsai.
CS 556 – Computer Vision Image Basics & Review. What is an Image? Image: a representation, resemblance, or likeness An image is a signal: a function carrying.
Lecture 5 Mask/Filter Transformation 1.The concept of mask/filters 2.Mathematical model of filtering Correlation, convolution 3.Smoother filters 4.Filter.
Machine Vision ENT 273 Image Filters Hema C.R. Lecture 5.
Digital Image Processing Lecture 10: Image Restoration
Ch5 Image Restoration CS446 Instructor: Nada ALZaben.
Introduction TOPIC 6 Image Enhancement.
Intelligent Vision Systems ENT 496 Image Filtering and Enhancement Hema C.R. Lecture 4.
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
Digital Image Processing Lecture 5: Neighborhood Processing: Spatial Filtering March 9, 2004 Prof. Charlene Tsai.
Machine Vision Edge Detection Techniques ENT 273 Lecture 6 Hema C.R.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Filters– Chapter 6. Filter Difference between a Filter and a Point Operation is that a Filter utilizes a neighborhood of pixels from the input image to.
Lecture 10 Chapter 5: Image Restoration. Image restoration Image restoration is the process of recovering the original scene from the observed scene which.
Miguel Tavares Coimbra
- photometric aspects of image formation gray level images
Digital Image Processing Lecture 10: Image Restoration
Practical TULIP lecture next Tues 12th Feb. Wed 13th Feb 11-1 am.
Digital Image Processing
Digital Image Processing
- photometric aspects of image formation gray level images
Histogram Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram has.
Image filtering Hybrid Images, Oliva et al.,
Image Enhancement in the Spatial Domain
Image filtering Images by Pawan Sinha.
Image filtering Images by Pawan Sinha.
Image filtering Images by Pawan Sinha.
Digital Image Processing
Basic Image Processing
Digital Image Processing Week IV
Image filtering
Image filtering
Intensity Transformation
Image Filtering Readings: Ch 5: 5. 4, 5. 5, 5. 6, , 5
Image Enhancement in the Spatial Domain
Presentation transcript:

Introduction to Computer Vision Introduction Zhigang Zhu, City College of New York CSc I6716 Spring 2012 Image Enhancement Part I Feature Extraction (1)

Introduction to Computer Vision What are Image Features? n Local, meaningful, detectable parts of the image.

Introduction to Computer Vision More Color Woes Squares with dots in them are the same color

Introduction to Computer Vision Topics n Image Enhancement l Brightness mapping l Contrast stretching/enhancement l Histogram modification l Noise Reduction l ……... n Mathematical Techniques l Convolution l Gaussian Filtering n Edge and Line Detection and Extraction n Region Segmentation n Contour Extraction n Corner Detection

Introduction to Computer Vision Image Enhancement n Goal: improve the ‘visual quality’ of the image l for human viewing l for subsequent processing n Two typical methods l spatial domain techniques.... u operate directly on image pixels l frequency domain techniques.... u operate on the Fourier transform of the image n No general theory of ‘visual quality’ l General assumption: if it looks better, it is better l Often not a good assumption

Introduction to Computer Vision Spatial Domain Methods n Transformation T l point - pixel to pixel l area - local area to pixel l global - entire image to pixel n Neighborhoods l typically rectangular l typically an odd size: 3x3, 5x5, etc l centered on pixel I(x,y) n Many IP algorithms rely on this basic notion T(I(x,y)) I(x,y)I’(x,y)neighborhood N I’(x,y) = T(I(x,y)) O=T(I)

Introduction to Computer Vision Point Transforms: General Idea O = T(I) Input pixel value, I, mapped to output pixel value, O, via transfer function T INPUT OUTPUT Transfer Function T

Introduction to Computer Vision Grayscale Transforms n Photoshop ‘adjust curve’ command Input gray value I(x,y) Output gray value I’(x,y)

Introduction to Computer Vision Point Transforms: Brightness

Introduction to Computer Vision Point Transforms:Thresholding n T is a point-to-point transformation l only information at I(x,y) used to generate I’(x,y) n Thresholding I max if I(x,y) > t I min if I(x,y) ≤ t I’(x,y) = t=89 t2550 0

Introduction to Computer Vision Point Transforms: Linear Stretch INPUT OUTPUT

Introduction to Computer Vision Linear Scaling n Consider the case where the original image only utilizes a small subset of the full range of gray values: n New image uses full range of gray values. n What's F? {just the equation of the straight line}

Introduction to Computer Vision Linear Scaling n F is the equation of the straight line going through the point (I min, 0) and (I max, K) n useful when the image gray values do not fill the available range. n Implement via lookup tables

Introduction to Computer Vision Scaling Discrete Images n Have assumed a continuous grayscale. n What happens in the case of a discrete grayscale with K levels?

Introduction to Computer Vision Non-Linear Scaling: Power Law n  < 1 to enhance contrast in dark regions n  > 1 to enhance contrast in bright regions. O = I    

Introduction to Computer Vision Square Root Transfer:  =.5

Introduction to Computer Vision  =3.0

Introduction to Computer Vision Examples n Technique can be applied to color images l same curve to all color bands l different curves to separate color bands:

Introduction to Computer Vision Point Transforms:Thresholding n T is a point-to-point transformation l only information at I(x,y) used to generate I’(x,y) n Thresholding I max if I(x,y) > t I min if I(x,y) ≤ t I’(x,y) = t=89 t2550 0

Introduction to Computer Vision Threshold Selection n Arbitrary selection l select visually n Use image histogram Threshold

Introduction to Computer Vision Histograms n The image shows the spatial distribution of gray values. n The image histogram discards the spatial information and shows the relative frequency of occurrence of the gray values.

Introduction to Computer Vision Image Histogram n The histogram typically plots the absolute pixel count as a function of gray value: For an image with dimensions M by N

Introduction to Computer Vision Probability Interpretation n The graph of relative frequency of occurrence as a function of gray value is also called a histogram: n Interpreting the relative frequency histogram as a probability distribution, then:   P(I(x,y) = i) = H(i)/(MxN)

Introduction to Computer Vision Cumulative Density Function n Interpreting the relative frequency histogram as a probability distribution, then: n Curve is called the cumulative distribution function Gray Value P(I(x,y) = i) = H(i)/(MxN)

Introduction to Computer Vision Examples

Introduction to Computer Vision Color Histograms

Introduction to Computer Vision Histogram Equalization n Image histograms consist of peaks, valleys, and low plains n Peaks = many pixels concentrated in a few grey levels n Plains = small number of pixels distributed over a wider range of grey levels

Introduction to Computer Vision Histogram Equalization n The goal is to modify the gray levels of an image so that the histogram of the modified image is flat. l Expand pixels in peaks over a wider range of gray-levels. l “Squeeze” low plains pixels into a narrower range of gray levels. n Utilizes all gray values equally n Example Histogram: l Note low utilization of small gray values

Introduction to Computer Vision Desired Histogram n All gray levels are used equally. n Has a tendency to enhance contrast.

Introduction to Computer Vision Brute Force How are the gray levels in the original image changed to produce the enhanced image? Method 1. Choose points randomly. Method 2. Choice depends on the gray levels of their neighboring points. Computationally expensive. Approximations.

Introduction to Computer Vision Histogram Equalization Mapping from one set of grey-levels, , to a new set, . n Ideally, the number of pixels, N p, occupying each grey level should be: n To approximate this, apply the transform l Where CH is the cumulative histogram (see next slide) l j is the gray value in the source image l i is the gray value in the equalized image N p = M*N G i = MAX 0, round CH(j) NpNp

Introduction to Computer Vision Example ideal G=8 MxN=2400 N p =300 jH(j)CH(j)i CH(j) =  H(i) i=0 j

Introduction to Computer Vision Example

Introduction to Computer Vision Comparison Original  >1 Histogram equalization

Introduction to Computer Vision Why? n Given MxN input image I with gray scale p 0 ….p k and histogram H(p). n Desire output image O with gray scale q 0 ….q k and uniform histogram G(q) n Treat the histograms as a discrete probability density function. Then monotonic transfer function m = T(n) implies: n The sums can be interpreted as discrete distribution functions. From Image Processing, Analysis, and Machine Vision, Sonka et al.  G(q i ) =  H(p j ) i=0 j=0 m n

Introduction to Computer Vision Why? continued n The histogram entries in G must be: (because G is uniform) n Plug this into previous equation to get: n Now translate into continuous domain (can’t really get uniform distributions in the discrete domain) MxN q k - q 0 G(i) =  =  H(p i ) i=0 m n MxN q k - q 0 MxN q k - q 0 =  H(s)ds p0p0 pnpn q0q0 qmqm ds MN(q m -q 0 ) q k - q 0

Introduction to Computer Vision Why? continued n Solve last equation for q to get: n Map back into discrete domain to get: n Leads to an algorithm….. MN q k - q 0 H(s)ds + q 0 p0p0 pnpn q m = T(p) = MN q k - q 0  H(i) + q 0 q m = T(p) = i=p 0 pnpn

Introduction to Computer Vision Histogram Equalization Algorithm n For an NxM image of G gray levels, say l Create image histogram l For cumulative image histogram H c n Set n Rescan input image and write new output image by setting T(p) = round ( H c (p)) G-1 NM g q = T(g p )

Introduction to Computer Vision Observations n Acquisition process degrades image n Brightness and contrast enhancement implemented by pixel operations n No one algorithm universally useful n  > 1 enhances contrast in bright images n  < 1 enhances contrast in dark images n Transfer function for histogram equalisation proportional to cumulative histogram

Introduction to Computer Vision Noise Reduction n What is noise? n How is noise reduction performed? l Noise reduction from first principles l Neighbourhood operators u linear filters (low pass, high pass) u non-linear filters (median) image + noise = ‘grainy’ image

Introduction to Computer Vision Noise n Plot of image brightness. n Noise is additive. n Noise fluctuations are rapid l high frequency. Image Noise Image + Noise

Introduction to Computer Vision Sources of Noise n Sources of noise = CCD chip. n Electronic signal fluctuations in detector. n Caused by thermal energy. n Worse for infra-red sensors. n Electronics n Transmission Radiation from the long wavelength IR band is used in most infrared imaging applications

Introduction to Computer Vision Noise Model 22  n Plot noise histogram n Typical noise distribution is normal or Gaussian n Mean(noise)  = 0 n Standard deviation   (x) = exp   1 2 (x-   2

Introduction to Computer Vision Effect of  n Integral under curve is 1  =10  =20  =30

Introduction to Computer Vision Two Dimensional Gaussian

Introduction to Computer Vision Noise n Noise varies above and below uncorrupted image. Image + Noise

Introduction to Computer Vision Noise Reduction - 1 n How do we reduce noise? n Consider a uniform 1-d image and add noise. n Focus on a pixel neighbourhood. n Averaging the three values should result in a value closer to original uncorrupted data n Especially if gaussian mean is zero A i-1 A i A i+1 Ci Ci

Introduction to Computer Vision Noise Reduction - 1 n Averaging ‘smoothes’ the noise fluctuations. n Consider the next pixel A i+1 n Repeat for remainder of pixels. A i-1 A i A i+1 A i+2 C i+1

Introduction to Computer Vision Neighborhood Operations n All pixels can be averaged by convolving 1-d image A with mask B to give enhanced image C. n Weights of B must equal one when added together. l Why? C = A * B B = [ B1 B2 B3 ] C i = A i-1  B 1 + A i  B 2 + A i+1  B 3 B = [1 1 1] C i = 1 3 A i-1 + A i + A i+1 3

Introduction to Computer Vision 2D Analog of 1D Convolution n Consider the problem of blurring a 2D image n Here’s the image and a blurred version: n How would we do this? l What’s the 2D analog of 1D convolution?

Introduction to Computer Vision 2D Blurring Kernel n C = A * B n B becomes B = 1 9

Introduction to Computer Vision Convolution n Extremely important concept in computer vision, image processing, signal processing, etc. n Lots of related mathematics (we won’t do) n General idea: reduce a filtering operation to the repeated application of a mask (or filter kernel) to the image l Kernel can be thought of as an NxN image l N is usually odd so kernel has a central pixel n In practice l (flip kernel) l Align kernel center pixel with an image pixel l Pointwise multiply each kernel pixel value with corresponding image pixel value and add results l Resulting sum is normalized by kernel weight l Result is the value of the pixel centered on the kernel

Introduction to Computer Vision Image Kernel Result Image Example Kernel is aligned with pixel in image, multiplicative sum is computed, normalized, and stored in result image. n Process is repeated across image. What happens when kernel is near edge of input image?

Introduction to Computer Vision Border Problem n missing samples are zero n missing samples are gray n copying last lines n reflected indexing (mirror) n circular indexing (periodic) n truncation of the result

Introduction to Computer Vision Image size = M 1   N 1 Mask size = M 2   N 2 Convolution size = M 1 - M 2 +1   N 1 -N 2 +1 N1N1 N2N2 N 1 -N 2 +1 Typical Mask sizes = 3  3, 5  5, 7  7, 9  9, 11  11 What is the convolved image size for a 128   128 image and 7  7 mask? Convolution Size

Introduction to Computer Vision Convolution = I M *

Introduction to Computer Vision Properties of Convolution n Commutative: f 1 (t) * f 2 (t) = f 2 (t) * f 1 (t) n Distributive: f 1 (t) * [f 2 (t) + f 3 (t)] = f 1 (t) * f 2 (t) + f 1 (t) * f 3 (t) n Associative: f 1 (t) * [f 2 (t) * f 3 (t)] = [f 1 (t) * f 2 (t)] * f 3 (t) n Shift: if f 1 (t) * f 2 (t) = c(t), then l f 1 (t) * f 2 (t-T) = f 1 (t-T) * f 2 (t) = c(t-T) Convolution with impulse: f(t) *  (t) = f(t) Convolution with shifted impulse: f(t) *  (t-T) = f(t-T)

Introduction to Computer Vision Noise Reduction - 1 Uncorrupted Image Image + Noise Image + Noise - Blurred

Introduction to Computer Vision Noise Reduction - 1 n Technique relies on high frequency noise fluctuations being ‘blocked’ by filter. Hence, low-pass filter. n Fine detail in image may also be smoothed. n Balance between keeping image fine detail and reducing noise.

Introduction to Computer Vision Noise Reduction - 1 n Saturn image coarse detail n Boat image contains fine detail n Noise reduced but fine detail also smoothed

Introduction to Computer Vision hmmmmm….. ImageBlurred Image -=

Introduction to Computer Vision Noise Reduction - 2: Median Filter n Nonlinear Filter n Compute median of points in neighborhood n Has a tendency to blur detail less than averaging n Works very well for ‘shot’ or ‘salt and pepper’ noise OriginalLow-passMedian

Introduction to Computer Vision Noise Reduction - 2 Low-passMedian Low-pass: fine detail smoothed by averaging Median: fine detail passed by filter

Introduction to Computer Vision Edge Preserving Smoothing n Smooth (average, blur) an image without disturbing l Sharpness or l position Of the edges n Nagoa-Maysuyama Filter n Kuwahara Filter n Anisotropic Diffusion Filtering (Perona & Malik,.....) n Spatially variant smoothing

Introduction to Computer Vision Nagao-Matsuyama Filter n Calculate the variance within nine subwindows of a 5x5 moving window n Output value is the mean of the subwindow with the lowest variance n Nine subwindows used:

Introduction to Computer Vision Kuwahara Filter n Principle: l divide filter mask into four regions (a, b, c, d). l In each compute the mean brightness and the variance l The output value of the center pixel (abcd) in the window is the mean value of that region that has the smallest variance.

Introduction to Computer Vision Kuwahara Filter Example Original Median (1 iteration) Median (10 iterations) Kuwahara

Introduction to Computer Vision Anisotropic Diffusion Filtering Note: Original Perona-Malik diffusion process is NOT anisotropic, although they erroneously said it was.

Introduction to Computer Vision Example: Perona-Malik n In general: l Anisotropic diffusion estimates an image from a noisy image l Useful for restoration, etc. l Only shown smoothing examples l Read the literature

Introduction to Computer Vision Observations on Enhancement n Set of general techniques n Varied goals: l enhance perceptual aspects of an image for human observation l preprocessing to aid a vision system achieve its goal n Techniques tend to be simple, ad-hoc, and qualitative n Not universally applicable l results depend on image characteristics l determined by interactive experimentation n Can be embedded in larger vision system l selection must be done carefully l some techniques introduce artifacts into the image data n Developing specialized techniques for specific applications can be tedious and frustrating.

Introduction to Computer Vision Summary n What is noise? l Gaussian distribution n Noise reduction l first principles n Neighbourhood l low-pass l median n Averaging pixels corrupted by noise cancels out the noise. n Low-pass can blur image. n Median may retain fine image detail that may be smoothed by averaging. Conclusion