Image enhancement in the spatial domain
Human vision for dummies Anatomy and physiology Wavelength Wavelength sensitivity
Human vision for dummies (2) Visual perception of the image Contrast (local change in brightness) eye has logarithmic perception of brightness Acuity (details) best resolution: 500 lux, 40 cm => 0.16 mm => 0.16 mm Object border Borders are important and also context-dependent Color The human eye is more sensitive to color than brightness
Optical illusions
Image enhancement We want to create an image which is ”better” in some sense. ► Transformation is pointwise ► Helps visual interpretation (brightening, sharpening…) => SUBJECTIVE ► Pre-processing for a subsequent image analysis algorithm => PERF = PERF of IA TASK ► Make the image more ”specific” => APPLICATION DEPENDENT f(x,y)g(x,y) Original imageNew image T
Image (pre-) Processing Image processing can be performed in the ► Spatial domain ► Frequency domain that is after Fourier transform (next two lectures) We have three types of transforms in the spatial domain : ► Pixel brightness transforms, point processing (depend only on the pixel value itself) ► Spatial filters, local transforms or local processing (depend on a small neighborhood around the pixel) ► Geometric transforms
Pixel brightness transforms ► Each pixel in the output image depends directly on the corresponding pixel in the input image One-to-one transform: pointwise ► Common transforms inverse contrast stretching logarithmic exponential ► With more than one input image: sums, mean images statistical operations (variance, t-test…) ► Pixel brightness transforms are easy to generalize to 3D
Grey scale histogram ► A grey scale histogram shows how many pixels there are of each grey level (intensity level).
original image inverse transform logarithmic transform (neutral transform)
How is the histogram changed? ► Explains the terms - compression - expansion you find sometimes in the textbooks.
Example : the inverse transform
brightness (addition/subtraction) contrast = histogram stretching original image
Paint Shop Pro example ► What do the function do? ► How to use them to get the best results? And why it is best. ► Implementation: Look Up Table (LUT) Note: MATLAB V6.0 with IP Toolbox 3.0, also has these tools
Histogram equalization ► Contrast / Brightness adjustments sometimes need to be automatized ► What can be “optimal” contrast for an image? => FLAT histogram ► It can also be useful to do histogram normalization i.e.: to get a given shape for the histogram (see GW 3.3.2)
r k n k p r (r k ) s k output 0 /7= /7= /7= /7= /7= /7= /7= /7= Histogram Equalization, example quantization interval [0 7], image size 256x256
original image histogram equalization transformation by probability density function - see black board notes
Adaptative / localized histogram equalization
Relations between pixels A picture element (pixel) has 4 or 8 neighbors in 2D depending on neighbor definition: ► 4-neihgborhood - each neighbor must share an edge with the pixel ► 8- neighborhood - each neighbor must share an edge or a corner with the pixel 4- neighborhood 8- neighborhood
Spatial filtering In spatial filtering, the pixel in the output image is given a value calculated from a local neighborhood in the input image. The local neighborhood is described by a mask, or spatial filter (typical sizes 3x3, 5x5, 7x7… pixels) Filtering is performed by letting the mask move over the image. The center pixel in the output image is given a value that depends on the input image and the weights of the mask. Several types of spatial filters: ► Linear filters ► Fractile filters ► Adaptative filters (steerable)
Convolution
Filtering: implementation ► Generic code for P(x,y) in image for F(u,v) in filter Q(x,y) += F(u,v) P(x-u,y-v) end ► Managing the border Outside pixel value set to zero Mirroring of the border pixel values Changing filter size along the border (BEST, but slower) (-1,-1)(0,-1)(1,-1) (-1,0)(0,0)(1,0) (-1,1)(0,1)(1,1)
Spatial filtering original image mean filter = ”smoothing” Laplace filterLaplace + original image = ”sharpening”
Spatial filters Linear filters: Smoothing filters mean filters Gauss filters Edge enhancing filter Sobel operator Prewitt operator Laplace operator Fractile filters** Median, Min, Max **have no correspondence in frequency domain For details, see next lecture…
Mean filtering original image mean 3x3mean 5x5mean 11x11
Edge enhancing filters ► The Sobel operator: detection of horizontal edges
► The Laplace operator: detection of edges independent of direction Edge enhancing filters004 00