How to add poisson's noise to predefined binary array (4 x 4 array)

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

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 6 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 6 日

0 投票

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 件のコメント

Ankita Jindal
Ankita Jindal 2021 年 1 月 6 日
Thanks for your suggestion,
But I already checked that, by using imnoise there is almost no noise. because I think the size of image is very small.
Thanks
Ankita Jindal
Ankita Jindal 2021 年 1 月 6 日
actually I have 4 x 4 image that is very small if we use imnoise you will see that this function just returns the same values of image
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 6 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 6 日
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
Ankita Jindal 2021 年 1 月 6 日
I=randi([0 1],4,4)
I =
0 1 1 1
0 0 1 0
0 0 1 1
1 0 1 1
J=imnoise(I,'poisson')
J =
0 1.0000 1.0000 1.0000
0 0 1.0000 0
0 0 1.0000 1.0000
1.0000 0 1.0000 1.0000
yes, you can see both matrixes are similar the only difference is that (1.000 are not actually 1 they are very close 1 value) that's why isequal showing logical 0.
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 6 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 6 日
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
Ankita Jindal 2021 年 1 月 6 日
Hi,
Actually my point is if we use imnoise function for binary image its always giving the same output no difference if you see by plotting using imshow.
ya there is little chnge in values but at the same position where the array has 1 values (those chnged values are very close to 1).
please check the attached picture for 10x 10 and 20 x 20 array.
but what i need is have poisson noise in the image
Ankita Jindal
Ankita Jindal 2021 年 1 月 6 日
Ankita Jindal
Ankita Jindal 2021 年 1 月 7 日
Please check the picture for better understanding.
You can see that I need poisson's noise that can be added to the image directly and we have different pixel values on the image.
Thanks
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 7 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 7 日
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.

サインインしてコメントする。

カテゴリ

質問済み:

2021 年 1 月 6 日

編集済み:

2021 年 1 月 7 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by