googlesamples / android-vision

Deprecated: The Mobile Vision API is now a part of ML Kit: Check out this repo:
https://github.com/firebase/quickstart-android/tree/master/mlkit
Apache License 2.0
2.93k stars 1.73k forks source link

OCR display lines instead of blocks? #123

Open Nbi007 opened 8 years ago

Nbi007 commented 8 years ago

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.

liuyl commented 8 years ago

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

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

ghost commented 7 years ago

@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

liuyl commented 7 years ago

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

ghost commented 7 years ago

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.

davenotdavid commented 6 years ago

@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.

rolandjitsu commented 6 years ago

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.

phani-artiovatic commented 4 years ago

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 commented 4 years ago

im using google textrecognition api(on device text recogniser)

Shahir1730623 commented 1 year ago

did anyone find any solution to this query?