Barcodes not being detected using SetRoi()

Discussions about 1D barcode reading and writing
Post Reply
iaind
Posts: 5
Joined: Thu Jun 17, 2010 8:00 am

Barcodes not being detected using SetRoi()

Post by iaind » Wed Jul 14, 2010 4:27 am

Hi, I have a number of documents with barcodes located in the same region (give or take a few pixels) on each page and am using SetRoi() to narrow down the barcode search...On the first 2 instances the barcodes are found without any problems but on the third and fourth instances (as well as others) the barcodes are only detected if I use a ResetRoi() instead of a SetRoi() even though they are in the same location as the first 2. Any ideas why this might be happening?

Thanks,

Iain

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Barcodes not being detected using SetRoi()

Post by Loïc » Wed Jul 14, 2010 9:00 am

Hi,

I don't get you dude. Could you explain what you mean by "if I use a ResetRoi() instead of a SetRoi() even though they are in the same location as the first 2. "

Also if you can attach image for investigation it should be helpful.

Kind regards,

Loïc

jloizagah
Posts: 21
Joined: Tue Mar 17, 2009 2:45 pm

Re: Barcodes not being detected using SetRoi()

Post by jloizagah » Mon Dec 13, 2010 5:28 pm

Hi.

I think I must have the same problem. I'm trying to read a barcode selecting a region in a GdViewer, and works fine the first time, but if I select the same , or a similar zone containing the barcode, doesnt not read anythig. The code I'm using on the gdViewer1_MouseUp event of a GdViewer control is:

Code: Select all

  private void gdViewer1_MouseUp(object sender, MouseEventArgs e)
        {
            try
            {
                if (this.gdViewer1.IsRect())
                {
                    int LeftArea = 0;
                    int TopArea = 0;
                    int WidthArea = 0;
                    int HeightArea = 0;

                    this.gdViewer1.GetRectCoordinatesOnDocument(ref LeftArea, ref TopArea, ref WidthArea, ref HeightArea);
                   
                    oGdPictureImaging.SetROI(LeftArea, TopArea, WidthArea, HeightArea);

                    if (oGdPictureImaging.Barcode1DReaderDoScan(ImageID, GdPicture.Barcode1DReaderScanMode.BestSpeed) == GdPicture.GdPictureStatus.OK)
                    {
                        int BarcodeCount = oGdPictureImaging.Barcode1DReaderGetBarcodeCount();

                        if (BarcodeCount > 0)
                        {
                            for (int i = 1; i <= BarcodeCount; i++)
                            {
                                if (oGdPictureImaging.Barcode1DReaderGetBarcodeType(i) == GdPicture.Barcode1DReaderType.Barcode1DReaderCode39)

                                    MessageBox.Show("Value: " + oGdPictureImaging.Barcode1DReaderGetBarcodeValue(i));
                            }
                        }
                        else
                        {
                            MessageBox.Show("No Barcode");
                        }

                        oGdPictureImaging.Barcode1DReaderClear();
                    }
 
                    oGdPictureImaging.ReleaseGdPictureImage(ImageID);
                    

                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                oGdPictureImaging.ResetROI();
                gdViewer1.ClearRect(); 
            }


        }
There is also a tif file for testing purpouses.

Best regards.
Attachments
testbarcode.tif
testbarcode.tif (2.92 KiB) Viewed 2339 times

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Barcodes not being detected using SetRoi()

Post by Loïc » Wed Dec 29, 2010 11:30 am

Hi,

This problem will be fixed for the next release.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests