how to parse MRZ in vb.net

Ir4Qe DesiGner 1 Reputation point
2023-01-20T08:36:58.5+00:00

hi guys, please i need parse mrz for passport/ids ..etc

i used more libs in vb.net/c# but can't prase this mrz

IDOMN1817465<<3<<<<<<<<<<<<<<<

9404227M28010160MN<<<<<<<<<<<6

QAHHAR<JABYR<HUDDAIN<<AL<MJSUA

I found this site

[https://rubenmeireles.outsystemscloud.com/MRZParserDemo/MRZParser

and it does the process correctly, how can I benefit from it?

Developer technologies VB
{count} votes

1 answer

Sort by: Most helpful
  1. Santhi Swaroop Naik Bukke 595 Reputation points
    2023-01-20T17:32:29.8733333+00:00

    Parsing Machine Readable Zone (MRZ) in VB.NET involves using OCR (Optical Character Recognition) technology to extract the MRZ information from an image of a passport or ID card, and then using a library or tool to parse the MRZ data into its individual components. Here's an example of how you can parse MRZ in VB.NET:

    1. First, you will need to use an OCR library or tool to extract the MRZ data from the image of the passport or ID card. One popular OCR library for VB.NET is Tesseract.
    2. Once you have the MRZ data as a string, you can use the following code to parse the data into its individual components:
    Copy code
    ' Define variables to hold the parsed data
    Dim documentType As String
    Dim countryCode As String
    Dim passportNumber As String
    Dim nationality As String
    Dim dateOfBirth As String
    Dim gender As String
    Dim expirationDate As String
    
    ' Split the MRZ data into an array of strings
    Dim mrzData As String() = mrz.Split("<MRZ Data>")
    
    ' Extract the desired data from the MRZ
    documentType = mrzData(0)
    countryCode = mrzData(1)
    passportNumber = mrzData(2)
    nationality = mrzData(3)
    dateOfBirth = mrzData(4)
    gender = mrzData(5)
    expirationDate = mrzData(6)
    
    1. Finally, you can use the parsed data as you need.

    It's important to note that MRZ format varies among different countries and document types, so you will need to make sure that the code is adjusted to match the format of the MRZ you are trying to parse.

    You can also use third party libraries like 'MRZ.Net' to parse MRZ in VB.Net, which would be easier and more efficient.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.