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, April 13, 2006 10:12:15 PM(UTC)
C3Florence

Groups: Registered
Posts: 2


Hi,

with ocr I need to recognize only specific characters, for exemple 1,2,3,4,5,6,7,8,9 and # and *.

May I to define a specific language or I have to use CharacterPlusFilter?

About characterPlusfilter i read all help file but I did not find an  explanation or an exemple useful.

May somebody help me?

Thanks..

 

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 : Thursday, April 20, 2006 5:01:21 AM(UTC)

Ali  
Guest

Groups: Guests
Posts: 3,022

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


If you have small sample (not your full application) which you are trying to use this property along with sample image to check it.

Thanks,
Ali Abo Al-Rob
LEADTOOLS Technical Support

 
#3 Posted : Thursday, May 4, 2006 9:35:34 PM(UTC)
C3Florence

Groups: Registered
Posts: 2


The problem is that I did not find any valid explanation about the property, so I have no idea about I can use it.
I need an example to test it.
However I send you the code I'm using.

In the red, bold code I would like to insert the instructions to recognize for exemple only following characters: 1,2,3,4,5,6,7,8,9,0,#, x.

 

Thanks.

Public Function Riconosci_ocr(ByRef C3raster, Numcar_mn, Numcar_mx, Tipo, ByRef Esito, Lrd As LEADRasterDocument, Lrp As LEADRasterProcess, Campo, Soglia)

    Dim nZoneCount      As Integer

    Dim ZoneData

    Dim nCharsCount     As Long

    Dim Indx_ch         As Integer

    Dim Indx_rs         As Integer

    Dim Wrk_elem        As String

    Dim Wrk_strocr      As Variant

    Dim Wrk_result      As Variant

    Dim Wrk_resint      As Variant

    Dim nRet            As Variant

    Dim Azione          As Variant

    Dim hR              As New LeadRaster

    Dim iVal            As Integer

    Dim hRs             As ADODB.Recordset

   

    Set ZoneData = New LTZoneData

 

    Lrd.EnableSubSystem = True

    Lrd.EnableCorrection = False

    Lrd.SpellLanguageID = LANGID_NO

 

    Lrd.RecognitionDataFileName = "c:\test.rdf"

    Lrd.EnableSaveResultsToMemory = True

 

    Azione = Separa_rosso(C3raster, Lrp, Campo, Soglia)

    Esito = 2

    Do While Lrd.PageCount > 0     ' Rimozione di (eventuali) pagine precedenti del Doc

        Lrd.RemovePage (0)

    Loop

 

    If AP_DEBUG Then

        hR.RefBitmap = False

        hR.Bitmap = C3raster.Bitmap

        CkImgList.Add hR

    End If

   

    nRet = Lrd.AddPage(C3raster, 0)

    If nRet <> 0 Then

        Exit Function

    Else

        Lrd.ActivePageIndex = 0

    End If

 

    ZoneData.left = 0

    ZoneData.top = 0

    ZoneData.Right = Lrd.PageWidth(0) - 1

    ZoneData.Bottom = Lrd.PageHeight(0) - 1

    If Campo = "MK" Then

        ZoneData.RecognizeModule = RECOGNZIE_MODULE_AUTO

        Lrd.LanguageCharacterFilter = CHAR_FILTER_ALL

        ZoneData.CharacterFilter = CHAR_FILTER_ALL

        ZoneData.Type = ZONE_TYPE_FLOWTEXT

        ZoneData.Flags = ZONE_CHK_PASS_LINES

        ZoneData.FillMethod = FM_DEFAULT

    Else

        ZoneData.RecognizeModule = RECOGNZIE_MODULE_AUTO

        If Tipo = "N" Then

            Lrd.LanguageCharacterFilter = CHAR_FILTER_DIGIT

            ZoneData.CharacterFilter = CHAR_FILTER_DIGIT

        ElseIf Tipo = "A" Then

            Lrd.LanguageCharacterFilter = CHAR_FILTER_UPPERCASE

            ZoneData.CharacterFilter = CHAR_FILTER_UPPERCASE

        Else

            Lrd.LanguageCharacterFilter = CHAR_FILTER_ALL

            ZoneData.CharacterFilter = CHAR_FILTER_ALL

        End If

        ZoneData.Type = ZONE_TYPE_FLOWTEXT

        ZoneData.Flags = ZONE_CHK_PASS_LINES

        ZoneData.FillMethod = FM_DEFAULT

    End If

    ZoneData.EnableVerificationEvent = False

    ZoneData.SectionName = "Zonaocr"

'    ZoneData.FillMethod = FM_OCRA Or FM_OCRB Or FM_DRAFTDOT24 Or FM_DRAFTDOT9 Or FM_OMNIFONT

'    ZoneData.RecognizeModule = RECOGNZIE_MODULE_HAND_PRINTED_NUMERAL

 

    nRet = Lrd.AddZone(0, 0, ZoneData)

    Set ZoneData = Nothing

    If nRet <> 0 Then

        Exit Function

    End If

 

    If Not FileDelete("c:\test.rdf") Then

        Exit Function

    End If

 

    On Error GoTo noimm

    nRet = Lrd.Recognize(0, 1)

    On Error GoTo 0

 

    If (nRet = 0) Then

        Lrd.GetRecognizedCharacters (0)

        nCharsCount = Lrd.RecognizedCharactersCount

        If nCharsCount >= Numcar_mn Then

            Lrd.SaveResultsToMemory

            Wrk_strocr = Lrd.MemoryRecognitionResult

 

'            For Indx_ch = 0 To (nCharsCount - 1)

'                If Lrd.RecognizedCharacter(Indx_ch).Confidence < 900 Then

'                    Esito = Esito + 1

'                End If

'            Next Indx_ch

 

            Indx_rs = 0

            Wrk_result = Null

            For Indx_ch = 1 To Len(Wrk_strocr)

                Wrk_elem = Mid(Wrk_strocr, Indx_ch, 1)

 

                If Wrk_elem <> " " And Wrk_elem <> "~" And Wrk_elem <> "'" And Wrk_elem <> "_" And Wrk_elem <> "," And Wrk_elem <> "." And Wrk_elem <> "-" Then

                    If (Tipo = "N" And IsNumeric(Wrk_elem)) Or (Tipo = "A" And Not IsNumeric(Wrk_elem)) Or Tipo = "M" Or Tipo = "K" Then

                        Indx_rs = Indx_rs + 1

                        GoSub Correggi

                        Wrk_result = Wrk_result & Wrk_elem

                    End If

                End If

            Next Indx_ch

            Wrk_resint = left(Wrk_result, Numcar_mx)

        End If

    Else

        Exit Function

    End If

 

    GoSub Last_Check

    Riconosci_ocr = Wrk_resint

    Exit Function

 

Last_Check:

 

    Select Case Campo

        Case "CF"

            If Check_CFis(Wrk_resint) = 0 Then

                Esito = 1

            Else

                Esito = 0

            End If

        Case "DT"

            If Not IsDate(left(Wrk_resint, 2) & "/" & Mid(Wrk_resint, 3, 2) & "/" & Right(Wrk_resint, 2)) Then

                Esito = 1

                Return

            End If

            If Not UT_ValidDate(CStr(Wrk_resint)) Then

                Esito = 1

                Return

            End If

            iVal = Val(Right(Wrk_resint, 2)) + 2000

            If iVal > Year(Now()) Or iVal < (Year(Now()) - 1) Then

                Esito = 1

                Return

            End If

            Esito = 0

        Case "MK"

            If Len(Wrk_resint) > 0 Then

                If left(Wrk_resint, 1) = "0" Or left(Wrk_resint, 1) = "#" Or left(Wrk_resint, 1) = "X" Or left(Wrk_resint, 1) = "x" Or left(Wrk_resint, 1) = "*" Or left(Wrk_resint, 1) = "4" Or left(Wrk_resint, 1) = "C" Or left(Wrk_resint, 1) = "c" Or left(Wrk_resint, 1) = "K" Or left(Wrk_resint, 1) = "k" Or left(Wrk_resint, 1) = ";" Or left(Wrk_resint, 1) = "1" Or left(Wrk_resint, 1) = "i" Then

                    Esito = 0

                Else

                    Esito = 2

                End If

            Else

                Esito = 2

            End If

        Case "ESE"

            If Len(Wrk_resint) > 0 Then

                Esito = 0

            Else

                Esito = 2

            End If

        Case "PR"

            If Len(Wrk_resint) = 0 Then

                Esito = 2

                Return

            End If

           

            Esito = 1

            Set hRs = DB_ReadGenTable(hConn_RO, "Tab_province", "Codice='" & UCase(Wrk_resint) & "'", False, "*")

          

            If hRs Is Nothing Then Return

            If hRs.EOF Then Return                  ' Se trovo la provincia OK

            Esito = 0

        Case "ASL"

            If Len(Wrk_resint) = 0 Or Len(Wrk_resint) > 3 Then

                Esito = 2

                Return

            End If

           

            Esito = 1

           

            Set hRs = DB_ReadGenTable(hConnA_RO, "Tab_regasl", "Codreg='" & CkCheck.Reg & "' AND Codasl='***'", False, "*")

            If Not hRs Is Nothing Then

                If Not hRs.EOF Then                 ' Se trovo *** vanno bene tutte le asl

                    Esito = 0

                    Return

                End If

            End If

                                                    ' ... altrimenti cerco l'asl effettiva

            Set hRs = DB_ReadGenTable(hConnA_RO, "Tab_regasl", "Codreg='" & CkCheck.Reg & "' AND Codasl='" & CStr(Wrk_resint) & "'", False, "*")

            If hRs Is Nothing Then Return

            If hRs.EOF Then Return

            Esito = 0

        Case "CUF"

            If Len(Wrk_resint) > 0 Then

                If Wrk_resint = "0" Or Wrk_resint = "00" Or Wrk_resint = "000" Then

                    Esito = 1

                Else

                    Esito = 0

                End If

            Else

                Esito = 2

            End If

        Case "NCONF"

            If Len(Wrk_resint) > 0 Then

                If CInt(Wrk_resint) > 6 Then

                    Esito = 1

                Else

                    Esito = 0

                End If

            Else

                Esito = 2

            End If

        Case "TRIC"

            If Len(Wrk_resint) > 0 Then

                Esito = 0

            Else

                Esito = 2

            End If

        Case Else

            Esito = 0

    End Select

Return

 

Correggi:

 

    Select Case Campo

        Case "CF"

            If (Indx_rs >= 1 And Indx_rs <= 6) Or Indx_rs = 9 Or Indx_rs = 12 Or Indx_rs = 16 Then

                Conv2Alpha Wrk_elem

            Else

                Conv2Num Wrk_elem

            End If

        Case "DT"

            Conv2Num Wrk_elem

        Case "ESE"

            If Wrk_elem = "*" Or Wrk_elem = "#" Or Wrk_elem = "X" Then

                Wrk_elem = ""

            Else

                AlphaNumFilter Wrk_elem

            End If

        Case "PR"

            Conv2Alpha Wrk_elem

        Case "ASL"

            Conv2Num Wrk_elem

        Case "CUF"

            If Wrk_elem = "*" Or Wrk_elem = "#" Or Wrk_elem = "X" Then

                Wrk_elem = ""

            Else

                AlphaNumFilter Wrk_elem

            End If

        Case...

 
#4 Posted : Monday, May 8, 2006 5:12:03 AM(UTC)

Ali  
Guest

Groups: Guests
Posts: 3,022

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

Please check the attached sample demo. This sample demo recognizes an image depending on the LanguageCharacterPlusFilter.

To run and test the demo, please press the buttons in sequence starting from button no 1.

Does this solve your problem?

Thanks,
Ali Abo Al-Rob
LEADTOOLS Technical Support

File Attachment(s):
OCR LanguageCharacterPlusFilter.zip (4kb) downloaded 35 time(s).
 
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-2024, Yet Another Forum.NET
This page was generated in 0.365 seconds.