我正在从事 OCR 项目,我面临一个问题,即要识别的文本图像可能包含连接的两个字符,所以当我尝试获取每个字符时,它将这两个字符作为一个图像。这是代码
BW1 = imread('test.png');
BW1 = BW1(:,:,1);
BW1=im2bw(BW1,0.9);
imshow(BW1)
patterns = bwlabel(~BW1);
patternStats = regionprops(patterns,'all');
patternNumber = size(patternStats);
imagePatternArray = cell(patternNumber);
%make cell array of pattern Matrices
for i = 1:1:patternNumber
imageMatrix = patternStats(i).Image;
imageMatrix = imresize(imageMatrix, [25 25]);
imagePatternArray{i}=imageMatrix;
end
原始图像
转换为 BW 后