.
This commit is contained in:
parent
6ea3a90689
commit
473aa90a14
@ -27483,7 +27483,10 @@ namespace cimg_library_suffixed {
|
|||||||
} break;
|
} break;
|
||||||
case 2 : { // Salt & Pepper noise
|
case 2 : { // Salt & Pepper noise
|
||||||
if (nsigma<0) nsigma = -nsigma;
|
if (nsigma<0) nsigma = -nsigma;
|
||||||
if (M==m) { m = 0; M = cimg::type<T>::is_float()?(Tfloat)1:(Tfloat)cimg::type<T>::max(); }
|
if (M==m) {
|
||||||
|
if (cimg::type<T>::is_float()) { m = (Tfloat)0; M = (Tfloat)1; }
|
||||||
|
else { m = (Tfloat)cimg::type<T>::min(); M = (Tfloat)cimg::type<T>::max(); }
|
||||||
|
}
|
||||||
cimg_rof(*this,ptrd,T) if (cimg::rand(100)<nsigma) *ptrd = (T)(cimg::rand()<0.5?M:m);
|
cimg_rof(*this,ptrd,T) if (cimg::rand(100)<nsigma) *ptrd = (T)(cimg::rand()<0.5?M:m);
|
||||||
} break;
|
} break;
|
||||||
case 3 : { // Poisson Noise
|
case 3 : { // Poisson Noise
|
||||||
|
Loading…
Reference in New Issue
Block a user