image=imread('Tiger.jpg');
%figure,imshow(uint8(image)),title('Before applying Median Filter');
[rows, cols]=size(image);
B=zeros(rows, cols);
for rowNo=2:rows-1
for colNo=2:cols-1
K=image(rowNo-1:rowNo+1,colNo-1:colNo+1);
B(rows,cols)=median(K);
end
end
figure,imshow(uint8(B)),title('After applying Median Filter');
我想在不使用内置函数的情况下计算图像的中位数,但是我给了我错误,任何人都可以帮我解决错误
??? Subscripted assignment dimension mismatch.
Error in ==> Quest_2median at 18
B(rows,cols)=median(K);