Commit 27f98c87 authored by Leon Merten Lohse's avatar Leon Merten Lohse
Browse files

fix problem with addPoissonNoise

addPoissonNoise now correctly handles input that is not "double"
parent 05c6125a
Pipeline #110660 passed with stage
in 1 minute and 17 seconds
......@@ -58,8 +58,15 @@ if nargin < 2
photonsPerPixel = 10000;
end
imNoisy = zeros(size(im), 'like', im);
% imnoise needs double as input
if ~isa(im, 'double')
im = double(im);
end
poissonFactor = 1e-12*photonsPerPixel;
imNoisy = (1./poissonFactor) * imnoise(poissonFactor * im,'poisson');
imNoisy(:) = (1./poissonFactor) * imnoise(poissonFactor * im,'poisson');
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment