salt_pepper_noise¶
-
odl.phantom.noise.
salt_pepper_noise
(vector, fraction=0.05, salt_vs_pepper=0.5, low_val=None, high_val=None, seed=None)[source]¶ Add salt and pepper noise to vector.
Salt and pepper noise replaces random elements in
vector
withlow_val
orhigh_val
.- Parameters
- vectorelement of
TensorSpace
orProductSpace
The vector that noise should be added to.
- fractionfloat, optional
The propotion of the elements in
vector
that should be converted to noise.- salt_vs_pepperfloat, optional
Relative abundance of salt (high) vs pepper (low) noise. A high value means more salt than pepper noise.
- low_valfloat, optional
The “pepper” color in the noise. Default: minimum value of
vector
. For product spaces the minimum value per subspace is taken.- high_valfloat, optional
The “salt” value in the noise. Default: maximuim value of
vector
. For product spaces the maximum value per subspace is taken.- seedint, optional
Random seed to use for generating the noise. For
None
, use the current seed.
- vectorelement of
- Returns
- salt_pepper_noise
vector.space
element vector
with salt and pepper noise.
- salt_pepper_noise
See also