the problem about use nlfilter
显示 更早的评论
Hello, everyone
to imitate the demo from help and the demo from mathworks, I wrote the code about nlfilter.
%a gray level image using nlfilter function
A=imread('C:\Users\yanghang\Pictures\0.jpg');% get the image dimension
[rows,columns,numofColorBands]=size(A);
if numofColorBands >1 %not the gray image
grayimage=A(:,:,2) %Take Green channel
end
fun=@(x)median(x(:));% tell nlfilter to use function median to do its operation
doubleImage=im2double(grayimage);
B=nlfilter(grayimage,[3,3],fun); % filtering the image
subplot(1,3,1);
imshow(A);
subplot(1,3,2);
imshow(grayimage);
subplot(1,3,3);
imshow(B);
There is one thing troubles me. if I replace the first sentence with the second sentence
% doubleImage=im2double(grayimage);
doubleImage=double(grayimage);
I get two results. But in the workplace, the format is all double ,so why there are different?
Thanks in advance.
Hang Yang
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 图像滤波 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!