MATLAB Answers


How do i use imnoise localvar?

Asked by Portgas Ace on 4 Sep 2014
Latest activity Commented on by Image Analyst
on 16 Jul 2018
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');
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!


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

1 Answer

Answer by 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?


Sign in to comment.