Android page/edge detect and transform page. Convert to B/W tiff
Asked Answered
S

1

9

Probably not looking for solution, but looking for guidance on this. This is to implement "document scanner" in our Android app.

I need to do precisely this:

  1. Take image with camera (no problem)
  2. Detect page edges/corners (???)
  3. Allow user to move/adjust corners (no problem)
  4. Transform image to make it rectangle (???)
  5. Convert image to B/W TIFF or some other appropriate format for transmission over mobile network (compact, bit per pixel) (???)

What I tried. We tried to use Open CV. It's huge, there is NDK. Setup and infrastructure pretty complex.

Is there anything that's lighter and designed for exactly this task? Even commercial might be fine.

Just looking for suggestions on how to approach this.. Main problem is to detect edges and transform I think..

Sacci answered 4/8, 2016 at 15:43 Comment(0)
F
6

I do not know of any libraries that will handle this for you, but I have come across few open source projects that achieve a similar result. Most are based on the OpenCV library and/or the OpenCV4Android SDK. Here are a few noteworthy projects:

Another similar library is Google's Mobile Vision API, which contains a Text Recognition API. Though this will not enable you to convert a document into a black and white image, it would enable you to convert a document into plain text.

As for converting the image for transmission over a network; Android does not natively support the TIFF file format, though there is at least one library that will handle this conversion for you. Android does natively support compressing an image as JPEG, PNG or WEBP, which you can use to send data over the network as an encoded string:

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
byte[] bytes = outputStream.toByteArray();
String encodedImage = Base64.encodeToString(bytes, Base64.DEFAULT);
Furbelow answered 15/8, 2016 at 15:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.