SwiftyTesseract Real-Time Engine
Alternatives To Swiftytesseractrte
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Jetson Inference7,038
2 months ago285mitC++
Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
15 days ago197mitPython
🛡️ Windows Hello™ style facial authentication for Linux
Esp Who1,583
13 days ago86otherC
Face detection and recognition framework
2 years ago2mitPython
Detect and recognize the faces from camera / 调用摄像头进行人脸识别,支持多张人脸同时识别
2 years ago54HTML
Home surveillance system with facial recognition
Face Recognition Attendance System376
4 months ago18mitPython
Face Detection | Recognition | Attendance
23 days agoPython
Face Recognition Security
Face Recognition Based Attendance System111
3 years ago22Python
7 years agogpl-3.0C++
Recognize Rock, Scissors and Paper from video captured by camera
3 months ago15Python
Posture recognition based on common camera
Alternatives To Swiftytesseractrte
Select To Compare

Alternative Project Comparisons


pod-version platforms swift-version Build Status

SwiftyTesseractRTE can only currently be used in portrait mode.


About SwiftyTesseractRTE

SwiftyTesseractRTE (SwiftyTesseract Real-Time Engine) is a real-time optical character recognition library built on top of SwiftyTesseract.

Swift Version SwiftyTesseractRTE Version
4.0 1.x.x
4.1 1.x.x
4.2 2.x.x

Using SwiftyTesseractRTE in Your Project

Import the neccessary modules

import SwiftyTesseract
import SwiftyTesseractRTE

Create an instance of RealTimeEngine and assign it's regionOfInterest property.

var realTimeEngine: RealTimeEngine!

@IBOutlet weak var previewView: UIView!
@IBOutlet weak var regionOfInterest: UIView! // A subview of previewView

override func viewDidLoad() {
  let swiftyTesseract = SwiftyTesseract(language: .english)
  realTimeEngine = RealTimeEngine(swiftyTesseract: swiftyTesseract, desiredReliability: .verifiable) { recognizedString in
    // Do something with the recognized string

override func viewDidLayoutSubviews() {
  // Must occur during viewDidLayoutSubviews() - Autolayout constraints are not set in viewDidLoad()
  realTimeEngine.bindPreviewLayer(to: previewView)
  realTimeEngine.regionOfInterest = regionOfInterest.frame

  // Only neccessary if providing a visual cue where the regionOfInterest is to your end user

Optical Character Recognition and Camera Preview

SwiftyTesseractRTE allows for showing the camera preview without constantly attempting to recognize text. This allows you to let your end user to line up the text to be scanned before starting the scan. The recognitionIsActive property is set to true by default, so to prevent a scan from starting immediately, set recognitionIsActive to false after instantiating RealTimeEngine and before calling startPreview(). Calling stopPreview() also prevents recognition from being attempted because there are no inbound camera frames to be scanned.

Starting and Stopping Recognition

// Starts optical character recognition
realTimeEngine.recognitionIsActive = true

// Stops optical character recognition
realTimeEngine.recognitionIsActive = false

Starting and Stopping Camera Preview

// Starts camera preview

// Stops camera preview

Camera Permissions

For camera permissions, you will need to add the Privacy - Camera Usage Description permission to your Info.plist file. If you are using the default SwiftyTesseractRTE AVManager implementation, permission will be requested at the time the camera preview is being generated. If a custom implementation of AVManager is provided, then it will be up to the developer to implement the permission request. For most use cases, the default AVManager implementation is preferred and a custom implementation should only be provided if access to CMSampleBuffers are needed from the camera at the same time that SwiftyTesseractRTE is being run for OCR.

RealTimeEngine onRecognitionComplete closure property

Starting in SwiftyTesseractRTE 2.0, the SwiftyTesseractRTEDelegate protocol has been replaced in favor of a closure property called onRecognitionComplete with a type of ((String) -> ())?. This can be assigned in a few ways:

Trailing Closure on Instantiation

RealTimeEngine(swiftyTesseract: swiftyTesseract, desiredReliability: .verifiable) { recognizedString in
    // Do something with the recognized string

Passing a Function Parameter

RealTimeEngine(swiftyTesseract: swiftyTesseract, desiredReliability: .verifiable, onRecognitionComplete: aFunction)

Property Injection

let realTimeEngine = RealTimeEngine(swiftyTesseract: swiftyTesseract, desiredReliability: .verifiable)
// Anonymous closure
realTimeEngine.onRecognitionComplete = { recognizedString in 
  // Do something with the recognized string
// Named closure
realTimeEngine.onRecognitionComplete = aFunction

A Note about Portrait-Only

SwiftyTesseractRTE is currently only able to utilized in portrait mode, but that does not mean your entire app also has to be portrait mode only. See the example project's AppDelegate (specifically the addition of a shouldRotate boolean member variable and the implementation of application(_:supportedInterfaceOrientationsFor:)) and ViewController files (specifically the viewWillAppear() and viewWillDisappear() methods) for an example on how to make a single view controller portrait mode only.



Tested with pod --version: 1.3.1

# Podfile

target 'YOUR_TARGET_NAME' do
    pod 'SwiftyTesseractRTE',    '~> 2.0'

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

Setting Up SwiftyTesseract for Use in SwiftyTesseractRTE

See SwiftyTesseract's Additional Configuration section on properly setting up SwiftyTesseract to be utilized in your project.


Official documentation for SwiftyTesseractRTE can be found here

Contributions Welcome

Contributions are always welcome! Please refer to Contributing to SwiftyTesseractRTE for the full guidelines on creating issues and opening pull requests to the project.

Popular Camera Projects
Popular Recognition Projects
Popular Hardware Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Optical Character Recognition