如何解决Matlab:无法执行赋值,因为左侧的大小为 1×2304,右侧的大小为 1×0调整图像大小后
trainingSet = imageDatastore(syntheticDir,'IncludeSubfolders',true,'LabelSource','foldernames');
numImages = numel(trainingSet.Files);
trainingFeatures = zeros(numImages,hogFeatureSize,'single');
faceDetector = vision.CascadeObjectDetector;
cellSize = [64 64];
for i = 1:numImages
img = readimage(trainingSet,i);
img = rgb2gray(img);
bboxes = faceDetector(img);
img = imcrop(img,bboxes);
img = imresize(img,[100 100]);
trainingFeatures(i,:) = extractHOGFeatures(img,'CellSize',cellSize);
end
上面的代码给出“无法执行赋值,因为左侧的大小为 1×2304,右侧的大小为 1×0。”为什么是这样?如果我删除面部检测并裁剪它不会出错。但是,当我将每个图像的大小调整为相同的大小时,裁剪后 100x100,肯定不应该有大小差异吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。