Foundation of Image Processing-convolution, filtering, and smoothing

Source: Internet
Author: User

/* Today, my younger brother asked me about convolution, filtering, smoothing, and so on ...... What do these concepts mean? What are the differences and connections between them? After a while, I learned CV, convolution, filtering, smoothing ...... These concepts are mentioned several times a day, but I only understand what they mean ~ I found that my previous knowledge is really not comprehensive. I would like to make some conclusions here. I will have a deep understanding of this basic concept in the future ~ */

 

1. Image convolution (Template)

(1). Use templates to process image-related concepts:

Template: matrix square. Its mathematical meaning is a convolution operation.

Convolution: it can be seen as a process of weighted summation. each pixel in the used image area corresponds to a multiplication of each element in the convolution kernel (weight matrix, the sum of all products is the new value of the regional center pixel.
Convolution core: The weight used for Convolution is represented by a matrix, which is a weight matrix.
Convolution example:
Convolution between 3*3 pixel region R and convolution core G:
R5 (center pixel) = r1g1 + r2g2 + r3g3 + r4g4 + r5g5 + r6g6 + r7g7 + r8g8 + r9g9

(2). Image Processing Using templates (cross-border issues ):
Border problem: when processing image boundary pixels, the convolution kernel and the image use area cannot match. The center of the convolution kernel corresponds to the boundary pixel, and the convolution operation will fail.
Solution:
A. Ignore the boundary pixels, that is, the processed images will lose these pixels.
B. Retain the original boundary pixel, that is, copy the boundary pixel to the processed image.

(3). Common templates:


 

 

Let's take a look at the concept of one-dimensional convolution.
Convolution of a continuous space: the convolution between F (x) and g (x) is an integral value between F (t-x) g (x) and T from negative infinity to positive infinity. t-X must be in the f (x) defined domain, so it seems that a lot of points are actually within a certain range. the actual process is that f (x) First reverses the Y axis, then translates t to F (t-x) along the X axis, and then obtains g (x, the product value of the two is then integrated. imagine if G (x) or f (x) is a unit of order-over function. that is, the area of the intersection of F (t-x) and g (x. this is convolution.
Replacing the integral symbol with the sum is the convolution definition of the discrete space. what does convolution mean in an image? That is, the image is f (x), the template is g (x), and then the template g (x) is moved in the template, at every position, the convolution of the elements in which F (x) and g (x) are intersecting is often used in linear system analysis. A linear system is the linear relationship between input and output of a system. that is to say, the entire system can be divided into n Independent independent changes, and the entire system is the accumulation of these changes. for example, x1-> Y1, x2-> Y2; then a * X1 + B * x2-> A * Y1 + B * Y2 is a linear system. indicates that a linear system can be expressed in integral form.

,

F (t, x) represents a linear coefficient such as a B. it looks like convolution, right. If f (t, x) = f (t-x) Isn't it. changing from f (t, x) to F (t-x) actually means that f (t, x) is a linear shift without changing, that is, when the difference of the variable does not change, then the function value does not change. in fact, it means that the output of a linear moving system can be obtained through the convolution of functions that represent the linear features of the system.

 

 

2. Image Filtering

 

(1) image filtering: it is an indispensable operation in image preprocessing to suppress the noise of the target image while retaining the detailed features of the image as much as possible, the processing effect will directly affect the validity and reliability of subsequent image processing and analysis. (Filtering is to remove useless information and retain useful information, which may be low frequency or high frequency)

(2) There are two purposes of Filtering: one is to extract the features of the object as the feature mode of image recognition, and the other is to adapt to the requirements of image processing and eliminate the noise mixed into the image when it is digitalized.

There are two requirements for filtering: one is that the contour and edge information of the image cannot be damaged, and the other is that the image is clear and visual.

(3) image filtering methods:

(1) There are many image filtering methods, which can be divided into two categories: Frequency Domain Method and spatial domain method. The processing of the frequency domain method is to perform operations on the transformed system values of the image in a certain transform domain of the image, and then obtain the enhanced image through reverse transformation. This is an indirect image filtering method. The spatial filtering method is a type of direct filtering method. It performs gray-scale operations on images when processing images.

<1> frequency domain filtering: This method converts an image from a spatial or temporal domain to a frequency domain, and uses the conversion coefficient to reflect the characteristics of some image features for image filtering. Fourier transformation is a common transformation. In the Fourier transform field, the DC component of the spectrum is proportional to the average brightness of the image, the noise corresponds to the area with a higher frequency, and the image entity is located in the area with a lower frequency. These inherent characteristics of an image can be used for image filtering. A low-pass filter can be constructed so that the low-frequency component can pass through and effectively block the high-frequency component to filter out the image noise and then obtain a smooth image through reverse transformation.

The mathematical expression of low-pass is as follows:

F (u, v) is the Fourier transformation of the original image containing noise;
H (u, v) is a transfer function, also known as a transfer function (that is, a low-pass filter );
G (u, v) is the Fourier transformation of the output image after low-pass filtering.
H filtering filters out high-frequency components, while low-frequency information basically passes without loss. After filtering, the Smoothing image can be obtained through Fourier transformation inverse transformation, that is
Selecting the appropriate transfer function H (u, v) is of great importance to low-pass filtering in the frequency domain. Common transfer functions include ladder functions, exponent functions, and butworth functions.
Several low-pass filters commonly used in the frequency domain are ideal low-pass filters (ideal circular Iow-passfilter), Butterworth low-pass filters, exponential low-pass filters, and trapezoid low-pass filters. These low-pass filters can improve the performance of noise interference in the image.
<2> common flat space domain filtering methods are as follows:

The first type is image fitting methods, including n-order polynomial fitting, discrete orthogonal polynomial fitting, quadratic surface fitting, and other methods;

The other is Smoothing image methods, including domain average method, median filter method, gradient reciprocal encryption method, and selective mask method.

(2) frequency-based

<1> Qualcomm Filtering: Edge Extraction and enhancement. The gray-scale transformation of the edge area increases, that is, the frequency is high. Therefore, for high-pass filtering, the edge part will be retained, and the non-edge part will be filtered;

<2> low-pass filtering: the edge is smooth, and the edge area is smoothly transitioned.

Appendix: Gaussian filter is a linear smoothing filter, that is, low-pass filter. It is suitable for eliminating Gaussian noise and is widely used in image processing to reduce noise. In layman's terms, Gaussian filtering is a process of weighted average for the entire image. The value of each pixel is obtained from the weighted average of its own and other pixel values in the neighborhood. Gaussian smoothing filter is very effective for suppressing noise that follows normal distribution. The 3 × 3 mask is as follows:

× 1/16

From the structured mask, we can see that the position in the mask center is greater than the weight of any other pixel, so the pixel given in the mean calculation is more important. Pixels that are far from the mask center are not very important, so as to reduce the Blur in smooth processing.

(3) linear and nonlinear filtering

<1> linear filtering: the raw data of the linear filter and the filtering result are arithmetic operations, that is, they are implemented using addition, subtraction, multiplication, division, and other operations, such as (1) mean Filter (average of pixel gray values in the template), (2) Gaussian filter (Gaussian weighted average), etc. Since linear filters are arithmetic operations and have fixed templates, the transfer function of the filter can be identified and unique (the transfer function is the Fourier transformation of the template ).

<2> Nonlinear Filtering: the raw data of a non-linear filter is logically related to the filtering result, that is, it is implemented by logical operations, such as the maximum filter, minimum filter, and median filter, it is achieved by comparing the gray scale values in a certain neighborhood. There is no fixed template, so there is no specific transfer function (because there is no template for Fourier transformation). In addition, expansion and corrosion are also achieved through the maximum and minimum filters. Five common non-linear filtering operators, which have different effects on different images. The most common filter operator is median filtering, because it has the best effect and has the least information loss.

(1). Maximum value filtering

Maximum value filtering is to select the maximum value in the pixel field as the pixel value of the Change Point, which effectively reduces the noise of the gray value and can also be used as the expansion operation in the morphology.

Maximum value filtering can be expressed as: Maximum (A) = MAX [A (x + I, Y + J)] (x, y) belongs to m

Note: (x + I, Y + J) is the coordinate defined on the image, and (I, j) is the coordinate defined on the template M. M is the calculation template.

(2). Minimum value filtering (opposite to maximum value filtering)

(3). midpoint Filtering

Midpoint filtering is often used to remove Short Tail noise in an image, such as Gaussian noise and uniformly distributed noise. When the output of the destination filter is given the maximum and minimum values of the gray scale in the window;

Midpoint (A) = (MAX [A (x + I, Y + J)] + min [A (x + I, Y + J)])/2 (x, y) belongs to m

Note: (x + I, Y + J) is the coordinate defined on the image, and (I, j) is the coordinate defined on the template M. M is the calculation template.

(4). Median Filtering

Median Filter can remove long tail noise in an image, such as negative exponential noise and salt and pepper noise. When noise is eliminated, the median filter blur the image noise extremely small (affected by the template size ), in essence, the median filter replaces the gray scale of the template's central pixel with the gray value of the pixel contained in the template. In terms of eliminating salt and pepper noise in the image and preserving the image's spatial details, the median filter has better performance than the mean filter.

Median (A) = median [A (x + I, Y + J)] (x, y) belongs to m

Note: (x + I, Y + J) is the coordinate defined on the image, and (I, j) is the coordinate defined on the template M. M is the calculation template.

(5) weighted median filtering (improved median filtering)

Weighted Median Filter is improved based on the median filter, and its performance is superior to the median filter to a certain extent.

The following is an example of Improving the algorithm:

If the size of the selected template is 5, the template is uniquely identified:

1 1 5 1 1

1 1 5 1 1

5 5 5 5 5

1 1 5 1 1

1 1 5 1 1

Number of times the number of decimal point pixels appear in the sequence. Then smooth the Image Based on the template. Experiments show that this method is better than traditional median filter. Of course there are other methods;

 
Appendix: Noisy (Gaussian noise: refers to the distribution of noise that follows the Gaussian distribution. That is, the number of noisy points of a certain intensity is the largest, and the number of noisy points farther away from this intensity is smaller, and this rule follows the Gaussian distribution. Gaussian noise is a supplementary noise that is directly added to the original image. Therefore, it can be filtered out using a linear filter. Salt and pepper noise: it is like spreading salt and pepper on an image. Therefore, it is named after it. It is a kind of noise that appears many white spots or black spots on the image, such as the snowflake noise in the TV. Salt-and-pepper noise can be considered as a logical noise, and the filtering result using a linear filter is not good. Generally, the median filter can be used to obtain better results .)

 

 

3. Image Smoothing

Image Smoothing image smoothing: to suppress, weaken, or eliminate details, mutations, edges, and noise in an image, that is, image smoothing. Image Smoothing is a low-pass filtering of images, which can be implemented in the spatial or frequency fields. The image smoothing method in spatial fields mainly uses low-pass convolution filtering and median filtering; the frequently used low-pass filters in frequency domain image smoothing include low-pass trapezoid filter, low-pass Gaussian filter, low-pass index filter, and butworth low-pass filter.


 

Link:

Image Convolution: an implementation method, whether it is filtering or something else, can be said to be an extension of mathematics in image processing.

Image Filtering: An Image Processing Method for different purposes.

Image Smoothing: in fact, it is low-pass filtering.

Http://blog.csdn.net/yangtrees/article/details/8740933

Http://blog.csdn.net/u012913847/article/details/21093845

Http://blog.csdn.net/ren062/article/details/4268934

Http://blog.csdn.net/frankyzhangc/article/details/6989943

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.