Please help me in segmenting the Hindi text into number of lines and words and characters

1 view (last 30 days)
Hi,
I have attached a Hindi text . How can I divide into number of lines,words and characters using
regionprops function in MATLAB.
I have written the code like this, where is the error
clc;
clear all;
a=imread('D:/sahoo/sample.jpg');
%figure,imshow(a)
b=rgb2gray(a);
%Igray1=medfilt2(b);
Ibw = im2bw(b,graythresh(b));
[m n] = size(Ibw);
Ibw2=~Ibw;
Iedge = edge(uint8(Ibw));
imshow(Iedge)
se = strel('square',2);
Iedge2 = imdilate(Iedge, se);
imshow(Iedge2);
%Image Filling
Ifill= imfill(Iedge2,'holes');
imshow(Ifill)
Ilabel = bwlabel(Ifill);
%disp(num);
Ibox = regionprops(Ilabel,'BoundingBox');
Ibox(1)
%Ibox = [Iprops.BoundingBox];
%Ibox = reshape(Ibox,[4 15]);
imshow(Ibw2)
hold on;
for cnt = 1:53
rectangle('position',Ibox(:,cnt),'edgecolor','r');
end

Answers (1)

Image Analyst
Image Analyst on 6 Jan 2014
We help with MATLAB programming, not OCR algorithm development. Go here: http://iris.usc.edu/Vision-Notes/bibliography/contentschar.html#OCR,%20Document%20Analysis%20and%20Character%20Recognition%20Systems and pick a published algorithm that might be better than yours. If you really want to continue using yours you'll have to upload your picture so we can try your code.

Community Treasure Hunt

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

Start Hunting!