android-vision
android-vision copied to clipboard
OCR display lines instead of blocks?
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.
Have you tried getComponents()? It should give you Lines.
https://developers.google.com/android/reference/com/google/android/gms/vision/text/TextBlock
@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
Hi hearbeathorror@, a TextBlock is a paragraph. So what you get from detect(frame) function, is a SparseArray of paragraphs.
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.
@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.
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.
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.
im using google textrecognition api(on device text recogniser)
did anyone find any solution to this query?