问题
I am working on an OCR project. My first task is to take an image from iPhone camera and then locate a specific word on the image.
Below is a sample image taken by my device, now I want to find the position of word "STATIONERY" and highlight it with a yellow rectangle on image.
How can I do that? Do I need to first use an OCR SDK for that (like ABBYY) or can I do this otherwise?
回答1:
If you need to get the coordinates of a specific word, of course you need to perform OCR first. Keep in mind you'll probable have some difficulties with that paticullar image you've attached because of its bottom part. OCR will do a good job with a plain similar background.
Concerning OCR SDK - try ABBYY Cloud OCR SDK, it's a cloud-based OCR SDK recently launched by ABBYY. It's in beta, so for now it's totally free to use and it has a ready-to-go iOS code samples.
It has a built-in coordinates extraction feature in xml format, i've cropped the bottom part of your image for the background to be plain and sent it to SDK, here's the response i got:
<charParams l="35" t="39" r="73" b="83" charConfidence="100">S</charParams>
<charParams l="77" t="39" r="117" b="83" charConfidence="100">T</charParams>
<charParams l="120" t="40" r="164" b="83" charConfidence="100">A</charParams>
<charParams l="165" t="40" r="204" b="83" charConfidence="100">T</charParams>
<charParams l="211" t="40" r="225" b="83" charConfidence="100">I</charParams>
<charParams l="231" t="40" r="276" b="84" charConfidence="100">O</charParams>
<charParams l="285" t="41" r="325" b="84" charConfidence="100">N</charParams>
<charParams l="334" t="42" r="370" b="84" charConfidence="100">E</charParams>
<charParams l="377" t="42" r="419" b="85" charConfidence="100">R</charParams>
<charParams l="428" t="42" r="469" b="84" charConfidence="100">Y</charParams>
Those "l", "t", "r", "b" params stand for left, top, right and bottom, they describe a rectangle of each character with top-left and bottom-right corner. I beleive that's exatly what you are looking for.
来源:https://stackoverflow.com/questions/8653770/how-can-i-highlight-a-chunk-of-text-on-an-image-taken-by-camera-view