J JDS Active Member Licensed User Longtime User Sep 2, 2019 #1 Is there a libarary or SDK which is capable of this? I want to take a picture of a existing document and then with use of the library/SDK it should line it straight, even when the document is taken under an angle. I've found already the following without an answer: https://www.b4x.com/android/forum/threads/looking-for-document-to-pdf-scanner.73521/#post-467015 I was just wondering if someone has done this before.
Is there a libarary or SDK which is capable of this? I want to take a picture of a existing document and then with use of the library/SDK it should line it straight, even when the document is taken under an angle. I've found already the following without an answer: https://www.b4x.com/android/forum/threads/looking-for-document-to-pdf-scanner.73521/#post-467015 I was just wondering if someone has done this before.
Erel B4X founder Staff member Licensed User Longtime User Sep 2, 2019 #2 Document scanning usually means that you want to get the text out of the scanned document. Search for OCR if this is your intention. If you want to transform the document so it will be straight then you should learn about OpenCV: https://www.b4x.com/android/forum/threads/opencv320-for-b4a-v1-0-released.79816/#content Upvote 0
Document scanning usually means that you want to get the text out of the scanned document. Search for OCR if this is your intention. If you want to transform the document so it will be straight then you should learn about OpenCV: https://www.b4x.com/android/forum/threads/opencv320-for-b4a-v1-0-released.79816/#content
J JDS Active Member Licensed User Longtime User Sep 2, 2019 #3 I don't need necessary the text of the document. I just need a scan from the document. If it is slanted then it should adjust and send it like a PDF. The last step (sending) is the easiest. Upvote 0
I don't need necessary the text of the document. I just need a scan from the document. If it is slanted then it should adjust and send it like a PDF. The last step (sending) is the easiest.
Erel B4X founder Staff member Licensed User Longtime User Sep 2, 2019 #4 Let the user rotate and crop the image. Upvote 0
JordiCP Expert Licensed User Longtime User Sep 2, 2019 #5 Erel said: If you want to transform the document so it will be straight then you should learn about OpenCV: https://www.b4x.com/android/forum/threads/opencv320-for-b4a-v1-0-released.79816/#content Click to expand... If the picture is not only XY-rotated but also taken from an angle that is not perpendicular to the document planar surface, there will also be some perspective deformation. As Erel said, Opencv can be used to detect the contours, then the edges, and 'undo' this XY-rotation and perspective using homography. Some programming is involved, and reliability will depend on image quality (homogeneus background, avoiding other objects in the picture,...among others) Upvote 0
Erel said: If you want to transform the document so it will be straight then you should learn about OpenCV: https://www.b4x.com/android/forum/threads/opencv320-for-b4a-v1-0-released.79816/#content Click to expand... If the picture is not only XY-rotated but also taken from an angle that is not perpendicular to the document planar surface, there will also be some perspective deformation. As Erel said, Opencv can be used to detect the contours, then the edges, and 'undo' this XY-rotation and perspective using homography. Some programming is involved, and reliability will depend on image quality (homogeneus background, avoiding other objects in the picture,...among others)