필터 지우기
필터 지우기

Detecting text areas using bounding boxes for varying font sizes

조회 수: 2 (최근 30일)
Naseer Khan
Naseer Khan 2016년 9월 14일
편집: Naseer Khan 2016년 9월 14일
I am trying to write a code that would draw bounding boxes around the text areas with varying font sizes.So far I have written a following code.
Image=imread('http://www.pakistantoday.tv/wp-content/uploads/2016/09/pti-chairman-imran-khan-media-ta.jpg');
grayImage=rgb2gray(Image);
edgedImage=edge(grayImage,'sobel','vertical');
seDilated=strel('rectangle',[1,20]);
dilatedImage=imdilate(edgedImage,seDilated);
seEroded=strel('rectangle',[5,5]);
erodedImage=imerode(dilatedImage,seEroded);
connectedComp=bwconncomp(erodedImage,4);
regions=regionprops(connectedComp,'BoundingBox');
imshow(grayImage);
hold on;
for i=1:length(regions)
box=regions(i).BoundingBox;
if(box(4)>10) %controlling height of each bounding boxes
if(box(3)/box(4)>1) % since width is normally larger
rectangle('Position',box,'EdgeColor','b','LineWidth',3);
end
end
end
So far I am NOT getting good results.As you can see below I am getting two many bounding boxes in the single text region and even some regions are not entirely getting detected.
I want to use vertical projection information into my code as I am sure it would detect areas with varying font sizes pretty well as it will help determine the vertical height of the bounding boxes.Any other suggestion in code is welcome.
plot(sum(edgedImage,2)) % this plot displays text region areas inside the image
Some useful hints are available in the following paper but I am NOT able to implement that.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by