Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intensity Transformation

Similar presentations


Presentation on theme: "Intensity Transformation"— Presentation transcript:

1 Intensity Transformation
Sometimes we need to transform the intensities of all image pixels to prepare the image for better visibility of information or for algorithmic processing. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

2 Computer Vision Lecture 6: Spatial Filtering
Gamma Transformation Gamma transformation: February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

3 Computer Vision Lecture 6: Spatial Filtering
Gamma Transformation February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

4 Linear Histogram Scaling
February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

5 Linear Histogram Scaling
For a desired intensity range [a, b] we can use the following linear transformation: Note that outliers (individual pixels of very low or high intensity) should be disregarded when computing Imin and Imax. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

6 Computer Vision Lecture 6: Spatial Filtering
Image Filtering Many basic image processing techniques are based on convolution. In a convolution, a convolution filter W is applied to every pixel of an image I to create a filtered image I*. The filter W itself is a 2D matrix of real values. To simplify the mathematics, we could consider W to have a center [0, 0] and extend from –m to m vertically and –n to n horizontally. This means that W is of size (2m + 1)×(2n + 1). February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

7 Computer Vision Lecture 6: Spatial Filtering
Convolution Example: Averaging filter: i 1/9 j February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

8 Computer Vision Lecture 6: Spatial Filtering
Convolution Grayscale Image: Averaging Filter: 1 6 3 2 9 11 10 5 7 8 4 1/9 February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

9 Computer Vision Lecture 6: Spatial Filtering
Convolution Original Image: Filtered Image: 1 6 3 2 9 11 10 5 7 8 4 1/9 5 value = 11/9 + 61/9 + 31/9 + 21/9 + 111/9 + 31/ 1/9 + 101/9 + 61/9 = 47/9 = 5.222 February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

10 Computer Vision Lecture 6: Spatial Filtering
Convolution Original Image: Filtered Image: 1 6 3 2 9 11 10 5 7 8 4 1/9 5 7 value = 61/9 + 31/9 + 21/9 + 111/9 + 31/9 + 101/ 1/9 + 61/9 + 91/9 = 60/9 = 6.667 February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

11 Computer Vision Lecture 6: Spatial Filtering
Convolution Original Image: Filtered Image: 1 6 3 2 9 11 10 5 7 8 4 5 7 5 5 6 5 4 5 6 Now you can see the averaging (smoothing) effect of the 33 filter that we applied. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

12 Computer Vision Lecture 6: Spatial Filtering
Convolution It needs to be noted that for convolution the filter needs to be rotated by 180 before starting the computations (otherwise it’s a correlation). An intuitive explanation is that we would like convolution to be like a “local multiplication of patterns.” For example, if our image contains a few 1s and otherwise 0s, we would expect the convolution result to contain a copy of the filter pattern centered at each 1. Let us look at an image with one 1-pixel: February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

13 Computer Vision Lecture 6: Spatial Filtering
Convolution Image: Filter: Result: 1 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 Oops! The copy of the filter is rotated by 180 ! February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

14 Computer Vision Lecture 6: Spatial Filtering
Convolution If we rotate the filter by 180 beforehand, we get the desired result. This leads to the following definition of convolution for image I, filter W, and result I*: This formula needs to be applied to all coordinates [i, j] in I in order to create the complete image I*. Convolution is commutative, i.e., W and I are exchangeable. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

15 Computer Vision Lecture 6: Spatial Filtering
Image Filtering More common: Gaussian Filters Continuous version: implement decreasing influence by more distant pixels 1 4 7 16 26 41 Discrete version: /273 February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

16 Computer Vision Lecture 6: Spatial Filtering
Image Filtering Effect of Gaussian smoothing: original 33 99 1515 February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

17 Properties of Gaussian Filters
The application of Gaussian convolution filters can be made more efficient. This is important, for example, if we want to apply different Gaussian filters to a large number of big input images. The basic idea is to separate the convolution with the 2D Gaussian filter into two successive convolutions with 1D Gaussian filters. One of these filters is vertical, the other one horizontal. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

18 Properties of Gaussian Filters
The general form of the Gaussian filter, without a normalizing factor, is given by: The convolution of an image F with a Gaussian filter G of size (2m + 1)(2n + 1) is given by: This formula needs to be applied to all coordinates [i, j] in F in order to create the convoluted image. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

19 Properties of Gaussian Filters
Then we have: February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

20 Properties of Gaussian Filters
The formula in the curly braces describes the convolution of F[i, j] with a horizontal one-dimensional Gaussian filter. The remainder of the formula takes the result of this first convolution and performs a convolution with a vertical one-dimensional Gaussian filter on it. So instead of applying an (2m + 1)(2n + 1) Gaussian convolution filter, we can successively apply a 1(2n + 1) filter and an (2m + 1)1 filter. This increases the efficiency of the computation. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

21 Different Types of Filters
Smoothing can reduce noise in the image. This can be useful, for example, if you want to find regions of similar color or texture in an image. However, there are different types of noise. For so-called “salt-and-pepper” noise, for example, a median filter can be more effective. Note that it is not a convolution filter, but it works similarly. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

22 Computer Vision Lecture 6: Spatial Filtering
Median Filter Use, for example, a 33 filter and move it across the image like we did before. For each position, compute the median of the brightness values of the nine pixels in question. To compute the median, sort the nine values in ascending order. The value in the center of the list (here, the fifth value) is the median. Use the median as the new value for the center pixel. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

23 Computer Vision Lecture 6: Spatial Filtering
Median Filter Advantage of the median filter: Capable of eliminating outliers such as the extreme brightness values in salt-and-pepper noise. Disadvantage: The median filter may change the contours of objects in the image. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

24 Computer Vision Lecture 6: Spatial Filtering
Median Filter 33 median 77 median original image February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

25 Computer Vision Lecture 6: Spatial Filtering
The Fourier Transform Last week we talked about convolution as a technique for a variety of image processing applications (and we will see many more). Convolution works in the spatial domain, i.e., it uses spatial filters that are shifted across an input image. Sometimes it is useful to perform filtering in the frequency domain instead. To understand what this means and to perform such filtering, we need to take a look at the Fourier transform. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

26 The Fourier Transform Jean Baptiste Joseph Fourier (and his Fourier-transformed image) February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

27 Computer Vision Lecture 6: Spatial Filtering
The Fourier Transform The Fourier transform receives a function as its input and outputs another function. The Fourier transform assumes that the input function is periodic, i.e., repetitive, and defined for all real numbers. It transforms this function into a weighted sum of sinusoidal terms. Let us first look at one-dimensional functions. Later, we will move on to two-dimensional functions such as images. February 15, 2018 Computer Vision Lecture 6: Spatial Filtering

28 Computer Vision Lecture 6: Spatial Filtering
Adding Sine Waves = 3 sin(x) A sin(x) A + 1 sin(3x) B A+B + 0.8 sin(5x) C A+B+C + 0.4 sin(7x) D A+B+C+D February 15, 2018 Computer Vision Lecture 6: Spatial Filtering


Download ppt "Intensity Transformation"

Similar presentations


Ads by Google