Why do I see an all white image when I use IMFILTER?

8 次查看(过去 30 天)
i have chessboard image and i'm apply ones(31) filter for this image by using imfilter but the result is white image . can you help me to solve this error
this code used
%%%%%%%%%%%%%%%%%
g = imread('ch2.jpg');
h= rgb2gray(g);
w=ones(31);
gd=imfilter(h,w);
imshow(gd,[]) ;

回答(2 个)

Premnath
Premnath 2013-10-19
编辑:Premnath 2013-10-19
I am unsure what you are trying to achieve. If you are using w=ones(31) as averaging filter. Then change your code as below
g = imread('ch2.jpg');
h= rgb2gray(g);
w=fspecial('average',31);
gd=imfilter(h,w);
imshow(gd) ;

Image Analyst
Image Analyst 2013-10-19
Cast h to double and it will work:
h = double(rgb2gray(g));

Community Treasure Hunt

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

Start Hunting!

Translated by