在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类型?
答案 0 :(得分:2)
您必须将ImageDatastore对象转换为imageSet对象。这可以简单地通过使用以下行来完成:
bagOfFeatures(imageSet(trainingSet.Files));