How to use iOS VisionKit when browsing a document from local library?

983 Views Asked by At

Using VisionKit, we can let user scan a document using camera like this:

let documentCameraViewController = VNDocumentCameraViewController()
documentCameraViewController.delegate = self
present(documentCameraViewController, animated: true)

But what should we do if the user browse a document from the iOS device locally without involving camera? Any chance we can still use visionkit to autocorrect on the paper orientation or edges?

1

There are 1 best solutions below

1
On

u can use UIImagePickerController to browse images locally.

Instead of VisionKit, you can use Vision to autocorrect on the paper orientation or edges

  • Prepare an Input Image for Vision

  • Create Vision Requests

  • Interpret Detection Results

apple's sample