How can I highlight a chunk of text on an image taken by Camera view

元气小坏坏 提交于 2019-12-04 16:37:48

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!