how to get low pass filter from image

2 次查看(过去 30 天)
When I am trying to run the following code, it is giving an error
[ ??? Input argument "P" is undefined. Error in ==> idealfilter at 13 H=double(D<=P); ] Please guide me to remove this error. My image size is 512*512
function idealfilter(X,P) f=imread('lena.jpg'); [M,N]=size(f); F=fft2(double(f)); u=0:(M-1); v=0:(N-1); idx=find(u>M/2); u(idx)=u(idx)-M; idy=find(v>N/2); v(idy)=v(idy)-N; [V,U]=meshgrid(v,u); D=sqrt(U.^2+V.^2); H=double(D<=P); G=H.*F; g=real(ifft2(double(G))); imshow(f),figure,imshow(g,[ ]); end
i am trying to apply low pass filter on image. is this one right code for getting low pass filter image. i want to get center point after applying low pass filter.
plz help me ...!!!!

回答(1 个)

David Young
David Young 2011-1-30
It looks as if you didn't assign a value to the second input argument when you called the function. I also see that the first argument, X, is unused.
It seems possible you don't understand function call. If you have any doubts about how to pass values to functions, have a look at some of the introductory Matlab documentation, or a textbook, to get the idea - you'll find it very helpful to get this central idea completely clear.
By the way, this question seems closely related to your previous one, at
http://www.mathworks.com/matlabcentral/answers/587-low-pass-filter-for-image
It would be better to follow up that question rather than start a new one.

类别

Help CenterFile Exchange 中查找有关 Frequency Transformations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by