Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - VB 2008 OCR
Forum - C# / VB.NET - VB 2008 OCR

Pagine: [ 1 2 3 ] Precedente | Prossimo
Avatar
coyote100 (Normal User)
Rookie


Messaggi: 50
Iscritto: 22/04/2013

Segnala al moderatore
Postato alle 9:39
Giovedì, 25/04/2013
SALVE STO LAVORANDO SUL SISTEMA OCR PER CONVERTIRE LE IMMAGINI IN TESTO.
MI DA ERRORE "Exception.InnerException. Errore: L'inizializzatore di tipo di 'Emgu.CV.OCR.Tesseract' ha generato un'eccezione."

CODICE


Imports Emgu.CV
Imports Emgu.Util
Imports Emgu.CV.OCR
Imports Emgu.CV.Structure

Public Class Form1

    Dim OCRz As Tesseract = New Tesseract("tessdata", "eng", Tesseract.OcrEngineMode.OEM_TESSERACT_ONLY)
    Dim pic As Bitmap = New Bitmap(270, 100)
    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

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class



LE DLL LE HO CARICATE, IL PROGRAMMA PARTE MA DA L'ERRORE CHE HO RIPORTATO  SOPRA.


PM Quote
Avatar
LittleHacker (Member)
Guru


Messaggi: 1033
Iscritto: 28/04/2009

Segnala al moderatore
Postato alle 16:56
Giovedì, 25/04/2013
Consigli utili:
Quando posti del codice usa il tag Code (pulsante in basso a destra), così diventa più leggibile!
Usare il Caps Lock su Internet è uguale a urlare! Quindi non usarlo mai(o solo in certe situazioni)!

Ah...poi google ti è molto amico. Quindi prima di postare prova a cercare su internet!

http://lmgtfy.com/?q=Exception.InnerException.+Emgu.CV.OCR ...

PM Quote
Avatar
coyote100 (Normal User)
Rookie


Messaggi: 50
Iscritto: 22/04/2013

Segnala al moderatore
Postato alle 19:19
Giovedì, 25/04/2013
E' una settimana che cerco su Google!!!!!
Sto diventando matto, se c'è qualcuno che c'è già passato.

VB 2008 OCR
Exception.InnerException. Errore: L'inizializzatore di tipo di 'Emgu.CV.OCR.Tesseract' ha generato un'eccezione

PM Quote
Avatar
coyote100 (Normal User)
Rookie


Messaggi: 50
Iscritto: 22/04/2013

Segnala al moderatore
Postato alle 8:49
Venerdì, 26/04/2013
EVENTUALMENTE C'E' UN SISTEMA IN VB 2008 PER CONVERTIRE LE IMMAGINI IN TESTO ALTERNATIVO A OCR.

GRAZIE

PM Quote
Avatar
coyote100 (Normal User)
Rookie


Messaggi: 50
Iscritto: 22/04/2013

Segnala al moderatore
Postato alle 14:07
Venerdì, 26/04/2013
HO TROVATO UN SISTEMA ALTERNATIVO

Salve sto lavorando su un programma che traduce l'immagine in testo.
Uso la libreria MODI

QUANDO PRO LA CONVERSIONE MI DA ERRORE

Recupero della class factory COM per il componente con CLSID {40942A6C-1520-4132-BDF8-BDC1F71F547B} non riuscito a causa del seguente errore: 80040154.

MI EVIDENZIA     miDoc = New MODI.Document

QUALCUNO PUO' AIUTARMI




Codice sorgente - presumibilmente VB.NET

  1. [CODE]Imports System.Drawing.Imaging
  2.  
  3. Public Class Form9
  4.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  5.         Dim dir As String = Environment.SystemDirectory
  6.         If TextBox1.Text = "" Then
  7.             MsgBox("Please, Pick the desired image first!!!", MsgBoxStyle.Information, "No Image Selected")
  8.         Else
  9.             'Try
  10.             MergeImages(PictureBox1.Image)
  11.             PictureBox2.Image.Save(dir & "\test.png")
  12.             fncOCR_Text(dir & "\test.png")
  13.             System.IO.File.Delete(dir & "\test.png")
  14.             '  Catch ex As Exception
  15.             'MsgBox("There is something wrong with the image!!!" & vbNewLine & ex.Message, MsgBoxStyle.Exclamation, "ERROR!")
  16.             'End Try
  17.  
  18.         End If
  19.  
  20.     End Sub
  21.  
  22.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  23.         Dim openFileDialog1 As New OpenFileDialog()
  24.         openFileDialog1.InitialDirectory = "c:\"
  25.         openFileDialog1.Filter = "Images (*.*)|*.*"
  26.         openFileDialog1.InitialDirectory = Application.StartupPath
  27.         openFileDialog1.ShowDialog()
  28.         TextBox1.Text = openFileDialog1.FileName
  29.         PictureBox1.ImageLocation = (TextBox1.Text)
  30.     End Sub
  31.  
  32.     Public Function MergeImages(ByVal Pic1 As Image) As Image
  33.  
  34.         Dim MergedImage As Image ' This will be the finished merged image
  35.         Dim bm As New Bitmap(150, 60, PixelFormat.Format32bppArgb)
  36.         Dim gr As Graphics = Graphics.FromImage(bm)
  37.         gr.FillRectangle(New SolidBrush(Color.White), New Rectangle(0, 0, 800, 600))
  38.         gr.DrawImage(Pic1, 0, 0)
  39.         MergedImage = bm
  40.         PictureBox2.Image = MergedImage
  41.         gr.Dispose()
  42.         Return MergedImage
  43.     End Function
  44.  
  45.     Public Function fncOCR_Text(ByVal strImagePath As String) As String
  46.  
  47.         'declaring required variables for OCR
  48.         Dim miDoc As MODI.Document
  49.         Dim miLayout As MODI.Layout
  50.         'Dim strLayoutInfo As String
  51.         Dim strText As String
  52.  
  53.         'Recognizing the Document
  54.         miDoc = New MODI.Document
  55.         miDoc.Create(strImagePath)
  56.         miDoc.Images(0).OCR()
  57.  
  58.         'Storing the value in a variable and returning it
  59.         miLayout = miDoc.Images(0).Layout
  60.         strText = Trim(miLayout.Text)
  61.         fncOCR_Text = strText
  62.         TextBox2.Text = strText
  63.  
  64.  
  65.         'Rleasing the Memory
  66.         miLayout = Nothing
  67.         miDoc = Nothing
  68.     End Function
  69.  
  70.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  71.         Dim miDoc As MODI.Document
  72.         Dim miWord As MODI.Word
  73.         Dim strWordInfo As String
  74.  
  75.         ' Load an existing TIFF file.
  76.         miDoc = New MODI.Document
  77.         miDoc.Create("C:\document1.tif")
  78.  
  79.         ' Perform OCR.
  80.         miDoc.Images(0).OCR()
  81.  
  82.         ' Retrieve and display word information.
  83.         miWord = miDoc.Images(0).Layout.Words(2)
  84.         strWordInfo = _
  85.           "Id: " & miWord.Id & vbCrLf & _
  86.           "Line Id: " & miWord.LineId & vbCrLf & _
  87.           "Region Id: " & miWord.RegionId & vbCrLf & _
  88.           "Font Id: " & miWord.FontId & vbCrLf & _
  89.           "Recognition confidence: " & _
  90.           miWord.RecognitionConfidence & vbCrLf & _
  91.           "Text: " & miWord.Text
  92.         MsgBox(strWordInfo, vbInformation + vbOKOnly, _
  93.           "Word Information")
  94.  
  95.         miWord = Nothing
  96.         miDoc = Nothing
  97.  
  98.     End Sub
  99.  
  100.  
  101.     Private Sub Form9_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  102.  
  103.     End Sub
  104. End Class
  105. [/CODE]


PM Quote
Avatar
LittleHacker (Member)
Guru


Messaggi: 1033
Iscritto: 28/04/2009

Segnala al moderatore
Postato alle 15:52
Venerdì, 26/04/2013
Ma hai letto quello che ti ho scritto?
Non mi sembra, continui a urlare! Non si fa così!
Comunque ho una domanda da farti, il codice che usi ora (MODI) hai fatto copia e incolla da un sito?

PM Quote
Avatar
coyote100 (Normal User)
Rookie


Messaggi: 50
Iscritto: 22/04/2013

Segnala al moderatore
Postato alle 20:58
Venerdì, 26/04/2013
Ma che vuol dire urlare, ho postato un problema.
Se qualcuno è in grado di aiutarmi bene.................bando alle chiacchere...........
Copiare per migliorare ed imparare cose nuove.
Non ha senso costruire una ruota perché esiste già!!!
aa un certo Steve Jobs ha copiato interfaccia grafica alla Xerox.... ops.. copia ed incolla

Cmq se qualcuno è in grado di aiutarmi


PM Quote
Avatar
LittleHacker (Member)
Guru


Messaggi: 1033
Iscritto: 28/04/2009

Segnala al moderatore
Postato alle 21:12
Venerdì, 26/04/2013
Ascolta!
Urlare significa Urlare! Quindi quando scrivi su un forum non usare mai parole maiuscole! Es. Nel primo post urlavi, invece nell'ultimo no!

Ascolta, ok che comunque bisogna imparare in qualche modo, ma copiare e incollare non è mai quello migliore!

Ritornando al problema, quale delle due "miDoc = New MODI.Document" ti evidenzia?


Ultima modifica effettuata da LittleHacker il 26/04/2013 alle 21:13
PM Quote
Avatar
coyote100 (Normal User)
Rookie


Messaggi: 50
Iscritto: 22/04/2013

Segnala al moderatore
Postato alle 9:17
Sabato, 27/04/2013
Si mette in evidenza  "miDoc = New MODI.Document"

PM Quote
Pagine: [ 1 2 3 ] Precedente | Prossimo