Draw rectangle-like objects on a bitmap
Posted
by _simon_
on Stack Overflow
See other posts from Stack Overflow
or by _simon_
Published on 2010-05-12T19:31:51Z
Indexed on
2010/05/12
19:34 UTC
Read the original article
Hit count: 212
I am performing OCR (optical character recognition) on a bunch of images. Images are grouped into different projects (tickets, credit cards, insurance cards etc). Each image represents an actual product (for instance, if we have images of credit cards, picture1.jpg is image of my credit card, picture2.jpg is image of your credit card,... you get it).
I have a settings.xml file, which contains regions of the image, where OCR should be performed. Example:
<Project Name="Ticket1" TemplateImage="...somePath/templateTicket1.jpg">
<Region Name="Prefix" NumericOnly="false" Rotate="0">
<x>470</x>
<y>395</y>
<width>31</width>
<height>36</height>
</Region>
<Region Name="Num1" NumericOnly="true" Rotate="0">
<x>555</x>
<y>402</y>
<width>123</width>
<height>35</height>
</Region>
</Project>
</Project Name="CreditCard" TemplateImage="...somePath/templateCreditCard1.jpg">
<Region Name="SerialNumber" NumericOnly="false" Rotate="90">
<x>332</x>
<y>12</y>
<width>20</width>
<height>98</height>
</Project>
I would like to set these parameters through GUI (now I just write them into xml file). So, first I load a template image for a project (an empty credit card). Then I would like to draw a rectangle around a text, where OCR should be performed. I guess this isn't hard, but it would be great if I could also move and resize this rectangle object in the picture.
I have to display all regions (rectangles) on the picture also. Also - there will probably be a list of regions in a listview, so when you click a region in this listview, it should mark it on the picture in a green color for example. Do you know for a library, which I could use? Or a link with some tips how to create such objects?
© Stack Overflow or respective owner