Ճանաչել 2D մատրիցային շտրիխ կոդերը տարածական աղավաղումներով .NET-ում

Բլոգի կատեգորիա՝ Barcode.NET

06.05.2020

VintaSoft Barcode .NET SDK-ն կարող է օգտագործվել .NET/C# հավելվածում՝ երկչափ Aztec, QR Code և Han Xin Code շտրիխ կոդերի ճանաչման համար՝ պատահական մակերեսային աղավաղումներով: Գործնականում սա թույլ է տալիս զգալիորեն պարզեցնել շտրիխ կոդի ճանաչումը լուսանկարչական ապարատից, վեբ տեսախցիկից կամ սմարթֆոնի տեսախցիկից, քանի որ այժմ անհրաժեշտ չէ շտրիխ կոդը հավասարեցնել տեսախցիկի առջև, և նույնիսկ հնարավոր է ճանաչել շտրիխ կոդերը անհարթ մակերեսներից:

First sample of Aztec barcode with spatial distortions


Մեր մշակողները շատ հետաքրքիր ժամեր են ծախսել վեբ և լուսանկարչական տեսախցիկների միջոցով աղավաղման ուղղման ալգորիթմը մշակելու և կատարելագործելու վրա: Ստորև կարող եք դիտել նման շտրիխ կոդերը մեր շտրիխ կոդերի ընթերցողի "աչքերով".

View to the Aztec barcode with spatial distortions via 'eyes' of barcode reader of VintaSoft Barcode .NET SDK

Ինչ-որ պահի մեր մշակողները սկսեցին շտրիխ կոդերը տեսնել հենց այդպես։ :)


Ահա C# կոդը, որը թույլ է տալիս ճանաչել տարածական աղավաղումներով ացտեկական, QR և Հան Սին կոդերի շտրիխ կոդերը.
/// <summary>
/// Recognizes 2D matrix barcodes (Aztec, QR Code and Han Xin Code) with spatial distortions.
/// </summary>
public void Recognize2dBarcodeWithSpatialDistortions()
{
    // create barcode reader
    using (Vintasoft.Barcode.BarcodeReader reader = new Vintasoft.Barcode.BarcodeReader())
    {
        // specify that reader must search for Aztec, QR and Han Xin Code barcodes
        reader.Settings.ScanBarcodeTypes = Vintasoft.Barcode.BarcodeType.Aztec |
            Vintasoft.Barcode.BarcodeType.QR |
            Vintasoft.Barcode.BarcodeType.HanXinCode;

        // specify that reader must search for horizontal and vertical barcodes only
        reader.Settings.ScanDirection = Vintasoft.Barcode.ScanDirection.Horizontal | Vintasoft.Barcode.ScanDirection.Vertical;

        // read barcodes from image file
        Vintasoft.Barcode.IBarcodeInfo[] barcodeInfos = reader.ReadBarcodes("barcodes.png");

        // if barcodes are not detected
        if (barcodeInfos.Length == 0)
        {
            System.Console.WriteLine("Barcodes are not found.");
        }
        // if barcodes are detected
        else
        {
            // get information about recognized barcodes

            System.Console.WriteLine(string.Format("{0} barcode(s) found:", barcodeInfos.Length));
            System.Console.WriteLine();
            for (int i = 0; i &lt; barcodeInfos.Length; i++)
            {
                Vintasoft.Barcode.IBarcodeInfo barcodeInfo = barcodeInfos[i];
                System.Console.WriteLine(string.Format("[{0}:{1}]", i + 1, barcodeInfo.BarcodeType));
                System.Console.WriteLine(string.Format("Value:      {0}", barcodeInfo.Value));
                System.Console.WriteLine(string.Format("Region:     {0}", barcodeInfo.Region));
                System.Console.WriteLine();
            }
        }
    }
}


Թեստերը ցույց տվեցին, որ շտրիխ կոդերի կարդացողը կարող է հաջողությամբ կարգավորել ստորև նշված մեկ կամ մի քանի տեսակի աղավաղումները.

Ահա մի քանի պատկերներ աղավաղված շտրիխ կոդերով.
Second sample of Aztec barcode with spatial distortions

Third sample of Aztec barcode with spatial distortions

First sample of Han Xin Code barcode with spatial distortions

Second sample of Han Xin Code barcode with spatial distortions

First sample of QR barcode with spatial distortions

Second sample of QR barcode with spatial distortions


Ավելի շատ պատկերներ աղավաղված շտրիխ կոդերով կարող եք գտնել VintaSoft Barcode .NET SDK-ի բաշխիչ փաթեթում:

Եթե դուք ունեք որևէ խնդիր շտրիխ կոդի ճանաչման հետ կապված և կարծում եք, որ մեր շտրիխ կոդի ճանաչման ալգորիթմը պետք է լուծի դրանք, խնդրում ենք ուղարկել ձեր պատկերները փորձարկման և վերանայման համար support@vintasoft.com հասցեով: