1
的單獨的圖像爲從圖像中檢測文字。該代碼被從圖像檢測的文本,但現在我想從圖像每個檢測到的信創建的輸出圖像。請告訴我該怎麼做?得到我寫了這個MATLAB代碼(下面給出)每個檢測到的信
代碼:
i = imread('text.png');
i1 = 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
這是最好的[不要使用'i'作爲在Matlab變量名(http://stackoverflow.com/q/14790740/1714410)。 – Shai