Info

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

I'm new to image processing and cannot trace this code?

조회 수: 4 (최근 30일)
fahim GH
fahim GH 2015년 6월 7일
마감: MATLAB Answer Bot 2021년 8월 20일
hi I'm new to image processing and I can not trace this code,can any body say a brief explanation about what is that function?? thanks
function H = circconvmatx2(h, M,N)
[mh, nh] = size(h);
if mh~=nh,
error('blur kernel must be square');
end
blockheight = N;
blockwidth = M;
for i=((nh+1)/2):nh,
%Take the kernel
h0 = h(:,i);
h0 = h0(:)';
h0 = fliplr(h0);
h0 = circshift( padarray( h0, [0 N-nh], 'post' ), [0 -(nh+1)/2+1] );
if sum(find(abs(h0)>0)) == 0,
H0 = sparse(M,M);
else
H0 = sparse(circulant(h0'));
end
if i==(nh+1)/2,
H = H0;
else
H = [H H0];
end
end
for i=(nh+1)/2-1:-1:1,
%Take the kernel
h0 = h(:,i);
h0 = h0(:)';
h0 = fliplr(h0);
h0 = circshift( padarray( h0, [0 N-nh], 'post' ), [0 -(nh+1)/2+1] );
if sum(find(abs(h0)>0)) == 0,
H0 = sparse(M,M);
else
H0 = sparse(circulant(h0'));
end
H = [H0 H];
end
H = [H, sparse(zeros(N,N*(N-nh)))];
H = circshift( H, [0 -N*((nh+1)/2-1)] );
H0 = H;
for i=1:N-1,
H = [H; circshift( H0, [0 N*i] )];
end
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 6월 8일
Some kind of 2D circular convolution. circulant() is not a Mathworks-provided function but might be http://www.mathworks.com/matlabcentral/fileexchange/22858-circulant-matrix

답변 (0개)

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by