執行此代碼時出現問題。我想從圖像中提取文本,這是我的代碼從自然圖像中提取文字
i = imread('handicapped.jpg');
i1 = rgb2gray(i);
imshow(i1);
i2 = edge(i1,'canny',0.3);
imshow(i2);
se = strel('square',2);
i3 = imdilate(i2,se);
imshow(i3);
i4 = imfill(i3,'holes');
imshow(i4);
[Ilabel num] = bwlabel(i4);
disp(num);
Iprops = regionprops(Ilabel);
Ibox = [Iprops.BoundingBox];
Ibox = reshape(Ibox,[4 92]);
imshow(i);
hold on;
for cnt = 1:92
rectangle('position',Ibox(:,cnt),'edgecolor','r');
end
我在第19行
Error using reshape
To RESHAPE the number of elements must not change.
Error in test11 (line 19)
Ibox = reshape(Ibox,[4 92]);
任何人都可以幫我一個錯誤???
開始。爲什麼重塑使用,爲什麼這些維度? – nkjt