Welcome to Raspbot repository
7.Median filtering
Median filtering: image smoothing can eliminate salt pepper noise. The basic idea is to traverse the image through a filter and take the median of the pixel values of each filter area as the new pixel value.
The algorithm idea is as follows:
(1) Input image and convert to grayscale image;
(2) Add salt pepper noise to the grayscale image;
(3) Traverse the pixels and put the pixel values in the filter area into a one-dimensional array;
(4) Selectively sort a one-dimensional array, and assign the median value to the center of the filter, that is, change the pixels of the traversed original image to the median of the filter area;
(5) Output the image after median filtering.
Code path:
/home/pi/Yahboom_Project/Raspbot/1.OpenCV_course/04image_beautification/ 07_Median_ filtering.ipynb
# Median filtering 3*3 |
After running the above program, two pictures will be displayed in the jupyterLab control interface, as shown below.