Matlab中图像类别分类的BagOfFeatures

时间:2016-10-05 23:50:56

标签: image matlab

在Matlab Image Category Classification中执行此示例 我发现尝试使用此命令获取SURF功能的词汇

时出错
bag = bagOfFeatures(trainingSet);

错误如下

Error using bagOfFeatures/parseInputs (line 1023)
The value of 'imgSets' is invalid. Expected imgSets to be one of these types:

imageSet

Instead its type was matlab.io.datastore.ImageDatastore.

我正在使用ImageDatastore输入而不是imgSets,但我遵循Mathworks示例。任何人都可以解释为什么会发生这种情况,如何将trainingSet转换为imgSets类型?

1 个答案:

答案 0 :(得分:2)

您必须将ImageDatastore对象转换为imageSet对象。这可以简单地通过使用以下行来完成:

bagOfFeatures(imageSet(trainingSet.Files));