我想使用 MATLAB 的 bagOfFeatures() 函数。但它需要以 imageSet 或 imageDataStore 的形式输入。我要运行的代码如下:
Dataset = 'D:\dsktop\kinect_leap_dataset\acquisitions';
thresh1 = 0;
thresh2 = 20;
k = dir(fullfile(Dataset,'\P*\G*\*_depth.png'));
kf = {k(~[k.isdir]).folder};
kn = {k(~[k.isdir]).name};
for j=1:length(k)
% Applying thresholding to the original image
full_name = horzcat(kf{j},filesep,kn{j});
image = imread(full_name);
image_bin1 = (image < thresh2);
image_bin2 = (thresh1 < image);
image_bin = abs(image_bin2- image_bin1);
sequence{i} = image_bin;
end
% Bag of Features
bag = bagOfFeatures(sequence);
但是“序列”是一个单元类,所以 bagOfFeatures() 给了我错误。所以我尝试了这个:
Dataset = 'D:\dsktop\kinect_leap_dataset\acquisitions';
imgFolder = fullfile(Dataset);
imgSets = imageSet(imgFolder, 'recursive');
imgSets.Description
但现在的问题是如何对 imgSets 中保存的图像进行处理(阈值化)。此外,在处理完如何在 imageSet 类中保存所有“image_bin”图像之后,我可以将它们作为 BagOfFeatures() 函数的输入。