DocumentsOCR 1.0.5

DocumentsOCR 1.0.5

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布日期最后发布2017年8月
SwiftSwift 版本3.1
SPM支持 SPM

Michael 维护。



 
依赖
TesseractOCRiOS~> 4.0.0
PodAsset>= 0
GPUImage>= 0
 

  • Michael

屏幕截图

CameraOverlayView

需求

  • XCode 8 +
  • iOS 8.0 +

示例

要运行示例项目,请克隆仓库,然后从 Example 目录首先运行 pod install

使用的框架

DocumentOCR 框架使用

安装

DocumentsOCR 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

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

用法

导入 DocumentsOCR 框架

    import DocumentsOCR

实现 DocumentScannerDelegate 协议

创建一个自定义类,该类实现了 DocumentScannerDelegate 协议

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 ...
}

创建 DocumentScanner 实例

使用对 UIViewControllerDocumentScannerDelegate 的引用初始化 DocumentScanner 实例

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

可选地,您可以设置要拍摄的照片数量和时间间隔

    scanner.photosCount = 10
    scanner.takePhotoInterval = 1.0

显示相机控制器

扫描仪实例可以显示带有相机和边框的视图控制器(实际上,容器视图控制器将在 DocumentScanner 实例内部完成此操作)。

	func someMethod() {
		scanner.presentCameraViewController()
	}

点击“拍照”按钮后的事件

点击“拍照”按钮后,设备会以takePhotoInterval的时间间隔拍摄photosCount张照片,然后调用以下代理方法

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

当识别到其中一张图片时

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

如果图片识别成功

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

如果发生某些错误

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

作者

Michael Babaev, [email protected]

许可证

DocumentsOCR可以在MIT许可证下获得。有关更多信息,请参阅LICENSE文件。

待办事项

  • [x] 文档
  • [x] 更正示例中的小型UI缺陷
  • [x] 代码重构
  • [x] 所有版本(不使用~>版本”)的pod字符串
  • [x] 改善mr代码识别
  • [x] 检查签证文档识别
  • [x] 点击“拍照”按钮时拍摄多张照片,然后生成最佳可读机读码
  • [x] 为tesseract框架启用bitcode
  • [ ] 摄像头拍摄测试