How to add poisson's noise to predefined binary array (4 x 4 array)
Show older comments
Hello Everyone,
I want to know how to add poisson's noise to predefined binary array.
I have 4 x 4 binary array and I want to add Poisson's noise to it.
---> I already tried poissrnd inbuilt function in matlab but the problem with this function is (this function always generate integer values ranging from 1 to 4 if lambda is 1 or less than 1)
I want to have poisson's noise in the form of floating point numbers between 0 and 1
Please give some suggestions on this.
THank you
Answers (1)
KALYAN ACHARJYA
on 6 Jan 2021
Edited: KALYAN ACHARJYA
on 6 Jan 2021
Note: Having 0 and 1 in array data and actually logical data array are two different things.
Please refer the inbuilt function imnoise
J=imnoise(array_data,'poisson');
Here example
I=randi([0,1],[100,100]); % Any random array data, sizes 100x100
% You may consider any size data
J=imnoise(I,'poisson');
imshow(J);

Note: The array size you mentioned is quite small, so visualization of noise distribution can be difficult in such cases.
9 Comments
Ankita Jindal
on 6 Jan 2021
Ankita Jindal
on 6 Jan 2021
KALYAN ACHARJYA
on 6 Jan 2021
Edited: KALYAN ACHARJYA
on 6 Jan 2021
Yes, I tried it with 4x4, it has very few elements, so the noise effect can be very small(because of tiny original data size) and can be quite difficult to detect by eye/distribution map. But yes, J is different from I.
I=randi([0,1],[4,4]);
J=imnoise(I,'poisson');
imshow(J);
But, is J is same as I? No
>> isequal(I,J)
ans =
logical
0
Ankita Jindal
on 6 Jan 2021
KALYAN ACHARJYA
on 6 Jan 2021
Edited: KALYAN ACHARJYA
on 6 Jan 2021
Note: Having 0 and 1 in array data and actually logical data array are two different things. Hence this function works for uint8, uint16, double, int16, single data type.
Definitely, after adding the noises the pixel value will be change (In 0 & 1 data array, not logical, it may n't be remain "zero or 1"), Here the changes are very less, hence it cant reflects in higher decimanl points.
See
I=randi([0,1],[10,10]);
J=imnoise(I,'poisson');
sub_result=I-J
sub_result =
1.0e-05 *
0.2733 0.0133 0 0 0 0 0.0175 0 0 0.1302
0 0 0 0.0334 0 0 0.0775 0 0 0.0091
0.1266 0.0583 0 0.0398 0.0347 0 0 0 0 0
0 0 0 0.0110 0 0.0677 0 0 0.0967 0
0 0 0 0 0 0 0 0.0048 0.1374 0.0109
0.0903 0 0 0 0 0 0.0665 0.1197 0 0.0018
0 0 0 0 0.1723 0 0.0073 0.0092 0 0
0 0 0 0 0 0.0267 0 0 0 0
0 0 0 0 0 0 0.0078 0 0 0
0 0 0 0 0 0.0758 0 0 0 0.1429
Better to see the effects on other array data, and apply the same in your data

PIC source: itl.nist.gov
I=imread('rice.png');
J=imnoise(I,'poisson');
sub_result=I-J
imhist(J);

Ankita Jindal
on 6 Jan 2021
Ankita Jindal
on 6 Jan 2021
Ankita Jindal
on 7 Jan 2021
KALYAN ACHARJYA
on 7 Jan 2021
Edited: KALYAN ACHARJYA
on 7 Jan 2021
If you want to add noise to any data, if there is definitely a change in the values of the data elements, this change follow the PDF map of the applied noise.
Note: The array size you mentioned is quite small, so difference visualization of noise distribution can be difficult in such cases.
Does it make sense to add noise to the image, without changing its pixel values? Hope I understood your question correctly, if not, let me know.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
