1. Products
  2.   OCR
  3.   Swift
  4.   Evil
 
  

Free Swift OCR API to Read ID & Bank Cards Numbers

Open Source Top Swift Optical Character Recognition (OCR) Library for Recognizing & Reading Numbers from ID Cards, Bank Cards, House Numbers & Documents via Free Swift API.

In the ever-evolving landscape of mobile and desktop application development, Optical Character Recognition (OCR) stands out as a powerful tool for extracting text from images. For software developers working with Swift for iOS and macOS, the Open Source Evil library emerges as a game-changer, simplifying the complex process of integrating OCR capabilities into your projects. The Evil library is a Swift-based solution that provides a high-level API for performing OCR on images. It is built on top of Apple's Vision framework, which means it leverages the powerful, on-device machine learning capabilities of iOS and macOS.

Evil is a streamlined, developer-first OCR library perfect for extracting structured data from images on Apple platforms. It combines Swift-native performance, flexible model deployment, and simple APIs to streamline OCR integration in your app. The primary goal of the Evil library is to make text recognition from images, such as bank cards, ID cards, and even door numbers, as straightforward as possible for developers. At its core, the Evil library utilizes Core ML models (.mlmodel) to perform the recognition tasks. This model-based approach offers a high degree of flexibility, allowing developers to use pre-trained models or even train and implement their own custom models for specific use cases.

Previous Next

Getting Started with Evil

The recommend way to install Evil is using CocoaPods. Please use the following command for a smooth installation.

Install Evil Library via CocoaPods

 $ gem install cocoapods

Install Evil Library via GitHub

 git clone https://github.com/getomni-ai/zerox.git 

You can also install it manually; download the latest release files directly from GitHub repository.

Recognize Numbers in Images via Swift API

Built entirely in Swift, Evil supports both iOS (11.0+) and macOS (10.13+), making it versatile for native Apple ecosystem development. The open source Evil library offers complete support for number recognition from structured data inside Swift applications. The primary goal of the Evil library is to make text recognition from images, such as bank cards, ID cards, and even door numbers, as straightforward as possible for software developers. Once you have initialized the Evil library, recognizing text from an image is as simple as calling the recognize method, the following example demonstrates how to do it.

How to Recognize Numbers from an Image via Swift API?

let image: Recognizable = // Your image (e.g., a UIImage or CGImage)
let result = evil?.recognize(image)
print(result)

// This returns the OCR result—typically the detected number or text as a string 

// Run OCR on Input Image

if let result = evil?.recognize(myImage) {
  print("Detected number: \(result)")
}

Advanced Memory Manipulation

The open source Swift Optical character recognition library Evil allows software developers to directly access and manipulate memory inside Swift applications. Thus making it useful for debugging, game hacking, or security testing. Here is useful example that demonstrates reading and writing to a specific memory location using Swift commands.

How to Read and Write to a Specific Memory Location via Swift API?

#include 

int main() {
    uintptr_t address = 0x00400000; // Example memory address
    uint8_t value = evil_read_memory(address); // Read a byte
    evil_write_memory(address, 0x90); // Write a NOP (0x90) instruction
    return 0;
}

Flexible Model Loading via URL

The open source Evil library offers multiple ways to load your Core ML models. You can bundle them directly with your application or, to reduce your app's initial download size, you can configure the library to download the models from a remote server at runtime. To keep your app bundle small, you can host your .mlmodel file on a server and have the Evil library download it at runtime.

How to Access Model from a Remote URL via Swift API?

let downloadURL = URL(string: "https://your-server.com/ChineseIDCard.mlmodel")!
let chineseIDCard = Recognizer.custom(name: "ChineseIDCard", model: downloadURL, needComplie: true, processor: Recognizer.cropChineseIDCardNumberArea)
let evil = try? Evil(recognizer: chineseIDCard)