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!