How to segment cursive/connected (Arabic) word into characters?
7 次查看(过去 30 天)
显示 更早的评论
I want to segment the connected character. Based on the histogram/profile, i assume that I could segment the character based on it's baseline. but, I still couldn't built an appropriate code to make it works.
I hope, anyone could help :)
The following is the code that could segment isolated character very well. But, still not work for connected character.
% // Original Code by Soumyadeep Sinha //
% Saving each single segmented character as one file
function [segm] = trysegment (a)
myFolder = 'D:\1. Thesis FINISH!!!\Data set\trial';
level = graythresh (a);
bw = im2bw (a, level);
b = imcomplement (bw);
i= padarray(b,[0 10]);
verticalProjection = sum(i, 1);
set(gcf, 'Name', 'Trying Segmentation for Cursive', 'NumberTitle', 'Off')
subplot(2, 2, 1);imshow(i);
subplot(2,2,3);
plot(verticalProjection, 'b-'); %histogram show by this code
% hist(reshape(input,[],3),1:max(input(:)));
grid on;
% % t = verticalProjection;
% % t(t==0) = inf;
% % mayukh = min(t)
% 0 where there is background, 1 where there are letters
letterLocations = verticalProjection > 0;
% Find Rising and falling edges
d = diff(letterLocations);
startingColumns = find(d>0);
endingColumns = find(d<0);
% Extract each region
y=1;
for k = 1 : length(startingColumns)
% Get sub image of just one character...
subImage = i(:, startingColumns(k):endingColumns(k));
% se = strel('rectangle',[2 4]);
% dil = imdilate(subImage, se);
th = bwmorph(subImage,'thin',Inf);
n = imresize (th, [64 NaN], 'bilinear');
figure, imshow (n);
[L,num] = bwlabeln(n);
for z= 1 : num
bw= ismember(L, z);
% Construct filename for this particular image.
baseFileName = sprintf('char %d.png', y);
y=y+1;
% Prepend the folder to make the full file name.
fullFileName = fullfile(myFolder, baseFileName);
% Do the write to disk.
imwrite(bw, fullFileName);
% subplot(2,2,4);
% pause(2);
% imshow(bw);
end
% y=y+1;
end;
segm = (n);
This is the sample of image.
%
11 个评论
Mohamed sidhoum
2020-3-1
编辑:Image Analyst
2020-3-2
Hey ana,
I want just a help. I saw in ResearchGate that a professor sent you the method on how to segment an Arabic handwriitng word with MATLAB, (with each letter of the word in a picture). Can please email me? I need the code for my mastery final project and I'm stuck.
email : sidhoummohamedcherif@gmail.com
Have a nice day .
Image Analyst
2020-3-2
编辑:Image Analyst
2020-3-2
Mohamed, please see my attached demo for the Bengali language. Maybe it's similar enough for you to adapt.
回答(3 个)
Image Analyst
2017-12-1
23.4.8 Other Character Sets
23.4.8.1 Devanagari, Indic, Hindi, Hindu, Bangla, Bengali, Telugu, Characters
23.4.8.2 Arabic Character Recognition
23.4.8.3 Arabic Recognition, Word Level, Word Spotting
23.4.8.4 Farsi, Persian Character Recognition
0 个评论
ih ih
2019-12-19
hi ana can get the code if u please
ineed ocr arbic to my help me in project
ih14111227@gmail.com
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!