Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

1 次查看(过去 30 天)
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

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by