创建HoG特征矩阵,数组
Create HoG feature matrix, array
我想使用 HoG 从一组 if (16) 图像中提取特征。我已经为一张图片做了,它返回了一个很好的结果。现在我想为所有其他图像做,并存储功能。
.
请问如何创建 matrix/array 来存储分类特征。
我所有的图像都在一个文件夹中...
到目前为止,这是我的代码,请帮助:
%% 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
如果我理解正确的话。您希望拥有一个包含所有图像的 Hog 特征的多维数组。如果是这种情况,这里有一个简单的解决方案
accum = [];
for i = 1:training.Count
[hogFeature, visualization]= ...
extractHOGFeatures(read(training,i));
accum = [accum;hogFeature];
end
现在,accum
矩阵的每一行都是对应图像的一组 Hog 特征。可以通过 features = accum(n,:);
.
访问第 n 个图像的 Hog 特征
我想使用 HoG 从一组 if (16) 图像中提取特征。我已经为一张图片做了,它返回了一个很好的结果。现在我想为所有其他图像做,并存储功能。 . 请问如何创建 matrix/array 来存储分类特征。 我所有的图像都在一个文件夹中... 到目前为止,这是我的代码,请帮助:
%% 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
如果我理解正确的话。您希望拥有一个包含所有图像的 Hog 特征的多维数组。如果是这种情况,这里有一个简单的解决方案
accum = [];
for i = 1:training.Count
[hogFeature, visualization]= ...
extractHOGFeatures(read(training,i));
accum = [accum;hogFeature];
end
现在,accum
矩阵的每一行都是对应图像的一组 Hog 特征。可以通过 features = accum(n,:);
.