How do i use imnoise localvar?

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 Comments

I want to do something like this image. How do i do that?
kuldeep desai
kuldeep desai on 16 Jul 2018
Edited: kuldeep desai on 16 Jul 2018
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')
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.

Sign in to comment.

Answers (1)

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

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 4 Sep 2014

Commented:

on 16 Jul 2018

Community Treasure Hunt

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

Start Hunting!