创建HoG特征矩阵,数组

时间:2016-03-12 18:28:12

标签: matlab matrix multidimensional-array feature-extraction

我想使用HoG从一组if(16)图像中提取特征。我已经完成了一个图像,它返回了一个很好的结果。现在我想为所有其他图像做,并存储功能。 。 请问如何创建矩阵/数组来存储分类功能。 我的所有图片都在一个文件夹中...... 到目前为止,这是我的代码,请帮助:

%% Load Images
imgFolder =   fullfile('C:\Users\Engineering\Desktop\Finn\NEW');
 imgSet = imageSet(imgFolder);

 %% Display Montage of First Note
 figure;
 montage(imgSet(1).ImageLocation);
 title('Images of Single Note');

 %%  Display Query Image and Database Side-Side
 galleryImage = read(imgSet,1);
 figure;
 for i=1:size(imgSet,2)
imageList = imgSet(i).ImageLocation;
 end

         subplot(1,2,1);imshow(galleryImage);
 subplot(1,2,2);montage(imageList);
 diff = zeros(1,9);

 %% Split Database into Training & Test Sets
 [training,test] = partition(imgSet,[0.8 0.2]);

 %% Extract and display Histogram of Oriented Gradient Features for single Note 
 [hogFeature, visualization]= ...
     extractHOGFeatures(read(training,1));
 figure;
  subplot(2,1,1);imshow(read(training,1));title('Input Note');
 subplot(2,1,2);plot(visualization);title('HoG Feature');

 %% Extract HOG Features for training set

 I need help in this section, please. Thank you

1 个答案:

答案 0 :(得分:1)

如果我正确理解了这个问题。您希望拥有一个具有所有图像的Hog Features的多维数组。如果是这种情况,这是一个简单的解决方案

 accum = [];
 for i = 1:training.Count
     [hogFeature, visualization]= ...
         extractHOGFeatures(read(training,i));
     accum = [accum;hogFeature];
 end

现在,accum矩阵的每一行都是相应图像的一组Hog Features。 Hog第n个图像的特征可以通过features = accum(n,:);访问。