I want to segment the characters from a page, which contain around more than 1500 characters. The problem is that while extracting the characters in different figures it becomes slowing down rapidly. It is little fast upto 50 to 60 characters.

1 view (last 30 days)
Here is the program:
close all;
clear all;
clc;
I=imread('book1-15.tif'); %%Read Image
%figure(1)
%imshow(I);
%title('INPUT IMAGE WITH NOISE');
if size(I,3)==3 % RGB image %%Convert to gray scale
I=rgb2gray(I);
end
threshold = graythresh(I); %%Convert to binary image
I =~im2bw(I,threshold);
I = bwareaopen(I,60); %%Remove all object containing fewer than 1 pixels
%figure(2) %%Show image binary image
%imshow(~I);
%title('INPUT IMAGE WITHOUT NOISE')
Iedge=edge(uint8(I)); % EDGE DETECTION
%figure(3), imshow(Iedge);
%title('EDGE ONLY')
se=strel('square',1); % IMAGE DILATION
Iedge2=imdilate(Iedge,se);
%figure(4), imshow(Iedge2);
%title('DILATED IMAGE')
%ifill=imfill(Iedge2,'holes'); %IMAGE FILLING
%g =imclearborder(ifill, 8);
%figure(5), imshow(g);
%title('FILLED IMAGE')
seD = strel('diamond',1); %IMAGE SMOOTHENING
BWfinal = imerode(Iedge2,seD);
BWfinal = imerode(BWfinal,seD);
BWoutline = bwperim(BWfinal); % PRODUCING TRUE IMAGE
Segout = I;
Segout(BWoutline) = 255;
%figure(5), imshow(Segout), title('outlined original image');
[L, a,]=bwlabel(Segout); %%Label connected components
propied=regionprops(L,'BoundingBox'); %%Measure properties of image regions
for n=1:size(propied,1) %%Plot Bounding Box
rectangle('Position',propied(n).BoundingBox,'EdgeColor','g','LineWidth',1);
end
for n=1:a %%Objects extraction
[r,c] = find(L==n);
n1=Segout(min(r):max(r),min(c):max(c));
figure, subimage(~n1);
% pause(0.5)
%imsave();
end
Input Image:
In this program it segment very slowly. I want to segment it very fast.

Answers (1)

Image Analyst
Image Analyst on 6 Jul 2014
Perhaps try a method like this http://www.icsd.aegean.gr/lecturers/kavallieratou/publications_files/ICDAR2005.pdf, which someone else here was going to try. I have another one that was presented at Electronic imaging - maybe I'll try it on your image if I get time.
  4 Comments
Image Analyst
Image Analyst on 7 Jul 2014
Different algorithms take different lengths of time. Some of mine take a second or two. I've heard of others running simulations that take days. How long yours takes depends on what it's doing and how efficient you were at programming it up. I can't tell where one character stops and another starts in that language. You have to tell it. 25 minutes to find 577 characters does seem like a long time and there may be more efficient algorithms than whatever you did, so I referred you to papers where they do that kind of thing.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!