2

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?

screenshot of image taken by camera

sharptooth
  • 167,383
  • 100
  • 513
  • 979
YogiAR
  • 2,207
  • 23
  • 44

1 Answers1

3

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.

Nikolay
  • 2,206
  • 3
  • 20
  • 25
  • Thanks very much for your response it definitly helped me. But i have some concerns like can abbyy also provides static sdk (not the cloud one so that i can do word recognition on live as you can see in word lense app: http://itunes.apple.com/us/app/word-lens/id383463868?mt=8) ? And Can i get the cordinates of a complete word? Or What if i need to highlight all words which is recognized by ocrsdk immediately as shown in the "word lens App"? – YogiAR Dec 28 '11 at 12:47
  • Nikolay- i also downloaded the sample code of abbyy ocr sdk. but it always shows me an error "The operation could not be completed. NSURLErrorDomain error-1012" – YogiAR Dec 28 '11 at 12:51
  • Static SDK for mobile platforms can be requested here: http://www.abbyy.com/mobileocr/ I'll try to find out about your error, for now you need to make sure that you've registered at http://www.ocrsdk.com/ and received your login and password credentials that you need to put in the sample code. – Nikolay Dec 28 '11 at 13:11
  • 1
    Rakesh, i was right, you need to paste your application id and a password into the RecognitionViewController.m file. Contact me if you have any more questions. – Nikolay Dec 29 '11 at 08:27
  • Hi Nikoyay- how did you managed to get the co-ordinates of the word "STATIONERY"? What api did upi use? – YogiAR Dec 29 '11 at 09:04
  • Nikoyay- i managed to get the result of demo image in that sample. .. But How would i retrieve the co-ordinates of a specific word in that demo image if i want to , so that i can highlight that word. – YogiAR Dec 29 '11 at 09:34
  • You'll get an xml response just like i've posted in my answer. – Nikolay Dec 29 '11 at 09:40
  • hi Nikoolay- i tried with sample code .. but there is problem . i dont get the co-ordinates write . lets say for sample project for iphone - there is an image sample.jpg .. when i try to make an overlay over the word "OCR" in that image its not correct. plz help – YogiAR Dec 30 '11 at 11:37
  • http://stackoverflow.com/questions/8679106/co-ordinate-retrieved-from-image-is-not-correct-using-abbyy-ocr-sdk refer this link – YogiAR Dec 30 '11 at 11:44
  • hi nikolay - can i get co-ordinates of word(s) using the mobile sdk for iphone . i am using the sample project provided with the SDK. – YogiAR Feb 02 '12 at 13:22
  • here is the problem: http://stackoverflow.com/questions/9113119/how-to-get-coordinates-using-abbyy-mobile-sdk-for-iphone – YogiAR Feb 02 '12 at 13:27