MrzScannerSDK 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package MrzScannerSDK --version 1.0.1
NuGet\Install-Package MrzScannerSDK -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MrzScannerSDK" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MrzScannerSDK --version 1.0.1
#r "nuget: MrzScannerSDK, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MrzScannerSDK as a Cake Addin
#addin nuget:?package=MrzScannerSDK&version=1.0.1

// Install MrzScannerSDK as a Cake Tool
#tool nuget:?package=MrzScannerSDK&version=1.0.1

.NET MRZ Scanner SDK

The .NET MRZ Scanner SDK is a C# wrapper for Dynamsoft C++ Label Recognizer SDK. It is used to recognize MRZ information for passport, Visa, ID card and travel documents.

License Activation

Click here to get a valid license key.

Supported Platforms

  • Windows (x64)
  • Linux (x64)

Download .NET 6 SDK

Methods

  • public static void InitLicense(string license)
  • public static MrzScanner Create()
  • public Result[]? DetectFile(string filename)
  • public Result[]? DetectBuffer(IntPtr pBufferBytes, int width, int height, int stride, ImagePixelFormat format)
  • public static string? GetVersionInfo()
  • public int LoadModel()

Usage

  • Set the license key:

    MrzScanner.InitLicense("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ=="); 
    
  • Initialize the MRZ scanner object:

    MrzScanner scanner = MrzScanner.Create();
    
  • Detect MRZ from an image file:

    Result[]? resultArray = scanner.DetectFile(filename);
    
  • Detect MRZ from a buffer:

    Mat mat = Cv2.ImRead(filename, ImreadModes.Color);
    Result[]? resultArray = scanner.DetectBuffer(copy.Data, copy.Cols, copy.Rows, (int)copy.Step(), MrzScanner.ImagePixelFormat.IPF_RGB_888);
    
  • Get SDK version number:

    string? version = MrzScanner.GetVersionInfo();
    
  • Load the MRZ detection model:

    scanner.LoadModel();
    
  • Parse the MRZ information:

    string[] lines = new string[_results.Length];
    var index = 0;
    foreach (Result result in _results)
    {
        lines[index++] = result.Text;
    }
    
    JsonNode? info = Parse(lines);
    

Quick Start

using System;
using System.Runtime.InteropServices;
using Dynamsoft;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            MrzScanner.InitLicense("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ=="); // Get a license key from https://www.dynamsoft.com/customer/license/trialLicense?product=dlr
            Console.WriteLine("Version: " + MrzScanner.GetVersionInfo());
            MrzScanner scanner = MrzScanner.Create();
            int ret = scanner.LoadModel();
            Console.WriteLine("LoadModel: " + ret);

            MrzScanner.Result[]? results = scanner.DetectFile("1.png");
            if (results != null)
            {
                foreach (MrzScanner.Result result in results)
                {
                    Console.WriteLine(result.Text);
                    Console.WriteLine(result.Points[0] + ", " +result.Points[1] + ", " + result.Points[2] + ", " + result.Points[3] + ", " + result.Points[4] + ", " + result.Points[5] + ", " + result.Points[6] + ", " + result.Points[7]);
                }
            }

        }
    }
}

Example

Building NuGet Package from Source Code

dotnet build --configuration Release
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 353 3/5/2024
2.0.0 220 2/27/2024
1.3.5 163 1/23/2024
1.3.3 134 1/15/2024
1.3.2 84 1/15/2024
1.3.1 394 10/26/2023
1.3.0 252 8/11/2023
1.2.0 265 7/28/2023
1.1.0 225 7/27/2023
1.0.1 526 10/20/2022
1.0.0 464 10/12/2022

- Fixed model loading path.