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!