Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
fahim GH
fahim GH am 7 Jun. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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 Kommentar
Walter Roberson
Walter Roberson am 8 Jun. 2015
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

Antworten (0)

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by