←Select platform

EnableReturnFourPoints Property

Summary
Gets or sets a value indicating whether to enable return the four corners coordinates instead a bounding rectangle.
Syntax
C#
C++/CLI
Python
public bool EnableReturnFourPoints { get; set; } 
public: 
property bool EnableReturnFourPoints { 
   bool get(); 
   void set (    bool ); 
} 
EnableReturnFourPoints # get and set (BarcodeReader) 

Property Value

true to enable return of four corners. Otherwise, false. The default value is false.

Remarks

When calling ReadBarcode or ReadBarcodes with the EnableReturnFourPoints property set to true, BarcodeData.Bounds member will be updated with the coordinates of the four corners of the barcode rather than the coordinates of the bounding rectangle. These coordinates are encoded values and must be decoded before they can be used. The following example shows how to decode the four-point corner values:

C# Snippet
// Code goes here 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Barcode; 
using Leadtools.ImageProcessing; 
       
public void BarcodeReader_Example() 
{ 
   string[] imageFileNames = 
   { 
      Path.Combine(LEAD_VARS.ImagesDir, "Barcode1.tif"), 
      Path.Combine(LEAD_VARS.ImagesDir, "Barcode2.tif") 
   }; 
   // Create a Barcode engine 
   BarcodeEngine engine = new BarcodeEngine(); 
 
   // Get the Barcode reader instance 
   BarcodeReader reader = engine.Reader; 
 
   // Load the image 
   using(RasterCodecs codecs = new RasterCodecs()) 
   { 
      foreach(string imageFileName in imageFileNames) 
      { 
         using(RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)) 
         { 
            // Read all the barcodes in this image 
            BarcodeData[] barcodes = reader.ReadBarcodes(image, LeadRect.Empty, 0, null); 
 
            // Print out the barcodes we found 
            Console.WriteLine("{0} contains {1} barcodes", imageFileName, barcodes.Length); 
            for(int i = 0; i < barcodes.Length; i++) 
            { 
            BarcodeData barcode = barcodes[i]; 
            Point[] fourPoints = new Point[4]; 
            fourPoints[0].X = ((int)barcode.Bounds.Left & 0xffff);      fourPoints[0].Y = ((int)barcode.Bounds.Left >> 16); 
               fourPoints[1].X = ((int)barcode.Bounds.Top & 0xffff);       fourPoints[1].Y = ((int)barcode.Bounds.Top >> 16); 
               fourPoints[2].X = ((int)barcode.Bounds.Width & 0xffff);     fourPoints[2].Y = ((int)barcode.Bounds.Width >> 16); 
               fourPoints[3].X = ((int)barcode.Bounds.Height & 0xffff);    fourPoints[3].Y = ((int)barcode.Bounds.Height >> 16); 
               Console.WriteLine("  {0} - {1} - {2}", i + 1, barcode.Symbology, barcode.Value); 
            for(int j = 1; j <=4; j++) 
            { 
               Console.WriteLine("Corner #{0} (x,y) : {1},{2} ", j, fourPoints[j].X, fourPoints[j].Y); 
            } 
            } 
            Console.WriteLine("-----------------"); 
         } 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Barcode Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.