add_noise_distribution — Add noise to an image.
add_noise_distribution adds noise distributed according to Distribution to the Image. The resulting gray values are clipped to the range of the corresponding pixel type.
The Distribution is stored in a tuple of length 513. The individual values of this tuple define the frequency of noise with a specific amplitude defined by the position within the tuple. The central value, i.e., the value at the position 256 in the tuple defines the frequency of pixels that are not changed. The value at the position 255 defines the frequency of pixels for which the grayvalue is decreased by 1. The value at the position 254 defines the respective frequency for a grayvalue decrease of 2, and so on. Analogously, the value at position 257 defines the frequency of pixels for which the grayvalue is increased by 1.
The Distribution represents salt and pepper noise if at most one value at a position smaller than 256 is not equal to zero and at most one value at a position larger than 256 is not equal to zero. In case of salt and pepper noise, the noisified pixels are set to the minimum (pepper) and maximum (salt) values that can be represented by ImageNoise if the amount of pepper is indicated by the value at position 0 and the amount of salt is indicated by the value at position 512 in the tuple.
Number of elements: ImageNoise == Image
Number of elements: 513
read_image(Image,'mreut') dev_display (Image) sp_distribution(30,30,Dist) add_noise_distribution(Image,ImageNoise,Dist) dev_display (ImageNoise)
add_noise_distribution returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behaviour can be set via set_system('no_object_result',<Result>). If necessary, an exception is raised.
gauss_distribution, sp_distribution, noise_distribution_mean
sp_distribution, gauss_distribution, noise_distribution_mean, add_noise_white