How to save a magnitude value of Filter Gabor into a vector?

1 view (last 30 days)
I have a research a pattern (batik) recognition using filter gabor method. I want to use gabor magnitude value as a feature extraction. I have 108 image pattern (72 for training dan 36 for testing). So, how to save the gabor magnitude value into a vector? I mean all of training data save in a matrix vector and then i can use it for classification against testing data. Here is my code if there some correction..
%Pelatihan (Training)
folder_citra = 'data latih';
nama_citra = dir(fullfile(folder_citra, '*.jpg'));
jumlah_citra = numel(nama_citra);
for n = 1:jumlah_citra
% Membaca citra
Img = imread(fullfile(folder_citra, nama_citra(n).name));
% Resize citra
Img_resize = imresize(Img, [250 250]);
% Konversi citra RGB menjadi Grayscale
Img_gray = rgb2gray(Img_resize);
% Ekstraksi Ciri Tekstur Filter Gabor
wavelength = 4;
orientation = 30;
[mag,phase] = imgaborfilt(Img_gray, wavelength, orientation);
mag_resize = imresize(mag,1/100);
training = reshape(mag_resize,1,[]);
% ciri_latih(n,????) = mag;
end
%Pengujian (Testing)
folder_citra_uji = 'data uji';
nama_citra_uji = dir(fullfile(folder_citra_uji, '*.jpg'));
jumlah_citra_uji = numel(nama_citra_uji);
for n = 1:jumlah_citra_uji
% Membaca citra
Img_uji = imread(fullfile(folder_citra_uji, nama_citra_uji(n).name));
% Resize citra
Img_resize_uji = imresize(Img_uji, [250 250]);
% Konversi citra RGB menjadi Grayscale
Img_gray_uji = rgb2gray(Img_resize_uji);
% Ekstraksi Ciri Tekstur Filter Gabor
wavelength_uji = 4;
orientation_uji = 30;
[mag_uji,phase_uji] = imgaborfilt(Img_gray_uji, wavelength_uji, orientation_uji);
mag_resize_uji = imresize(mag_uji,1/100);
testing = reshape(mag_resize,1,[]);
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!