A question about Block PCA application
1 view (last 30 days)
Show older comments
I have a problem in applying PCA method to block pictures.I mean,intending to apply PCA method to SubPictures.as the followed:
allsamples = []; Subs = []; for i = 1:64 for j = 1:10 str = 'C:\Users\liu90\Desktop\FV_sample3\train\s_'; in1 = imread(strcat(str,num2str(i),'_',num2str(j),'.bmp')); r = 6; c= 5; [m n] = size(in1); %计算分区的大小 mPartitionSize = floor(m / r); nPartitionSize = floor(n / c);
for ii = 1:r-1
for jj = 1:c-1
Sub = in1((ii-1)*mPartitionSize+1:ii*mPartitionSize,(jj-1)*nPartitionSize+1:jj*nPartitionSize);
Sub = double(Sub);
b=Sub(1:15*30);
b=double(b);
Subs=[Subs;b];
% allsamples = [allsamples;Subs];
end
end
% Subs = fastfPCA(Subs,5);
% Subs(:) =Subs';
allsamples = [allsamples;Subs];
end
end
the dataset contains 640 pictures,each picture will be divided into 6*5=30 SubPictures,how can I do PCA to each picture and then I want to use the data to train SVM to classify. I want the SubPictures of the same previous Pciture to make up a matrix then do PCA to it and use the results to make up a big matrix contains the main information of the 640 pictures,then classify them by SVM. How can I solve the problem?please help me!
0 Comments
Answers (0)
See Also
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!