Gabor Feature Vector Algorithm

I have found an algorithm for generate a feature vector of Gabor Filter from one of handwritting text recogntion paper like this sentence :
Subsequently, we divide the 64 × 64 representation into 8 × 8 feature regions, resulting in 64 regions. From each, we extract one value as an element in 512 feature vector (8 × 64).
So, the 64 x 64 is a normalized (resize) image, before convoluted with one of 8 gaborArray Gabor's banks. And the total_bank is 8. And the gaborMag is a convoluted image.
Is this Matlab code could solving an algorithm above?
total_bank = length(gaborArray);
for i = 1:total_bank
subplot(4,2,i)
hasil_gabor{i} = gaborMag(:,:,i); % Convolution between image with each bank Gabor
imshow(gaborMag(:,:,i),[]);
theta = gaborArray(i).Orientation;
lambda = gaborArray(i).Wavelength;
title(sprintf('Orientation=%d, Wavelength=%d',theta,lambda));
featureVector = [];
for a = 1:jumlah_bank
gaborAbs = sum(abs(gaborMag(:,i)), 2); % sum all matrix elements in each rows
gaborAbs = gaborAbs(:);
% Normalized to zero mean and unit variance.
gaborAbs = ((gaborAbs-mean(gaborAbs))/(4.*std(gaborAbs,1))) + 0.5; % feature vector equation from Moftah Elzobi et al
featureVector = [featureVector; gaborAbs];
end
end
From algorithm above, i get right featureVector = 512 (one column). But i am not sure.
Thanks in advance. :)

9 Comments

I do not see where you split the 64 x 64 into 8 x 8 regions?
Angga Lisdiyanto
Angga Lisdiyanto on 20 Jan 2016
Edited: Angga Lisdiyanto on 20 Jan 2016
Oh i am sorry. I have edited my question. The total_bank is 8.
Then your code appears to be incorrect. You appear to be convolving the entire 64 x 64 ahead of time, before breaking it up to 8 x 8 regions. The 8 x 8 regions need to be convolved separately.
Angga Lisdiyanto
Angga Lisdiyanto on 20 Jan 2016
Edited: Angga Lisdiyanto on 20 Jan 2016
I am still confused. So 64 x 64 image is splited into 8 x 8 and then convolute it with 8 Gabor bank for each 8 x 8 splited image?
Then 8 convoluted image (size = 8 x 8) becoming to one column/row matrix (count = 512) subsquently?
So one Gabor bank is not to be convoluted with the whole 64 x 64 image?
This is not 512 feature vector. Am i must suming it with SUM(x) then i would get one column/row (count = 512)?
Each 8 x 8 is be convolved separately. The results can differ compared to convolving the whole 64 x 64 at once; in particular the results along each 8 x 8 edge could be different depending on how the convolution handles the outside boundaries. In convolution it is common for the outside to be padded with 0's as if it were the only block that existed; whereas if you did all 64 x 64 at once, the values brought in would be actual values from the other 8 x 8 sub-blocks.
Angga Lisdiyanto
Angga Lisdiyanto on 20 Jan 2016
Edited: Angga Lisdiyanto on 20 Jan 2016
I am still confuse. Must i summing it? :(
The figure of the process in the paper is like this :
Angga Lisdiyanto
Angga Lisdiyanto on 20 Jan 2016
Edited: Angga Lisdiyanto on 20 Jan 2016
So one feature vector is a cell with 8 x 8 matrix inside it?
And then normalizing it become a 1 element (for 64 x 64) with this equal?

Sign in to comment.

Answers (0)

Asked:

on 20 Jan 2016

Commented:

on 20 Jan 2016

Community Treasure Hunt

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

Start Hunting!