How to automatically identify text lines from projection plot?
Mostra commenti meno recenti
I have been reading about automatic text line recognition in Matlab and although there are many advanced methods to do this every paper mentions that the simplest way of detecting text lines is via horizontal projections. So I decided to try this method for myself.
I am very new to this and have hit a brick wall, I have reached a level beyond which I do not know how to proceed. This is what I have achieved so far:
I'm trying for a system that is language independent and only interested in text lines, so I chose Arabic text:

I used the function ``radon`` to get the projections.
img = rgb2gray(imread('arabic.jpg'));
[R, xp] = radon(bw_closed, [0 90]);
figure; plot(xp,R(:,2)); title('at angle 90');
This is the plot(projection)

So clearly the 5 peaks represent the 5 lines detected but how do I go from here to segmenting the original document?
Can anyone help me beyond this point? All the papers I read make no mention of how to proceed from this step, they just say that from the projections we have our detected lines.
What I'm asking is how, from the plot data can I tell matlab what is the line of text and what is the gab between lines?
1 Commento
VIBHATH V B
il 3 Mar 2015
Hi.......... Can u send me the whole code for the above? What is 'bw-closed' here? My E-mail Id is : vibhathvb@gmail.com
Risposta accettata
Più risposte (2)
fawzi
il 25 Set 2014
0 voti
what if the lines are curved ? in this case the projection is not useful. Can you help me in this problem
Rinku
il 2 Gen 2015
Modificato: Walter Roberson
il 19 Dic 2015
try this code;
img = rgb2gray(imread('arabic.jpg'));
[R, xp] = radon(bw_closed, [0 90]);
figure; plot(xp,R(:,2)); title('at angle 90');
r = R(:,2);
r=r(92:391); % your image region
blank = r < 3; % region without text
[labeled, n] = bwlabel(blank);
C = regionprops(labeled, 'Centroid'); % find the centers of blank regions
for i=1:length(C)-1
subplot(length(C)-1,1,i)
imshow(img(C(i).Centroid(2):C(i+1).Centroid(2),:));
end
5 Commenti
VIBHATH V B
il 3 Mar 2015
Hi......... I have to segment each and every lines of text and have to recognize each line. How? Can u give me the code for that?
moahaimen talib
il 6 Mag 2017
can anyone tell me what is bw_close i need this badly
Image Analyst
il 7 Mag 2017
From the sounds of it, it's a binary image upon which they did a morphological closing with the imclose() function. Then they did a radon transform with just two angles: 0 and 90, so R(:,2) would be the horizontal profile of bw_close, so R(:,2) is the same as sum(bwClose, 1) I think.
moahaimen talib
il 7 Mag 2017
great answering thank you i understand that now
Urooba zaki
il 22 Gen 2018
respected sir this code shows an error... i think the function file is missing ... plz reply Undefined function or variable 'bw_closed'.
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








