# salt noise in an image

Suppose an image has noise, but it is exclusively salt noise. What effect will dilation have? I am looking for a reference so I can answer this question. anyone has any idea?

To answer your 1st question, dilation will enlargen the white spots in your image over the darker spots, which may be useful if you only have tiny dark salting you would like to remove in your image.

However, you are referring to salt noise, so if the spots were also white crumbs in a dark image, then all you are doing is only making the crumbs bigger, which is what you don't want.

What I would recommend is to use either Opening or Closing, (or both) depending on your application. These are a combination of dilations and erosions so that the minor parts of the image are removed while keeping the original portions of the image intact.

For example, here is an image for a penguin (with salting):

Notice how the image has both black and white salting.

Running both an opening and closing algorithm (OpenCV) on this penguin, we remove the black and white salts, and get a nice, smoother image without the spots:

Also, here is my OpenCV code that does this:

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main( )
{
Mat image,dst;

// Create a structuring element
int erosion_size;
cout << "What element size?" << '\n';
cin >> erosion_size;

imshow("Salted", image);

Mat element = getStructuringElement(cv::MORPH_ELLIPSE,
cv::Size(2 * erosion_size + 1, 2 * erosion_size + 1),
cv::Point(erosion_size, erosion_size) );

//Opening and Closing
erode(image,image,element);
dilate(image,image,element);

dilate(image,image,element);
erode(image,image,element);

imshow("Unsalted", image);

waitKey(0);
return 0;
}