Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Fast and simple OCR library written in Swift
| Date | Stars |
|---|---|
| 2026-07-24 | 4632 |
| 2026-07-25 | 4632 |
| 2026-07-28 | 4632 |
| 2026-07-30 | 4632 |
| 2026-08-06 | 4632 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
<h3 align="center">⛔️ This Project is deprecated and no longer gets maintained!</h3>
Please use Apple's [Vision](https://developer.apple.com/documentation/vision/recognizing_text_in_images) framework instead of SwiftOCR. It is very fast, accurate and much less finicky.
---




# SwiftOCR
SwiftOCR is a fast and simple OCR library written in Swift. It uses a neural network for image recognition.
As of now, SwiftOCR is optimized for recognizing short, one line long alphanumeric codes (e.g. DI4C9CM). We currently support iOS and OS X.
## Features
- [x] Easy to use training class
- [x] High accuracy
- [x] Great default image preprocessing
- [x] Fast and accurate character segmentation algorithm
- [x] Add support for lowercase characters
- [x] Add support for connected character segmentation
## Why should I choose SwiftOCR instead of Tesseract?
This is a really good question.
If you want to recognize normal text like a poem or a news article, go with Tesseract, but if you want to recognize short, alphanumeric codes (e.g. gift cards), I would advise you to choose SwiftOCR because that's where it exceeds.
Tesseract is written in C++ and over 30 years old. To use it you first have to write a Objective-C++ wrapper for it. The main issue that's slowing down Tesseract is the way memory is managed. Too many memory allocations and releases slow it down.
I did some testing on over 50 difficult images containing alphanumeric codes. The results where astonishing. SwiftOCR beat Tesseract in every category.
| | SwiftOCR | Tesseract |
| -------- | :-------: | :-------: |
| Speed | 0.08 sec. | 0.63 sec. |
| Accuracy | 97.7% | 45.2% |
| CPU | ~30% | ~90% |
| Memory | 45 MB | 73 MB |
## How does it work?
1) Input image is thresholded (binarized).
2) Characters are extracted from the image, using a technique called [Connected-component labeling](https://en.wikipedia.org/wiki/Connected-component_labeling).
3) Separated characters are converted into numbers, which are then fed into the neural network.
## How to use it?
SwiftOCR is available through CocoaPods. To install it, simply add the following line to your Podfile:
`pod 'SwiftOCR'`
If you ever used Tesseract you know how exhausting it can be to implement OCR into your project.
SwiftOCR is the exact opposite of Tesseract. It can be implemented using **just 6 lines of code**.
```swift
import SwiftOCR
let swiftOCRInstance = SwiftOCR()
swiftOCRInstance.recognize(myImage) { recognizedString in
print(recognizedString)
}
```
To improve your experience with SwiftOCR you should set your Build Configuration to `Release`.
#### Training
Training SwiftOCR is pretty easy. There are only a few steps you have to do, before it can recognize a new font.
The easiest way to train SwiftOCR is using the training app that can be found under `/example/OS X/SwiftOCR Training`. First select the fonts you want to train from the list. After that, you can change the characters you want to train in the text field. Finally, you have to press the `Start Testing` button. The only thing that's left now, is waiting. Depending on your settings, this can take between a half and two minutes. After about two minutes you may manually stop the training.
Pressing the `Save` button will save trained network to your desktop.
The `Test` button is used for evaluating the accuracy of the trained neural network.
## Examples
Here is an example image. SwiftOCR has no problem recognizing it. If you try to recognize the same image using Tesseract the output is 'LABMENSW' ?!?!?.
![Image 1](https://github.com/garnele007/SwiftOCR/blob/master/example/OS%20X/SwiftOCR%Excerpt of 5,477 characters
Read on GitHubNicolas Camenisch · Switzerland
135
4
Simon Strandgaard
3
Zack Reneau-Wedeen
2
2
2
Valeriy Van · @LinearityGmbH · Germany
2
1
1
Michael Konapelsky · Lehigh Interactive, LLC
1
1
Sylvester · United Kingdom
1
1
1
Randy Saeks
1
1
Brendan Kirchner · Quicken Loans
1
BiNo
1
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:3da81f8dbf50f173, topic:ocr, desc:ocr, readme:ocr