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
1 个评论
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!