Give us a call
Call us at +41 41 555 20 40
SCAN SDK has been trained to recognize European car number plates.
Linear product | Linear industrial | Matrix |
UPC-A | Code 39 | QR Code |
UPC-E | Code 93 | Micro QR Code |
EAN-8 | Code 128 | rMQR Code |
EAN-13 | Codabar | Aztec |
DataBar | DataBar Expanded | Data Matrix |
DX Film Edge | PDF417 | |
ITF | MaxiCode (partial) | |
Visible Digital Seals |
The folder Example
contains a minimal functional demo app, that shows the usage of the SDK. Remember to set your Team in the Signing & capabilities
settings for the Target Example
in this project, when building for an iOS device.
To add SCAN SDK to your Xcode project using Swift Package Manager:
File
> Add Package Dependencies
.https://github.com/OVD-Kinegram-AG/scan-sdk-ios
and add the package.Import the SCAN SDK in the file where you want to use it:
import KinegramScanSDK
Here is a simple example of how to use the scanner in your application:
import UIKit
import KinegramScanSDK
class ViewController: UIViewController {
let scanSdk = KSCScanSDK()
@IBAction func buttonStartScannerTouched(_ sender: UIButton) {
scanSdk.startScanner(withDelegate: self, title: "ScanSDK Demo")
}
}
extension ViewController: KSCResultDelegate {
func found(_ results: [KSCResult]) {
// Process results
for result in results {
print("Scanned result: \(result)")
}
}
}
An array of KSCResult
objects is returned by the delegate method. Each KSCResult
object contains the recognized data from the scan, along with its type,which is defined by the KSCResultType
enum.
When using the KSCScanSDK
,the results of the scan are returned through the KSCResultDelegate
. Here is an example of how to handle different types of scan results:
...
extension ExampleViewController: KSCResultDelegate {
func found(_ results: [KSCResult]) {
for result in results {
switch result.type {
case .MRZ:
if let mrz = result.mrz {
print("MRZ found: \(result.text)")
print(" documentCode: \(mrz.documentCode)")
print(" issuingState: \(mrz.issuingState)")
print(" primaryIdentifier: \(mrz.primaryIdentifier)")
print(" secondaryIdentifier: \(mrz.secondaryIdentifier)")
print(" nationality: \(mrz.nationality)")
print(" documentNumber: \(mrz.documentNumber)")
print(" dateOfBirth: \(mrz.dateOfBirth)")
print(" sex: \(mrz.sex)")
print(" dateOfExpiry: \(mrz.dateOfExpiry)")
print(" optionalData1: \(mrz.optionalData1)")
print(" optionalData2: \(mrz.optionalData2)")
}
case .NumberPlate:
if let numberPlate = result.numberPlate {
print("NumberPlate found: \(numberPlate.text) Country: \(numberPlate.country)")
}
case .IDL:
if let idl = result.idl {
print("IIN found: \(idl.iin)")
for key in idl.order {
if let key = key as? String, let value = idl.elements[key] {
print("\(key): \(value)")
}
}
}
case .Barcode:
print("Barcode format: \(result.format)")
print("Barcode text: \(result.text)")
case .VDS:
if let vds = result.vds {
print("VDS found:")
print("Country ID: \(vds.header.countryId)")
// ... see class KSCVDSInfo for more information
print("Signature Valid: \(vds.signatureValid)")
}
case .VDSNC:
if let vdsnc = result.vdsnc {
print("VDS-NC found:")
print("Country ID: \(vdsnc.header.issuingCountry)")
// ... see class KSCVDSNCInfo for more information
print("Signature Valid: \(vdsnc.signatureValid)")
print("Certificate Known: \(vdsNc.certificateKnown)")
}
default:
print(result.text)
}
}
}
}
NSCameraUsageDescription
in Host AppAs the SCAN SDK needs camera access, the host app has to put a usage description inside its lnfo.plist, otherwise the app crashes. Please add a string like this to the lnfo.plist of the host app:
⟨key⟩NSCameraUsageDescription⟨/key⟩
⟨string⟩$(PRODUCT_NAME)⟩ needs camera access to scan your documents.⟨/string⟩
Use Scanner.setVDSProfiles()
to specify custom VDS profiles before scanning:
Scanner.setVDSProfiles(
"["
"{\"id\":4128,\"features\":["
"{\"tag\":2,\"name\":\"foo\",\"type\":\"UTF8STR\"}"
"]}"
"]"
)
The integer key (4128
in this example, which is 0x1020
hexadecimal, JSON does not support hexadecimal numbers, unfortunately) must be the “Document Feature Definition Reference” byte (0x10
in bit 9 to 16) and the “Document Type Category” byte (0x20
in bit 1 to 8). These bytes identify a VDS profile.
For each document feature you need to specify a tag (2
), a name (foo
) and a type (UTF8STR
). Possible types are:
RAW
– binary dataUBYTE
– unsigned charUINT16LE
– unsigned 16-bit integer little endianUINT24LE
– unsigned 24-bit integer little endianUINT32LE
– unsigned 32-bit integer little endianDATE
– unsigned 24-bit integer big endian read as “MMddyyyy”TIMESTAMP
– Unix time stampUTF8STR
– UTF8 stringC40STR
– C40-encoded stringC40MRZMRVA
– C40-encoded MRVA MRZC40MRZMRVB
– C40-encoded MRVB MRZC40MRZTD2
– C40-encoded TD2 MRZC40MRZTD3
– C40-encoded TD3 MRZTo verify a VDS, you need the certificate with which the VDS was signed.
Use Scanner.setCertificates()
to specify a list of certificate files before scanning:
Scanner.setCertificates(listOf("path/to/certificate.cer"))
To verify a VDS-NC the CSCA (Country Signing Certificate Authority) certificate of the issuing country is required. This certificate can be obtained from the ICAO Master List or the BSI Master List.
Use Scanner.setCMS()
to specify a list of master list files before scanning:
Scanner.setCMS(listOf("path/to/masterlist.ml"))
Copyright 2024 OVD Kinegram AG
https://github.com/opencv/opencv
Apache License Version 2.0
https://github.com/tensorflow/tensorflow
Apache License Version 2.0
https://github.com/zxing-cpp/zxing-cpp
Apache License Version 2.0
If you encounter any issues or have any questions,we encourage you to open an issue in the GitHub issue tracker. Our team will be happy to assist you and address any problems you may have. Alternatively, you can contact us at digitalsolutions@kinegram.com.
Give us a call
Call us at +41 41 555 20 40
Contact by e-mail
Contact us via our contact form.
Personal meeting
Arrange a personal meeting.