필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Index problem help

조회 수: 1 (최근 30일)
Steve
Steve 2012년 5월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello Experts,
I am trying to build the median filter with given window size. Here is what I did so far, please correct me because for some reason I don't get the right results for general rows and cols (non equal or equal):
function [ newImg ] = myMedian( img, rows, cols )
ModifyImg = padarray(img,[(abs(rows-cols)+1) (abs(rows-cols)+1)]);
newImg = zeros(size(img));
for i = 1:(size(ModifyImg,1) - 2*(abs(rows-cols)+1))
for j = 1:(size(ModifyImg,2) - 2*(abs(rows-cols)+1))
window = ModifyImg(i:i+rows-1, j:j+cols-1);
Sorted_Window = sort(window(:));
newImg(i,j) = Sorted_Window(ceil(0.5*rows*cols));
end
end
  댓글 수: 1
Jan
Jan 2012년 5월 6일
Please explain, why you assume, that you do not get the correct results.

답변 (0개)

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by