Read Barcode from scanned document

Example requests & Code samples for GdPicture Toolkits.
Post Reply
ksamy
Posts: 15
Joined: Fri Aug 31, 2012 9:34 am

Read Barcode from scanned document

Post by ksamy » Tue Sep 04, 2012 7:50 am

Hi,

1.I have opne PDF document with BARCODE.i can read the barcode using 'Barcode1DReaderGetBarcodeCount' method.
2.Then i Scanned this PDF document and convert into TIFF document manually not with code.
3.Now i can display that scanned TIFF document in GDViewer but can not read the BARCODE value on that TIFF document.

My requirement is to read the BARCODE value from scanned Tiff document.
How can i do this?

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

Re: Read Barcode from scanned document

Post by Loïc » Tue Sep 04, 2012 11:42 am

Hello,

Please check the sample called "Barcode Recognition" available in C# and vb.NET languages which exactly do that.

To get the sample, install GdPicture.NET package, move to the sample folder and search for "Barcode Recognition".

Let us know if you need further information.

kind regards,

Loïc

ksamy
Posts: 15
Joined: Fri Aug 31, 2012 9:34 am

Re: Read Barcode from scanned document

Post by ksamy » Tue Sep 04, 2012 12:20 pm

Hello,
i have already download the samples from GDPicture and now i am using the sample code you have provide us.
From "Barcode Recognition" project only i know the code that how to read the BARCODE value from PDF.
That i did already.
But our current requirement is read BARCODE value from scanned tiff document.I can't know where to i start to read value from scanned document?

FYI:
1.I can read the BARCODE value from PDF document.
2.But now the same PDF document, scanned and save as Tiff document, but i can't read the BARCODE value from the scanned document.This is my issue now..can u provide any code for this issue?

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

Re: Read Barcode from scanned document

Post by Loïc » Tue Sep 04, 2012 2:27 pm

Hello,

The sample demonstrates how to read barcode from PDF and image.

Therefore you can easily modify the sample to replace the image loading from file by image loading from TWAIN devices for example.

IE replacing:

Code: Select all

CloseCurrentImage()
        GdViewer1.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
        Dim sFilePath As String = SelectOneFileOpenDialog(Me)

        If sFilePath <> "" Then
            If m_GdPictureImaging.GetDocumentFormatFromFile(sFilePath) = DocumentFormat.DocumentFormatPDF Then

                If m_GdPicturePDF.LoadFromFile(sFilePath, False) = GdPictureStatus.OK Then
                    m_DocSourceType = DocumentType.DocumentTypePDF
                    renderPdfPage(1)
                End If
            Else
                m_DocSourceType = DocumentType.DocumentTypeBitmap
                m_ImageID = m_GdPictureImaging.CreateGdPictureImageFromFile(sFilePath)
            End If

            If m_ImageID <> 0 Then
                GdViewer1.DisplayFromGdPictureImage(m_ImageID)
                ShowImageInfo()
            End If
        End If
by:

Code: Select all

        CloseCurrentImage()
        GdViewer1.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
        m_DocSourceType = DocumentType.DocumentTypeBitmap

        m_GdPictureImaging.TwainSelectSource(Me.Handle)
        m_GdPictureImaging.TwainOpenDefaultSource(Me.Handle)
        m_ImageID = m_GdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
        m_GdPictureImaging.TwainCloseSource()

        If m_ImageID <> 0 Then
            GdViewer1.DisplayFromGdPictureImage(m_ImageID)
            ShowImageInfo()
        End If
Regards,

Loïc

ksamy
Posts: 15
Joined: Fri Aug 31, 2012 9:34 am

Re: Read Barcode from scanned document

Post by ksamy » Tue Sep 04, 2012 3:18 pm

ReadBarcode.zip
Barcode Readable and Unreadable documents
(361.67 KiB) Downloaded 508 times
Hello,
As per your last statement i change the code as below,But m_ImageID return 0.
I have also attached the zip file that contains 'Readable_Normal.pdf' - BARCODE value can readble and "UnReadable_Scanned.tif" - BARCODE value not readable scanned tiff document.

My requirement is i need to read the BARCODE value from attached "UnReadable_Scanned.tif" document using draw rectangle around the BARCODE.


private void OpenToolStripMenuItem_Click( System.Object sender, System.EventArgs e )
{
CloseCurrentImage();
GdViewer1.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer;
m_DocSourceType = DocumentType.DocumentTypeBitmap;

string sFilePath = SelectOneFileOpenDialog(this);
if (sFilePath != "")
{
m_GdPictureImaging.TwainSelectSource(this.Handle);
m_GdPictureImaging.TwainOpenDefaultSource(this.Handle);
m_ImageID = m_GdPictureImaging.TwainAcquireToGdPictureImage(this.Handle);
m_GdPictureImaging.TwainCloseSource();


if (m_ImageID != 0)
{
GdViewer1.DisplayFromGdPictureImage(m_ImageID);
ShowImageInfo();
}
}
}

ksamy
Posts: 15
Joined: Fri Aug 31, 2012 9:34 am

Re: Read Barcode from scanned document

Post by ksamy » Wed Sep 05, 2012 5:49 am

Any Update?

I can able to read BARCODE value from "Normal PDF document","Scanned PDF document","Normal TIFF document" ,But why i can't read BARCODE value from "Scanned Tiff Document"

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

Re: Read Barcode from scanned document

Post by Loïc » Wed Sep 05, 2012 12:29 pm

Hello,

But why i can't read BARCODE value from "Scanned Tiff Document"
The problem has nothing to do with that. The tiff image you've attached contains a barcode in a terribly poor quality that we can not recover in any manner.

Kind regards,

Loïc

ksamy
Posts: 15
Joined: Fri Aug 31, 2012 9:34 am

Re: Read Barcode from scanned document

Post by ksamy » Wed Sep 05, 2012 2:52 pm

Hello,
We found the solution..

Issue is source of scanned document BARCODE is other than black color.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest