Friday, November 16, 2018

image processing - Apply Singular Value Decomposition on Gabor filters


According to my question in this link, I applied (with a big help from lennon310) the separability of Gabor filters of any orientation. The only disadvantage of this method is the convolution in the complex domain. So we can treat the Gabor filter G(x,y) as a two dimensional matrix that has a low rank, since the filter is fairly smooth at lower frequencies. Singular value decomposition can then be used in order to decompose the filter into a linear sum of real separable filters.


enter image description here


Here, ui, vi are the columns of the orthogonal matrices U,V. s_i is the singular value. The convolution of the filter G(x, y) with the image I(x, y) can now be approximated using: enter image description here


Please I need a help about how can I edit my code in this link in order to apply that in MATLAB. Any help will be very appreciated.



Answer



I won't recommend you apply SVD in your Gabor filter, since it does not bring much benefit but increase the computing load. If you implement SVD, you may not separate the filter at first, instead the SVD is performed on the 2D Gabor filter:


                for i = -filtSizeL:filtSizeR
for j = -filtSizeL:filtSizeR


if ( sqrt(i^2+j^2)>filtSize/2 )
E = 0;
else
x = i*cos(theta) - j*sin(theta);
y = i*sin(theta) + j*cos(theta);
E = exp(-(x^2+G^2*y^2)/(2*sigmaq))*cos(2*pi*x/lambda(k));
end
f(j+center,i+center) = E;
end

end

%% SVD %%%%
[u,s,v]=SVD(f);

With u, s, and v, you implement the convolution with your image:


    convv = zeros(size(image_double));
for i = 1:filtSizeR+filtSizeL+1
convv1=imfilter(image_double*s(i,i), u(i,:),'conv');
convv2=imfilter(double(convv1),v(:,i)','conv');

convv = convv + convv2;
end

figure
imagesc(imag(convv));

Yet I don't think this method is as good as your separable f and g method.


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...