How do i use imnoise localvar?

32 次查看(过去 30 天)
Portgas Ace
Portgas Ace 2014-9-4
I attached an image of what we are working on right now. We have to extract the 'white ones' on them but our problem is that some part of the image are getting in the way since they have the 'same color' as the ones we want to extract. So I was thinking of inserting a noise then removing it to solve the problem. I was thinking of using 'imnoise localvar' since it somewhat relates to image intensities.
Here is my sample code
I = imread('im0059.ppm');
imshow(I)
J = imnoise(I,'localvar', image_intensity,var) ;
figure, imshow(J)
K = filter2(fspecial('average',3),J)/255;
figure, imshow(K)
L = medfilt2(J,[3 3]);
figure, imshow(L)
I don't know what to put on image_intensity and var. Help please. Also if you have any suggestions on what im doing. Please do tell. Thanks a lot!
  3 个评论
kuldeep desai
kuldeep desai 2018-7-16
编辑:kuldeep desai 2018-7-16
I = imread('im0059.ppm'); subplot(2,2,1),imshow(I),title('Original Image') I=rgb2gray(I); subplot(2,2,2), imshow(I),title('Gray Image') J = imnoise(I,'localvar',0.04*rand(size(I))) ; subplot(2,2,3), imshow(J),title('Noisy Image') K = filter2(fspecial('average',3),J)/255; L = medfilt2(J,[3 3]); subplot(2,2,4), imshow(L),title('Noise Removal')
Image Analyst
Image Analyst 2018-7-16
Kuldeep, can you put this down in the Answers section along with the other answers instead of up here in the comments section where we usually ask the user to clarify the question? You can also get credit (reputation points) for it down there.
Read this link so your code will be properly formatted.

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2014-9-4
Why don't you just do trial and error until you get an image that you're happy with?

Community Treasure Hunt

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

Start Hunting!

Translated by