Android page/edge 检测并转换页面。转换为 B/W tiff

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

可能不是在寻找解决方案,而是在寻找这方面的指导。 这是为了在我们的 Android 应用程序中实施 "document scanner"。

我需要这样做:

  1. 用相机拍照(没问题)
  2. 检测页面 edges/corners (???)
  3. 允许用户 move/adjust 转角(没问题)
  4. 将图像转换为矩形 (???)
  5. 将图像转换为 B/W TIFF 或其他适合通过移动网络传输的格式(紧凑,每像素位)(???)

我试过的。我们尝试使用 Open CV。很大,有NDK。设置和基础设施相当复杂。

有没有专门为这项任务设计的更轻便的东西?甚至商业也可以。

只是在寻找有关如何解决这个问题的建议。我认为主要问题是检测边缘和变换。

我不知道有任何库可以为您处理这个问题,但我遇到过几个实现类似结果的开源项目。大多数是基于OpenCV library and/or the OpenCV4Android SDK。以下是一些值得注意的项目:

另一个类似的库是 Google 的 Mobile Vision API, which contains a Text Recognition API。虽然这不能使您将文档转换为黑白图像,但可以使您将文档转换为纯文本。

关于转换图像以通过网络传输; Android 没有 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,您可以使用它作为编码字符串通过网络发送数据:

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
byte[] bytes = outputStream.toByteArray();
String encodedImage = Base64.encodeToString(bytes, Base64.DEFAULT);