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 :
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
- Noise removal using Median filter in C++
- Noise addition using in-built Matlab function
- Python | Peak Signal-to-Noise Ratio (PSNR)
- Wand noise() function - Python
- Text Detection and Extraction using OpenCV and OCR
- Print pattern using only one loop | Set 1 (Using setw)
- Python | Create video using multiple images using OpenCV
- Count number of unique Triangles using STL | Set 1 (Using set)
- std::tuple, std::pair | Returning multiple values from a function using Tuple and Pair in C++
- Inline namespaces and usage of the "using" directive inside namespaces
- Conditionally assign a value without using conditional and arithmetic operators
- Erosion and Dilation of images using OpenCV in python
- Understanding ShellExecute function and it's application to open a list of URLs present in a file using C++ code
- Calculation in parent and child process using fork()
- Print a number 100 times without using loop, recursion and macro expansion in C?
- Addition and Blending of images using OpenCV in Python
- Count the number of 1's and 0's in a binary array using STL in C++ ?
- SQL using C/C++ and SQLite
- Finding Floor and Ceil of a Sorted Array using C++ STL
- Face Detection using Python and OpenCV with webcam
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.