I have an image with all the pixel values being double type. I'm trying to generate Poisson noise with imnoise with following commands.
1. max_value = max(max(I)); -- take the maximum value
2. I = I/max_value; -- normalize, now pixel values range from [0,1] (I know that there?s no negative values in my image.
3. I2 = max_value * imnoise( I , 'poisson'); -- generate noisy image and scale back to the original intensities.
Problem I?m having is that nothing happens! I have read imnoise help, and didn?t understand the scaling with double type images, so maybe there?s the reason for this.
When I change the code to following, the result image looks fine i.e there?s noise:
1. max_value = max(max(I)); I = I / max_value;
2. I2 = max_value * im2double( imnoise( im2uint16(I) , 'poisson' ));
So I?m wondering why the second one works but the first one doesn?t? I understood that key thing is to make sure that image values are normalized before calling imnoise. My second question is: is the latter way to generate noise just fine, or is there some serious bias because of roundoff errors or something?
Thanks
Jussi