Oppure

Loading
25/04/13 7:39
coyote100
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.

aaa
25/04/13 14:56
LittleHacker
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!

lmgtfy.com/
aaa
25/04/13 17:19
coyote100
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
aaa
26/04/13 6:49
coyote100
EVENTUALMENTE C'E' UN SISTEMA IN VB 2008 PER CONVERTIRE LE IMMAGINI IN TESTO ALTERNATIVO A OCR.

GRAZIE
aaa
26/04/13 12:07
coyote100
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




[CODE]Imports System.Drawing.Imaging

Public Class Form9
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dir As String = Environment.SystemDirectory
If TextBox1.Text = "" Then
MsgBox("Please, Pick the desired image first!!!", MsgBoxStyle.Information, "No Image Selected";)
Else
'Try
MergeImages(PictureBox1.Image)
PictureBox2.Image.Save(dir & "\test.png";)
fncOCR_Text(dir & "\test.png";)
System.IO.File.Delete(dir & "\test.png";)
' Catch ex As Exception
'MsgBox("There is something wrong with the image!!!" & vbNewLine & ex.Message, MsgBoxStyle.Exclamation, "ERROR!";)
'End Try

End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = "c:\"
openFileDialog1.Filter = "Images (*.*)|*.*"
openFileDialog1.InitialDirectory = Application.StartupPath
openFileDialog1.ShowDialog()
TextBox1.Text = openFileDialog1.FileName
PictureBox1.ImageLocation = (TextBox1.Text)
End Sub

Public Function MergeImages(ByVal Pic1 As Image) As Image

Dim MergedImage As Image ' This will be the finished merged image
Dim bm As New Bitmap(150, 60, PixelFormat.Format32bppArgb)
Dim gr As Graphics = Graphics.FromImage(bm)
gr.FillRectangle(New SolidBrush(Color.White), New Rectangle(0, 0, 800, 600))
gr.DrawImage(Pic1, 0, 0)
MergedImage = bm
PictureBox2.Image = MergedImage
gr.Dispose()
Return MergedImage
End Function

Public Function fncOCR_Text(ByVal strImagePath As String) As String

'declaring required variables for OCR
Dim miDoc As MODI.Document
Dim miLayout As MODI.Layout
'Dim strLayoutInfo As String
Dim strText As String

'Recognizing the Document
miDoc = New MODI.Document
miDoc.Create(strImagePath)
miDoc.Images(0).OCR()

'Storing the value in a variable and returning it
miLayout = miDoc.Images(0).Layout
strText = Trim(miLayout.Text)
fncOCR_Text = strText
TextBox2.Text = strText


'Rleasing the Memory
miLayout = Nothing
miDoc = Nothing
End Function

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim miDoc As MODI.Document
Dim miWord As MODI.Word
Dim strWordInfo As String

' Load an existing TIFF file.
miDoc = New MODI.Document
miDoc.Create("C:\document1.tif";)

' Perform OCR.
miDoc.Images(0).OCR()

' Retrieve and display word information.
miWord = miDoc.Images(0).Layout.Words(2)
strWordInfo = _
"Id: " & miWord.Id & vbCrLf & _
"Line Id: " & miWord.LineId & vbCrLf & _
"Region Id: " & miWord.RegionId & vbCrLf & _
"Font Id: " & miWord.FontId & vbCrLf & _
"Recognition confidence: " & _
miWord.RecognitionConfidence & vbCrLf & _
"Text: " & miWord.Text
MsgBox(strWordInfo, vbInformation + vbOKOnly, _
"Word Information";)

miWord = Nothing
miDoc = Nothing

End Sub


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

End Sub
End Class
[/CODE]
aaa
26/04/13 13:52
LittleHacker
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?
aaa
26/04/13 18:58
coyote100
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

aaa
26/04/13 19:12
LittleHacker
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 26/04/13 19:13
aaa