DocumentsOCR 1.0.5

DocumentsOCR 1.0.5

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2017
SwiftSwift Version 3.1
SPMSupports SPM

Maintained by Michael.



 
Depends on:
TesseractOCRiOS~> 4.0.0
PodAsset>= 0
GPUImage>= 0
 

  • By
  • Michael

Screenshots

CameraOverlayView

Requirements

  • XCode 8 +
  • iOS 8.0 +

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Used frameworks

DocumentOCR framework uses

Installation

DocumentsOCR is available through CocoaPods. To install it, simply add the following lines to your Podfile:

pod 'TesseractOCRiOS', :git => 'https://github.com/appintheair/Tesseract-OCR-iOS'
pod "DocumentsOCR"

Usage

Import DocumentsOCR framework

    import DocumentsOCR

Implement DocumentScannerDelegate protocol

Create your custom class, which implemets DocumentScannerDelegate protocol

class ExampleViewController: UIViewController, DocumentScannerDelegate {
    
    // required fucntions:
    func documentScanner(_ scanner: DocumentScanner, didFinishScanningWithInfo info: DocumentInfo) {
        // do something with DocumentInfo instance
    }	

    func documentScanner(_ scanner: DocumentScanner, didFailWithError error: NSError) {
        // handle error
    }   
    
    //optional functions:
    func documentScanner(_ scanner: DocumentScanner, willBeginScanningImages images: [UIImage]) {
        // do something with images
    }
    	
    func documentScanner(_ scanner: DocumentScanner, recognitionProgress progress: Double) {
        // present current progress of recognition
    }
    	
    // some other code here ...
}

Create DocumentScanner instance

Initialize DocumentScanner instance with references to UIViewController and DocumentScannerDelegate

	var scanner = DocumentScanner(containerVC: self, withDelegate: self)

Optionally you can set how many photos to take and time interval between them:

    scanner.photosCount = 10
    scanner.takePhotoInterval = 1.0

Present camera controller

Scanner instance can present view controller with camera and border (actually, container view controller will do this inside document scanner instance).

	func someMethod() {
		scanner.presentCameraViewController()
	}

Events after "take shoot" button pressed

After take shoot button pressed, device take photosCount photos with takePhotoInterval time interval then these delegate methods call:

    func documentScanner(_ scanner: DocumentScanner, willBeginScanningImages images: [UIImage])

When one of the images recognized

    func documentScanner(_ scanner: DocumentScanner, recognitionProgress: Double) 

Then if images were recognized successfull:

    func documentScanner(_ scanner: DocumentScanner, didFinishScanningWithInfo info: DocumentInfo)

If some error happened

    func documentScanner(_ scanner: DocumentScanner, didFailWithError error: NSError)

Author

Michael Babaev, [email protected]

License

DocumentsOCR is available under the MIT license. See the LICENSE file for more info.

TODO

  • [x] documentation
  • [x] fix minor UI defects in example
  • [x] code refactoring
  • [x] pod string for all versions (without using ~> version")
  • [x] improve mr code recognition
  • [x] check visa document recognitions
  • [x] take many pictures when "take shoot" button pressed, then make best machine readable code
  • [x] enable bitcode for tesseract framework
  • [ ] tests for camera shoots