I did some mistake in my code.my goal is i wanna set 21x21 processing window over 255x255 image ,then i need to find median value by sorting the pixels for each window,then i wanna find difference between each pair of adjacent pixels of sorted pixel
1 次查看(过去 30 天)
显示 更早的评论
pls find what i wanna change in this code
for n=1:21
for m=1:21
b=noisy_img([n:n+20],[m:m+20]);
b
c=b(:);
d=sort(c);
k=numel(d);
e=median(d);
e
for i=1:k-1
f=d(i+1)-d(i);
f
end
end
end
0 个评论
采纳的回答
Image Analyst
2014-10-29
编辑:Image Analyst
2014-10-29
Why not just use medfilt2()? And what is this algorithm supposed to produce? Your third for loop does nothing but overwrite f 441 times because f is not indexed. In a 21 by 21 window there are 441 pixels, so you'll have 440 differences between pairs. What is the use of f if you could get it working and have all 440 elements of f. What does f represent?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!