Herror ::sp_distribution (
    const HTuple &PercentSalt,
    const HTuple &PercentPepper,
    HTuple *Distribution
)

Generate a salt-and-pepper noise distribution.

::sp_distribution generates a noise distribution with the values 0 and 255. The parameters PercentSalt and PercentPepper determine the percentage of white and black noise pixels, respectively. The sum of these parameters must be smaller than 100. Usually, the result Distribution is used as input for the operator ::add_noise_distribution.


Parameters

PercentSalt (input_control)
number -> HTuple.double / long
Percentage of salt (white noise pixels).
Default value: 5.0
Suggested values: 1.0, 2.0, 5.0, 7.0, 10.0, 15.0, 20.0, 30.0
Typical range of values: 0.0 <= PercentSalt <= 100.0
Minimum increment: 0.1
Recommended increment: 1.0
Restriction: (0.0 <= PercentSalt) && (PercentSalt <= 100.0)

PercentPepper (input_control)
number -> HTuple.double / long
Percentage of pepper (black noise pixels).
Default value: 5.0
Suggested values: 1.0, 2.0, 5.0, 7.0, 10.0, 15.0, 20.0, 30.0
Typical range of values: 0.0 <= PercentPepper <= 100.0
Minimum increment: 0.1
Recommended increment: 1.0
Restriction: (0.0 <= PercentPepper) && (PercentPepper <= 100.0)

Distribution (output_control)
distribution.values-array -> HTuple.double *
Resulting noise distribution.
Number of elements: 513


Example
read_image(&Image,"fabrik");
disp_image(Image,WindowHandle);
create_tuple(&PerSalt,1);
set_d(PerSalt,30.0,0);
create_tuple(&PerPepper,1);
set_d(PerPepper,30.0,0);
T_sp_distribution(PerSalt,PerPepper,&Dist);
T_add_noise_distribution(Image,&ImageNoise,Dist);
disp_image(ImageNoise,WindowHandle); 

Possible Successors

::add_noise_distribution


Alternatives

::gauss_distribution, ::noise_distribution_mean


See also

::gauss_distribution, ::noise_distribution_mean, ::add_noise_white


Module

Image filters



Copyright © 1996-2002 MVTec Software GmbH