salut Tous le monde

J'ai un petit problème pour aligner le texte capté de l'image box

j'ajoute les module de tesseract ( arabe, français, anglais, hindi )

j'ai trouvé le problème pour l'arabe moi même ( j'ai rien trouvé sur le net sauf le code qui j'ai réglé moi même en copiant le fichier anglais eng.tesseract_cube.nn en ara.tesseract_cube.nn et en modifiant l'option OEM_TESSERACT_ON*LY par OEM_CUBE_ONLY et ça va jouer )

Mon problème comme j'ai mentionné en haut c'est que le text généré est aligné de gauche à droite ( mot de gauche à droite et pas le positionnement)

Quelqu'un peut me dire ce que je doit rajouter pour résoudre ce petit problème.

merci


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
Imports Emgu.CV 'Imports Emgu.CV.Util
Imports Emgu.CV.OCR
Imports Emgu.Util
Imports Emgu.CV.Structure
 
Public Class Form1
    Dim OCRz As Tesseract = New Tesseract("tessdata", "ara", Tesseract.OcrEngineMode.OEM_CUBE_ONLY)          'OEM_TESSERACT_ON*LY)
    'OEM_TESSERACT_ONLY,           // Run Tesseract only - fastest
    'OEM_CUBE_ONLY,                // Run Cube only - better accuracy, but slower
    'OEM_TESSERACT_CUBE_COMBINED,  // Run both and combine results - best accuracy
    'OEM_DEFAULT                   // Specify this mode when calling init_*(),
    '                              // to indicate that any of the above modes
    '                              // should be automatically inferred from the
    '                              // variables in the language-specific config,
    '                              // command-line configs, or if not specified
    '                              // in any of the above should be set to the
    '                              // default OEM_TESSERACT_ONLY.
    Dim pic As Bitmap = New Bitmap(697, 206)
    Dim gfx As Graphics = Graphics.FromImage(pic)
 
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        'If Windows XP
        gfx.CopyFromScreen(New Point(Me.Location.X + PictureBox1.Location.X + 4, Me.Location.Y + PictureBox1.Location.Y + 30), New Point(0, 0), pic.Size)
        PictureBox1.Image = pic
 
        'If Windows 7
        'gfx.CopyFromScreen(MousePositi*on, New Point(0, 0), pic.Size)
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OCRz.Recognize(New Image(Of Bgr, Byte)(pic))
        RichTextBox1.Text = OCRz.GetText
        RichTextBox1.SelectedText = RightToLeft
        RichTextBox1.SelectionAlignment = HorizontalAlignment.Right
        RichTextBox1.Font = New Font("Traditional Arabic", 14)
        RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Bold)
    End Sub
End Class