Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, October 18, 2007 6:33:45 AM(UTC)

Pradeep  
Pradeep

Groups: Registered
Posts: 14


Hi LeadTool Gurus,
I have trouble reading barcodes from a TIFF file in the sequence I need. I am not sure if I am doing something wrong. Can any one please help me with this. I am attaching a sample TIFF file with barcode values in it. I need to get the values in TOP to BOTTOM sequence after the read is done. I have sent the routine I use to do the same.

public static string[] ReadBarcode(string imgPath)
        {
           
            IntPtr intPtrBitmapOfTif = System.IntPtr.Zero;
            string[] result = null;
            IRasterImage rasterImage = null;
            RasterCodecs rasterCodecs = new RasterCodecs();   
            try
            {
                rasterImage = rasterCodecs.Load(imgPath);
                intPtrBitmapOfTif = RasterImageConverter.ToLeadBitmap(rasterImage, "LTKRN14N.DLL");
                _leadBarCodeClass.Bitmap = intPtrBitmapOfTif.ToInt32();
                _leadBarCodeClass.EnableUseRegion = true;
                _leadBarCodeClass.Linear.EnableErrorCheck = false;
                _leadBarCodeClass.Linear.Granularity =9;
                //_leadBarCodeClass.Linear.ReadDirection = (int)LTBARLib.tagBARCODE_DIRECTION.BARCODE_DIR_BOTTOM_TO_TOP | (int) LTBARLib.tagBARCODE_DIRECTION.BARCODE_DIR_LEFT_TO_RIGHT | (int) LTBARLib.tagBARCODE_DIRECTION.BARCODE_DIR_RIGHT_TO_LEFT | (int) LTBARLib.tagBARCODE_DIRECTION.BARCODE_DIR_TOP_TO_BOTTOM;
                _leadBarCodeClass.Linear.ReadDirection = (int) LTBARLib.tagBARCODE_DIRECTION.BARCODE_DIR_TOP_TO_BOTTOM;
                _leadBarCodeClass.Read((int)LTBARLib.tagBARCODE_1D_TYPES.BARCODE_1D_READ_ANYTYPE,0,0,0,0,0);
                result =  new string[_leadBarCodeClass.TotalCount] ;
                for(short _cntrNoOfBarCodes = 0;_cntrNoOfBarCodes
                    result[_cntrNoOfBarCodes] = _leadBarCodeClass.get_BarCodeData(_cntrNoOfBarCodes).Data;
               
            }
            finally
            {
                ///Free the Unmanaged memory using the native Leadtools dlls.
                L_FreeBitmap(intPtrBitmapOfTif);
                ///Try to free the Managed memory using the native Leadtools dlls.
                System.Runtime.InteropServices.Marshal.FreeHGlobal(intPtrBitmapOfTif);
                RasterImageConverter.FreeLeadBitmap(intPtrBitmapOfTif,"LTKRN14N.DLL");
                rasterCodecs = null;
                rasterImage.Dispose();
                rasterImage = null;
            }
            return result;
        }
File Attachment(s):
01.zip (16kb) downloaded 22 time(s).
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, October 21, 2007 5:23:39 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)


There is
no way to tell the engine to sort the returned values in any particular order.
However, since you have all the values, and you have the X/Y coordinates of
each value, you can compare the coordinates and determine which one is at the top, and which one is at the bottom.

 
#3 Posted : Monday, October 22, 2007 3:13:28 AM(UTC)

Pradeep  
Pradeep

Groups: Registered
Posts: 14


How do I get the X and Y coordinates of the read barcode?
 
#4 Posted : Monday, October 22, 2007 6:24:05 AM(UTC)

BoydP  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 1 time(s) in 1 post(s)

The Location propery of the BarcodeData object contains the properties Left, Top, Width, Height.  You can therefore use these values to determine the order of the barcodes.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.226 seconds.