I'm searching for a document scanner SDK for mobile (iOS and Android) that is capable of detecting the edges of a document and then auto-crop it. I know a few licensed SDKs like Scanbot, but is there any open source option?

2 Answers 2


Take a look at this blog post which shows you how to "Build a Kick-Ass Mobile Document Scanner in Just 5 Minutes".

The tool chain being python and OpenCV.

  • Detect Document Edges
  • Rotate and correct perspective
  • Crop
  • All Free, Gratis & Open Source.
  • Thanks, I had that already, but that won't run on mobile. We have to create the app an translate the Python code to Java/Swift and find similar libraries. Using that code as a backend service isn't an option. Anyway, it doesn't look easy.
    – Rafael
    Apr 17, 2019 at 20:31
  • @Rafael OpenCV runs on mobile and for your own use there are python environments available on mobiles - a good possibility is Kivy - kivy.org/#home Apr 18, 2019 at 4:50
  • I understand. But I already have the two mobile apps, for the two platforms. I'm just adding functionality and Kivy isn't something very popular. If that same code was implemented in Java + OpenCV, then ok. I will probably invest on that and code that solution in Java/Kotlin and Swift.
    – Rafael
    Apr 18, 2019 at 14:22

The answer in this link would work for your use case as well and is used in a Xamarin application: https://stackoverflow.com/questions/60828712/crop-image-with-multiple-x-and-y-points-c-sharp/64861791#64861791

private RasterImage DetectAndDeskew(RasterImage image)
   DetectDocumentCommand detectDocumentCommand = new DetectDocumentCommand();

   if (detectDocumentCommand.DocumentArea == null)
      Console.WriteLine("No document detected");
      return null;

   KeyStoneCommand command = new KeyStoneCommand(detectDocumentCommand.DocumentArea);

   image = command.TransformedImage;
   return image;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.