PHP sample just returns rtf file of original image

  • 5.7K Views
  • Last Post 06 March 2013
andyhclark posted this 06 March 2013

alt textusing the php sample all I get back is a rtf file containing the original image. I was expecting text in some format?

I was hoping to be able to get the license plate number:

Attached Files

Order By: Standard | Newest | Votes
Andrey Isaev posted this 06 March 2013

Sounds pretty strange. Can you share your original image?

andyhclark posted this 06 March 2013

Sure - image uploaded to original post.

Andrey Isaev posted this 06 March 2013

I suppose you are trying to recognize license plate, right? In that case RTF export format is kind strange choice, I would recommend XML. Also, it looks like you are using default profile - documentConversion, which is designed to convert scanned documents to editable RTF files. It detects that your image is not a text, but rather an illustration and exports it appropriately.

In your case I would recommend textExtraction profile, which is designed to extract all possible text from the image. Basically, it tries to recognize everything that looks like text, even if it is not a text at all. I tried it with your image - it extracts license plate pretty well, but also extracts some garbage from other areas of image, but this is intended behavior of this profile.

UPD: In this case the complexity of output comes from complexity of the input. If you would send only image of a license plate for recognition, then indeed you would get only text from it. However, since you send whole picture that has image of three cars, trees and bushes, and also a red date stamp, "GT1", Volkswagen logo and lot of other stuff that might be mistaken for a text. OCR has no idea that you need only a license plate text, basically it does not know that this is a license plate and everything rest is not.

In this case you should either crop image and send for recognition only what you really need, or figure out the way to filter out recognition results, for example by regular expressions and text size.

Unfortunately, we don't have a sample code particularly for that, but I guess it should not be so difficult to add some filtering algorithm to one of existing.

andyhclark posted this 06 March 2013

I'm just using the only php example that you provide which is geared for rtf. I've tried changing the export format to XML and while I get an XML file back its just full of <block> statements and co-ordinates. All I really need is for it to echo the license plate number, I don't want a file. Do you have a less complex php example that will do that?

Many thanks

Close