Using PCA for feature selection OCR Matlab

1 view (last 30 days)
ana ain
ana ain on 24 May 2016
I have a matrix from feature extraction process (using DCT method). The size is 4096x601 (mxn) in double type.
I wanted to use PCA for dimensionality reduction without losing important information (appropriate features of the data). Expected ouput is kxn matrix.
This is my code for collecting feature. After get DCT result, I need PCA to make the dimension become smaller (efficient) to prevent 'out of memory' issue in the training stage.
srcFiles = dir('D:\...\datatrain\*.png');
fetrain1 = [];
for a = 1:length(srcFiles)
file_name = strcat('D:\...\datatrain\',srcFiles(a).name);
A = imread(file_name);
% [fiturtrain] = feature_extractor (A);
[c] = CobaDCT (A);
[fiturtrain] = cobazigzag(c);
fetrain1 = [fetrain1 fiturtrain];
% vectorname = strcat(file_name,'_array.mat');
end
fetrain1 = pca (fetrain1);
save ('fetrain1.mat','fetrain1');
Surely, pca function not give me the best solution, because after get a certain matrix and run training process, I get this error:
"Error using bsxfun
Non-singleton dimensions of the two input arrays must match each other."
. Any suggestions and help would be appreciated.

Answers (0)

Categories

Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!