Salt-and-pepper noise is a form of noise sometimes seen on images. It is also known as impulse noise. This noise can be caused by sharp and sudden disturbances in the image signal. It presents itself as sparsely occurring white and black pixels. An effective noise reduction method for this type of noise is a median filter or a morphological filter.
In this article, we will learn how to remove Salt-Pepper Noise from the image simply using C++ (without using any external image processing library like OpenCV).
- Store the pixel values of input image in an array.
- For each pixel value if it contains 0(black) or 255(white) then compute the average value of its neighbor pixel values, else that pixel value is stored in another array.
- Pixel values of the new array are used for output file.
Below is the simple C++ implementaion of Salt-Pepper Noise removal :
- Noise removal using Median filter in C++
- C++ | asm declaration
- Pointers and References in C++
- Strings in C++ and How to Create them?
- Enum Classes in C++ and Their Advantage over Enum DataType
- Deque vs Vector in C++ STL
- C++ Programming Basics
- Introduction to C++ Programming Language
- Python | Data Augmentation
- Introduction to OpenCV
- Python PIL |ImageDraw.Draw.multiline_text()
- ios manipulators noshowpos() function in C++
- ios rdstate() function in C++ with Examples
- ios operator !() function in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.