Reply by Mike Yarwood February 4, 20052005-02-04
<thanhhahuy@gmail.com> wrote in message 
news:1107504853.471941.215400@g14g2000cwa.googlegroups.com...
> Hello, would any one out there can help me how to appy IIR to filter an > 256x256 image using IIR in Matlab? is there any function for it (I mean > 2 D IIR filter). > > I have to use a IIR filter to filter a image and it is required that I > do it in Matlab. > > I have done it in C and using difference equation: > > y(m,n)=a1*x(m,n)+a2*y(m-1,n)+..... > > and everything is fine. > > Now I have to do it in matlab. I am provided the transfer function > H(z1,z2), and an original image:( 256x256) > > The problem is that if I do the same as what I did in C as follows: > > for i=2:256 > for j=2:256 > > y(i,j)=a1*x(i,j)+a2*y(i-1,j)... and so on > > end > end > > > MATLAB runs very slowly and it seems that it will never finish. > > > I think I can do another way by calculate X,H in frequency domain and > then transform back to the spacial domain. But I don't know how to do > that. Would any one out there can help me out? > > Thank you very much > > yours truly >
Hi - hope you also posted this in comp.soft-sys.matlab as they will tell you to get rid of those hideous clunky for loops and "vectorise" it and maybe even give some suggestions as to how ; after which it will be much faster. Best of luck - Mike
Reply by george February 4, 20052005-02-04
IIR filters are not supported in the Image Processing Tool Box of
MATLAB as it produces instability.

George

Reply by February 4, 20052005-02-04
Hello, would any one out there can help me how to appy IIR to filter an
256x256 image using IIR in Matlab? is there any function for it (I mean
2 D IIR filter).

I have to use a IIR filter to filter a image and it is required that I
do it in Matlab.

I have done it in C and using difference equation:

y(m,n)=a1*x(m,n)+a2*y(m-1,n)+.....

and everything is fine.

Now I have to do it in matlab. I am provided the transfer function
H(z1,z2), and an original image:( 256x256)

The problem is that if I do the same as what I did in C as follows:

for i=2:256
for j=2:256

y(i,j)=a1*x(i,j)+a2*y(i-1,j)... and so on

end
end


MATLAB runs very slowly and it seems that it will never finish.


I think I can do another way by calculate X,H in frequency domain and
then transform back to the spacial domain. But I don't know how to do
that. Would any one out there can help me out?

Thank you very much

yours truly