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

8 vues (au cours des 30 derniers jours)
ibrahim abufeseifes
ibrahim abufeseifes le 19 Oct 2013
Commenté : Image Analyst le 22 Oct 2013
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,[]) ;
  1 commentaire
Image Analyst
Image Analyst le 19 Oct 2013
You forgot to attach your image ch2.jpg. Please attach it using the paperclip icon.

Connectez-vous pour commenter.

Réponses (2)

Premnath
Premnath le 19 Oct 2013
Modifié(e) : Premnath le 19 Oct 2013
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 le 19 Oct 2013
Cast h to double and it will work:
h = double(rgb2gray(g));
  1 commentaire
Image Analyst
Image Analyst le 22 Oct 2013
Please mark as Accepted if it worked for you. Thanks.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by