sp_distributionT_sp_distributionSpDistributionSpDistributionsp_distribution (Operator)

Name

sp_distributionT_sp_distributionSpDistributionSpDistributionsp_distribution — Generate a salt-and-pepper noise distribution.

Signature

sp_distribution( : : PercentSalt, PercentPepper : Distribution)

Herror T_sp_distribution(const Htuple PercentSalt, const Htuple PercentPepper, Htuple* Distribution)

void SpDistribution(const HTuple& PercentSalt, const HTuple& PercentPepper, HTuple* Distribution)

static HTuple HMisc::SpDistribution(const HTuple& PercentSalt, const HTuple& PercentPepper)

static HTuple HMisc::SpDistribution(double PercentSalt, double PercentPepper)

static void HOperatorSet.SpDistribution(HTuple percentSalt, HTuple percentPepper, out HTuple distribution)

static HTuple HMisc.SpDistribution(HTuple percentSalt, HTuple percentPepper)

static HTuple HMisc.SpDistribution(double percentSalt, double percentPepper)

def sp_distribution(percent_salt: Union[float, int], percent_pepper: Union[float, int]) -> Sequence[float]

Description

sp_distributionsp_distributionSpDistributionSpDistributionSpDistributionsp_distribution generates a noise distribution with the values 0 and 255. The parameters PercentSaltPercentSaltPercentSaltPercentSaltpercentSaltpercent_salt and PercentPepperPercentPepperPercentPepperPercentPepperpercentPepperpercent_pepper determine the percentage of white and black noise pixels, respectively. The sum of these parameters must be smaller than 100. Usually, the result DistributionDistributionDistributionDistributiondistributiondistribution is used as input for the operator add_noise_distributionadd_noise_distributionAddNoiseDistributionAddNoiseDistributionAddNoiseDistributionadd_noise_distribution.

Execution Information

Parameters

PercentSaltPercentSaltPercentSaltPercentSaltpercentSaltpercent_salt (input_control)  number HTupleUnion[float, int]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

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 PercentSalt PercentSalt PercentSalt percentSalt percent_salt ≤ 100.0

Minimum increment: 0.1

Recommended increment: 1.0

Restriction: PercentSalt + PercentPepper <= 100

PercentPepperPercentPepperPercentPepperPercentPepperpercentPepperpercent_pepper (input_control)  number HTupleUnion[float, int]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

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 PercentPepper PercentPepper PercentPepper percentPepper percent_pepper ≤ 100.0

Minimum increment: 0.1

Recommended increment: 1.0

Restriction: PercentSalt + PercentPepper <= 100

DistributionDistributionDistributionDistributiondistributiondistribution (output_control)  distribution.values-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Resulting noise distribution.

Number of elements: 513

Example (HDevelop)

read_image(Image,'fabrik')
dev_display (Image)
sp_distribution(30,30,Dist)
add_noise_distribution(Image,ImageNoise,Dist)
dev_display (ImageNoise)

Example (C)

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);

Example (HDevelop)

read_image(Image,'fabrik')
dev_display (Image)
sp_distribution(30,30,Dist)
add_noise_distribution(Image,ImageNoise,Dist)
dev_display (ImageNoise)

Example (HDevelop)

read_image(Image,'fabrik')
dev_display (Image)
sp_distribution(30,30,Dist)
add_noise_distribution(Image,ImageNoise,Dist)
dev_display (ImageNoise)

Example (HDevelop)

read_image(Image,'fabrik')
dev_display (Image)
sp_distribution(30,30,Dist)
add_noise_distribution(Image,ImageNoise,Dist)
dev_display (ImageNoise)

Possible Successors

add_noise_distributionadd_noise_distributionAddNoiseDistributionAddNoiseDistributionAddNoiseDistributionadd_noise_distribution

Alternatives

gauss_distributiongauss_distributionGaussDistributionGaussDistributionGaussDistributiongauss_distribution, noise_distribution_meannoise_distribution_meanNoiseDistributionMeanNoiseDistributionMeanNoiseDistributionMeannoise_distribution_mean

See also

gauss_distributiongauss_distributionGaussDistributionGaussDistributionGaussDistributiongauss_distribution, noise_distribution_meannoise_distribution_meanNoiseDistributionMeanNoiseDistributionMeanNoiseDistributionMeannoise_distribution_mean, add_noise_whiteadd_noise_whiteAddNoiseWhiteAddNoiseWhiteAddNoiseWhiteadd_noise_white

Module

Foundation