How to use filter
古いコメントを表示
Hi all,
I am new to Matlab. I need to know how to use a filter to eliminate non-uniformity in an image.
11 件のコメント
Ank
2014 年 8 月 28 日
I can help you get started.
close all;
I = imread('11.png');
I = rgb2gray(I);
H = fspecial('disk',8);
background = imopen(I,strel('disk',40) );
background = imfilter(background,H,'replicate');
I2 = I - background;
background = imopen(I2,strel('disk',50) );
background = imfilter(background,H,'replicate');
I3 = I2 - background;
I4 = imadjust(I3);
figure;imshow(I4);
Ank
2014 年 8 月 28 日
More hint
close all;
I = imread('11.png');
I = rgb2gray(I);
H = fspecial('disk',10);
background = imopen(I,strel('disk',77) );
background = imfilter(background,H,'replicate');
I2 = I - background;
background = imopen(I2,strel('disk',77) );
background = imfilter(background,H,'replicate');
I3 = I2 - background;
I4 = imadjust(I3);
I5 = medfilt2(I4,[30 30]);
I5 = I5-I4;
I5 = imcomplement(imadjust(I5));
figure;imshow(I5,[]);
Ank
2014 年 8 月 28 日
Ok i am virtually telling u the answer replace the med filter with some low pass.
close all;
I = imread('11.png');
I = rgb2gray(I);
I2 = medfilt2(I,[20 20]);
I3 = I2-I;
I3 = imcomplement(imadjust(I3));
figure;imshow(I3,[]);
Ank
2014 年 8 月 28 日
Yes. I has posted the first 2 just as some hints. The 3rd one is the closes to the answer. Your approach is correct but u can see from the result that median filter works better. Median filter is also a kind of low pass filter it is not linear that all. I guess after the results of the 3rd answer you need to process your image further like using local thresholding etc depends on what you want to do with it.
Ank
2014 年 8 月 28 日
close all;
I = imread('11.png');
I = rgb2gray(I);
h = fspecial('gaussian',20,3);
I2 = imfilter(I,h);
%I2 = medfilt2(I,[20 20]);
I3 = I2-I;
I3 = imcomplement(imadjust(I3));
figure;imshow(I3,[]);
I = imread('11.png');
I = rgb2gray(I);
I2 = medfilt2(I,[20 20]);
I3 = I2-I;
I3 = imcomplement(imadjust(I3));
I4 = bradley(I3);
I3 = bradley(I);
I3 = I3+I4;
figure;imshow(I3,[]);
where bradley is the function in http://www.mathworks.fr/matlabcentral/fileexchange/40854-bradley-local-image-thresholding
so thing something in similar lines
imcomplement is is used as i am subtracting. check the alternative i posted for color. should be the same for color if you process it on V. I guess u cannot threshold on the V there.
close all;
OI = imread('1.JPG');
OI = rgb2hsv(OI);
I = OI(:,:,3);
h = fspecial('gaussian',20,30);
I2 = imfilter(I,h);
I3 = -I2+I;
I3 = I3-min(min(I3));
OII= OI;
OII(:,:,3) = I3;
figure;imshow(hsv2rgb(OII));
I = OI(:,:,3);
I2 = medfilt2(I,[20 20]);
I3 = -I2+I;
I3 = I3-min(min(I3));
II = I3;
I4 = bradley(I3);
I3 = bradley(I);
I3 = I3+I4;
OI(:,:,3) = II;
figure;imshow(hsv2rgb(OI));
Siam
2014 年 9 月 4 日
Siam
2014 年 9 月 4 日
Siam
2014 年 9 月 7 日
Image Analyst
2014 年 9 月 8 日
Use trial and error until you get some output that you're happy with.
採用された回答
その他の回答 (1 件)
Spandan Tiwari
2014 年 8 月 28 日
0 投票
The classical homomorphic filtering might be able to help here. See the following blog post on the blog Steve on Image Processing for details.
3 件のコメント
Siam
2014 年 8 月 29 日
Image Analyst
2014 年 8 月 29 日
Yes, Basically it assumes that the really, really blurred version of the image is the background or illumination pattern.
Siam
2014 年 8 月 29 日
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!