Bildverarbeitung und Mustererkennung Image Processing and Pattern Recognition 1. Image Pre-Processing - Pixel Brightness Transformation - Geometric Transformation - Image Denoising 1
1. Image Pre-Processing Does not increase the information content of images Typically, the information is reduced (filtered) Major aims: Improvement of the image data Suppress irrelevant information Enhance important features Image- pre-processing is comparable to low-level vison of the human visual system 2
Pixel Brightness Transformation Position dependent E.g. to account for systematic errors of the camera system Linear model: Error coefficient can be obtained by performing a calibration with a constant image 3
Pixel Brightness Transformation Position independent Define a transformation which maps a grayscale interval to a new grayscale interval The transformation is then given by Fast implementation using lookup tables 4
Example q q q p p p1 p2 c p Negativbild Kontrasterhöhung Binärer Schwellwert 5
Example Volume rendering - ray casting Uses several transfer-functions for visualization of 3D data 6
Histogram Discrete probability density function of gray values in the image 7
Histogram equalization A technique to automatically find an image with equally distributed gray values Find such that the histogram of the output image has a uniform distribution H(p) G(q) p q 8
Example Input image Image after histogram equalization 9
Geometric Transformations Geometric transformations are important for many applications Lense distortion Image stitching Image registration (warping) A geometric transformation is a vector function that maps a pixel position to a new position 10
Geometric Transformations Geometric transformation can be available in Parametric form, e.g. affine transformation Non-parametric form, e.g. displacement field Geometric transformation consists of two steps Coordinate Transformation Image Interpolation 11
Polynomial approximation Geometric transformations are often approximated using polynomial equations Linear in the coefficients Computing the coefficients amounts for solving a system of linear equations Robust estimation using over-determined system Most applications: m=2,3 12
Bilinear Transformation Simple Transformation Used for many applications 4 corresponding points are needed Affine Transformation Even simpler, 3 corresponding Points are needed Rotation, scaling, skewing 13
Jacobi Coefficient Determinant of the Jacobi matrix of Provides information about the change of the coordinate system J = 0: No inverse exists J = 1: Inverse exists, area of the image is invariant under this transformations. 14
Brightness interpolation Forward transformation does not (in general) fit the discrete pixel grid Use backward (inverse) transformation instead Use brightness interpolation to compute intermediate values Image is given by discrete samples 15
Brightness interpolation Interpolation can be written as the convolution with an interpolation kernel Different kernels in the literature Nearest Neighbor Bilinear Bicubic... 16
Nearest Neighbor Interpolation h1-0.5 0 0.5 x Assigns the brightness of the nearest point on the grid 17
Bilinear Interpolation h2-1 0 1 Takes into account the brightness values of the 4 neighboring points x 18
Bicubic Interpolation Approximation of the image data using a bicubic polynomial Uses 16 neighboring points on the grid Keeps fine details in the image 19
Example Original Rotate 36 times by 10 bicubic bilinear 20
Image Denoising Image data often contains noise, e.g. sensor noise,... Exploit the fact that the image data has a high degree of redundancy Averaging of the gray values in a certain neighborhood supresses noise but has the problem of blurring sharp edges in the image Need for edge preserving smoothing 21
Averaging of several images Several images of the same scene Original image One noisy image Denoised image 22
Local filtering Often, only one image is available Need to design local filter Sliding window approach: Compute local average in a small window shifted over the image Can be written as the convolution with a filter mask h Matlab: u = imfilter(f,h) 23
origin Illustration y h(-1,-1) h(-1,0) h(-1,1) mask h(0,-1) h(0,0) h(0,1) h(1,-1) h(1,0) h(1,1) f(x-1,y-1) f(x-1,y) f(x-1,y+1) Mask coefficients x f(x,y-1) f(x,y) f(x,y+1) f(x+1,y-1) f(x+1,y) f(x+1,y+1) Image section under mask 24
Local averaging Smoothing using a 3x3 average filter. Matlab: fspecial( average, [3 3]) f(x-1,y-1) f(x-1,y) f(x-1,y+1) 1/9 1/9 1/9 f(x,y-1) f(x,y) f(x,y+1) 1/9 1/9 1/9 f(x+1,y-1) f(x+1,y) f(x+1,y+1) 1/9 1/9 1/9 25
Border handling Problem: Filter mask does not fit the image at borders Several possibilities Ignore border smaller result Zero padding Image data replication Mirroring Circular replication 26
Example Noisy image 3x3 filter 7x7 filter 27
Gaussian Filter Average filter gives the same weight to all pixels under the filter mask Gaussian filter gives a higher weight to pixels being closer to the center better results Filter coefficients are computed using the Gaussian formula Parameter controlls the amount of smoothing 28
Discrete approximation: Kernels size always odd Gaussian Filter Sum of coefficients is always equal to one Matlab: fspecial( gaussian,[n n], ) Example: 29
Example Noisy image 3x3 average 3x3 Gaussian 30
Example original sigma =1 sigma =2 sigma =3 31
Separable Filters Isotropic filters (Average, Gaussian) can be easily seperated Two-fold convolution in x- and y- direction with 1D filters Comparison: Original: n 2 multiplications und n 2-1 additions Separable: 2n multiplications, 2n-2 additions Many filters are separable use it! 32
Smoothing using rotating masks Non-linear smoothing technique Avoids the blurring of image edges Smoothing in using the most homogeneous part of the current pixel neighborhood A brighness dispersion is used as the homogeinity measure. 33
Smoothing using rotating masks 1 2... 7 8 Take the average under the mask with the minimum dispersion 34
Adaptive Filtering Mean filter that locally adapts to the image data Mean under the mask Variance of the image Current grayscale Variance under the mask Variant implemented in Matlab: wiener2(f,[n n]) 35
Adaptive Filtering If variance under the mask is large compared to the variance of the image, then take original gray value If the variance under the mask is small compared to the variance of the image take the average. Example Noisy image Average Adaptive 36