oversegmentation of printed arabic writing

10 ビュー (過去 30 日間)
yamina jafri
yamina jafri 2017 年 4 月 13 日
コメント済み: Tehmina Kakar 2018 年 7 月 14 日
Hello, Iam work in Matlab Arabic OCR.. in the segmentation phase, i segmente word to characters using Vertical projection method but it's suffer from over segmentation problem in some characters! any suggest of how can i solve this problem please help!
% // Original Code of Vertical Projection for Segmentation by Ana Ainul S.
%//last modofication by yamina_os
y =1;
a = imread ('text9.png');
myFolder = 'C:\Users\Aicha\Desktop\images';
%%Binarization %%
level = graythresh (a);
b = im2bw (a, level);
%%Complement %%
c = imcomplement (b);
% se = strel ('square', 1);
% c = imclose(com, se);
%%PadArray %%
i=padarray(c,[0 10]);
%%Vertical Projecttion for Character Segmentation
verticalProjection = sum(i, 1);
set(gcf, 'Name', 'Segmentation Trial', 'NumberTitle', 'Off')
subplot(2,2,1);imshow(i);
subplot(2,2,3);
plot(verticalProjection, 'b-');
grid on;
% *Defining the threshold to determine baseline area* %
threshold=max(verticalProjection)/3;
% threshold = 0;
% threshold=min(verticalProjection)/3;
% threshold = 5; % Threshold >0 used to detect the baseline of cursive characters
thresholdedProjection=verticalProjection > threshold;
count=0;
startingColumns = [];
startingColumnsIndex=0;
for j =1:length(thresholdedProjection)
if thresholdedProjection(j)
if(count>0)
startingColumnsIndex=startingColumnsIndex+1;
startingColumns(startingColumnsIndex)= j-floor(count/2);
count=0;
end
else
count=count+1;
end
end
endingColumns=[startingColumns(2:end)-1 j-floor(count/2)];
y=1;
% *Extract each region, result of segmentation process*
for k = 1 : length(startingColumns)
% Get sub image of just one character
subImage = i(:, startingColumns(k):endingColumns(k));
% im = subImage;
s = subImage;
p = bwmorph(s,'thin',Inf);
% Normalization using algorithm 2%
% p = normalization2 (t);
subplot(2,2,2);
imagesc (p);
axis equal off;
pause (0.5);
% figure,
imshow (p);
% Morphological Operation - Thinning %
% t = bwmorph(p,'thin',Inf);
n =1;
z=1
for n = 1 : length (z)
formatSpec = 'data.%d.%d.png';
baseFileName = sprintf(formatSpec, z, k);
fullFileName = fullfile(myFolder, baseFileName);
% Do the write to disk.
imwrite(p, fullFileName);
end
end
  1 件のコメント
Tehmina Kakar
Tehmina Kakar 2018 年 7 月 14 日
so, did you get your answer?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by