I*k->AK

将卷积转化为乘积:

function A  = GetA(I,m,n)
%GetA get A which transforms P@k to A*k
% I is the input imageP;
%m and n are the height and weight of k respectively.
[height width] = size(I);
A = zeros(height*width, m*n);
for ii =(floor(m/2)+1):(height-floor(m/2))
    for jj = (floor(n/2)+1):(width-floor(n/2))
        for c = 1:n
            for r= 1:m
              A((ii-1)*width + jj, (c-1)*m+r) = I(ii+floor(m/2)-r+1, jj+floor(n/2)-c+1);       
            end
        end
     end
end
end
原文地址:https://www.cnblogs.com/jiangnanrain/p/3271050.html