android-vision icon indicating copy to clipboard operation
android-vision copied to clipboard

OCR display lines instead of blocks?

Open Nbi007 opened this issue 9 years ago • 9 comments
trafficstars

I am trying to build a Business Card Reader, so far i am able to recognize text in blocks but for the B-Card i want to scan individual lines instead of blocks in the extensive code labs documentation i have tried all it's just not implementing Lines?Is it a issue or it's not been documented yet.

Nbi007 avatar Aug 26 '16 10:08 Nbi007

Have you tried getComponents()? It should give you Lines.

https://developers.google.com/android/reference/com/google/android/gms/vision/text/TextBlock

liuyl avatar Aug 26 '16 14:08 liuyl

@liuyl , @Nbi007, i am trying to read paragraphs and the sample i have does not have it, can you please share how to actually get the paragraph using getComponents you just mentioned?

Thanks

ghost avatar Sep 21 '16 11:09 ghost

Hi hearbeathorror@, a TextBlock is a paragraph. So what you get from detect(frame) function, is a SparseArray of paragraphs.

liuyl avatar Sep 21 '16 14:09 liuyl

Yes, I think that is where i am stuck. I am not able to understand how to pass the whole screens data from the OcrDetectorProcessor to the activity. Since inside the activity it is only on tap that the text is obtained at some x and y position.

ghost avatar Sep 22 '16 06:09 ghost

@Nbi007 @liuyl @hearbeathorror

Using getComponents() within a text block retrieves lines of text, but the problem is that text blocks get divided into two separate blocks in the first place if there's a long space in-between a line of text - take receipts for instance.

I looked at this SO post, and it seems like retrieving blocked lines of text is only possible when using a camera app real-time for Text Recognition API's classes, CameraSourcePreview and GraphicOverlay, as opposed to an existing image.

davenotdavid avatar Mar 05 '18 16:03 davenotdavid

I was also interested in this, grouping of blocks in lines, even though there is a long space separation between them.

If you have an image that is not skewed or rotated to any degree, it's quite easy to just compare the bounds poly vertices, but if you do, there is no params telling you what is the degree of rotation.

P.S. I'm using the vision api via nodejs, not java.

rolandjitsu avatar May 20 '18 20:05 rolandjitsu

Hai , i am facing the same issue , do we have way getting line by line? , there is long space between words in the line, so when ocr recognises long space it moves to next line , this is causing lot of issues for me.

phani-artiovatic avatar Oct 04 '19 04:10 phani-artiovatic

im using google textrecognition api(on device text recogniser)

phani-artiovatic avatar Oct 04 '19 04:10 phani-artiovatic

did anyone find any solution to this query?

Shahir1730623 avatar Nov 14 '22 09:11 Shahir1730623