Computer Vision - Experiment 3 - Image linear filtering experiment
Experimental objectives and requirements
(i) To master the principle of box filtering of images and the programming implementation method through experiments;
(ii) To master the principle of mean filtering of images and the programmed implementation method through experiments;
(ii) To master the principle of Gaussian filtering of images and the programmed implementation method through experiments.
Experiment content
(i) Use the boxFilter function in OpenCV to implement box filtering.
(ii) Implementing mean filtering using the blur function in OpenCV;
(iii) Gaussian filtering using GaussianBlur function in OpenCV.
Experimental instruments, equipment
A computer with Windows 7 operating system and Visual Studio 2015 installed
Experimental principle
(i) Image filtering, which refers to the suppression of noise in the target image under the condition of preserving as much as possible the detailed features of the image, is an indispensable operation in image pre-processing, and the effectiveness of its processing will directly affect the validity and reliability of subsequent image processing and analysis. The output value of each pixel of the linear filter is the weighted sum of some input pixels. Linear filters are easy to construct, well and easy to analyze from a frequency response perspective.
(ii) In OpenCV, the following three commonly used linear filter operations are provided, which are encapsulated in separate functions and are very easy to use: boxFilter function, mean filter blur function; Gaussian filter GaussianBlur function.
Experimental steps
(i) Create the Visual Studio 2015 console program;
(ii) Configure OpenCV in Visual Studio 2015;
(iii) Write code to implement box filtering using the boxFilter function;
(iv) Write code to implement mean filtering using the blur function;
(v) Write code to implement Gaussian filtering using the gaussianBlur function.
Experimental notes
(i) Configure OpenCV in VS after completing the installation of OpenCV;
(ii) The functions and usage of boxFilter function, blur function and gaussianBlur function.
Experimental results
(i) Experimental code
|
|
(ii) Show results
Experiment summary
The main content of this experiment is to master the principle of box filtering and programming implementation method of image, master the principle of mean filtering and programming implementation method of image, master the principle of Gaussian filtering and programming implementation method of image. I used the boxFilter function in OpenCV to implement box filtering, the blur function in OpenCV to implement mean filtering, and the GaussianBlur function in OpenCV to implement Gaussian filtering. By writing code, I learned to implement box filtering, mean filtering and Gaussian filtering using the boxFilter function, blur function and GaussianBlur function.