How can I use bounding box for disconnected character segmentation?
2 次查看(过去 30 天)
显示 更早的评论
Hey Guys, I am doing OCR system for handwritten ancient Ge’ez language scripts which can segment characters, numbers and symbols at the same time. By nature, Ge’ez script numbers and symbols are disconnected to each other. I used a bounding box technique to segment these numbers but it puts in different rectangles and am unable to merge different rectangle sections in one bounding box.
Can anyone provide me a code or another best segmentation technique for this problem.
<<
>>
Here is my code: which yields incorrect segmentation.
%%Read Image
imagen=imread('img14.jpg');
imagen=imresize(imagen,[500 600]);
%%Show image
figure(1)
imshow(imagen);
title('INPUT IMAGE WITH NOISE')
%%Convert to gray scale
if size(imagen,3)==3 % RGB image
imagen=rgb2gray(imagen);
end
%%Convert to binary image
threshold = graythresh(imagen);
imagen =~im2bw(imagen,threshold);
%%Remove all object containing fewer than 30 pixels
imagen = bwareaopen(imagen,30);
pause(1)
%%Show image binary image
figure(2)
imshow(~imagen);
title('Input image after bounding box')
%%Label connected components
[L Ne]=bwlabel(imagen);
%%Measure properties of image regions
propied=regionprops(L,'BoundingBox');
hold on
%%Plot Bounding Box
for n=1:size(propied,1)
rectangle('Position',propied(n).BoundingBox,'EdgeColor','r','LineWidth',1)
end
hold off
pause (1)
My input image
My input image after segmentation
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!