The common filtering operation in computer vision and image processing

Source: Internet
Author: User

Computer vision is to make the computer understand the image and video, the purpose of this series of blog is to deepen their learning computer vision in the process of understanding and review of relevant knowledge. Many of the contents refer to: Textbook "Computervision:algorithms and Applications", textbook "Learning Image Processing with OpenCV" reference book "Learningopencv" , the curriculum of foreign universities, "computer Vision" and the Course "computervision".

Image filtering can be carried out either in the real domain or in the frequency domain. Image filtering can change or enhance an image. By filtering, you can emphasize some features or remove unwanted parts of the image. Filtering is a neighborhood operator that uses the value of the pixels around a given pixel to determine the final output value of the pixel. (Personally, "Learningimage processing with OpenCV" in this paragraph is written very well: Image filtering is a process to modify or enhance images. Emphasizing certain features or removing others in an image is examples ofimage filtering. Filtering is a neighborhood operation. The neighborhood is aset of pixels around a selected one. Image filtering determines the outputvalue of a certain pixel located at a position (x, y) by performing someoperations wit H The values of the pixels in its neighborhood.)

Image filtering can be obtained by formula:


calculations, where K is the filter and is also known as the nucleus (kernel) in many literatures. Common applications include noise removal, image enhancement, edge detection, corner detection, template matching, and more. Among the common filter operators used for smoothing images are (code:https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/imgproc/smoothing.cpp):

1. Mean Filter (normalized box filter): Replaces the pixel value with the average of pixels around its pixel, and filters out the edge information of the image while filtering out the noise. In OpenCV, you can use the Boxfilter and blur functions for mean filtering. The core of the mean filter is:

2. Gaussian filter (Gaussian filter): Gaussian filter is the most commonly used filter, has the separable nature, can convert the Ivigos operation into a Gaussian operation, which is essentially a low-pass filter. The function Gaussianblur can be manipulated in OpenCV.


3. Median filter (median filter): Median filtering replaces the original pixel with the median value of the neighboring pixel set around the test pixel. Median filter removes salt and pepper noise and patch noise, and the effect is very obvious. In OpenCV, you can use the function Medianblur to operate.

4. Bilateral filtering (bilateral filter): Bilateral filtering is good at preserving edge characteristics while smoothing images, but its operation speed is slow. In OpenCV, you can use the function Bilateralfilter to operate.

In addition to smoothing out noise, image sharpening, Edge seeking is also a common image filtering applications. Such filters often use a single or second-order differential (or differential, for digital images, they are discrete signals, long-term differential substitution derivative) Accounting sub-image filtering. A differential is commonly used to extract the edges of an image. Second-order differential is commonly used for image enhancement. Common types of operators include:

1. The Sobel Operator:sobel operator is calculated by calculating a differential between the horizontal and vertical directions. In the OPENCV function, you can calculate by using the Sobel function.

2. The Laplacian Operator:laplacian operator is calculated by calculating second-order differential (differential). In the OPENCV function, you can calculate by using the Laplacian function.


In addition to the more classic filters (or accounting) listed above, you can define your own filters in OpenCV, and then use the FILTER2D function to do the math.

The boundary problem is a matter that has to be considered for filtering the filter in the real domain. There are usually several ways to handle this:

(black) (wrap around) (copy edge) (Reflectacross edge)

In addition to filtering in the real domain, filtering can also be done in the frequency domain. The Fourier transform holds the amplitude and phase information for each frequency, where amplitude indicates how many signals are in a particular frequency signal. The phase represents the spatial information of the signal, mainly refers to the direction information.

In the frequency domain, the main filter is to design the corresponding low-pass, high-pass or band-pass filter to achieve the retention of certain frequencies, filtering out the rest of the frequency. In addition, the convolution operation in the real domain can be put into the frequency domain to do the product operation, which can reduce the complexity of the operation.

Related Article

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.