The process of capturing an image is not ideal and we cannot expect to get a perfect image out of a natural scene. This discrepancy between real and captured image is called noise and its causes vary from the sensitivity of the detector to quantization errors. One is often interested in the performance of a given operator as the amount of noise varies, so being able to create a controlled amount of image noise and add it to an image is an important feature.
We experimented with salt-pepper and Gaussian noise .
Figure 6: The Noise Generating Applet
Both types of noise can be created as separate images and then combined with the original image, using image arithmetic, to produce a corresponding noise image. The applet is displayed in Figure 6 and it accepts three parameters:
In order to produce salt-pepper noise one requires the use of a random number generator. If the value returned by the generator is greater or less than a certain value dictated by the probability parameter (supplied by the user), then the corresponding pixel is flipped to black or white accordingly.
This process is repeated for each element of the image array and even with a 256x256 image the time taken is several seconds as calls to random number generators are generally slow. This delay is multiplied by a factor of three when a call to a Gaussian-distributed random number generator is made. This is not a serious problem when the applet is running on its own.