Ich versuche verzweifelt mit Tessnet2 aus einem Bild den Text zu lesen der Text soll dann in der Textbox1 ausgegeben werden.
In der Demo klappt das auslesen des Bilds aber bei mir kommt schon beim starten die folgende Fehlermeldung:
Spoiler anzeigen
Der Verweis auf die Tessnet2_64.dll ist gesetzt und ich habe einfach keine Idee mehr woran es scheitert.
Ich versuche das ganze mit folgendem:
Infos und den Download von Tessnet2 gibts übrigengs hier pixel-technology.com/freeware/tessnet2/
In der Demo klappt das auslesen des Bilds aber bei mir kommt schon beim starten die folgende Fehlermeldung:
System.BadImageFormatException wurde nicht behandelt.
Message=Die Datei oder Assembly "tessnet2_64, Version=2.0.4.0, Culture=neutral, PublicKeyToken=1550524b5ba07e29" oder eine Abhängigkeit davon wurde nicht gefunden. Es wurde versucht, eine Datei mit einem falschen Format zu laden.
Source=Freicode
FileName=tessnet2_64, Version=2.0.4.0, Culture=neutral, PublicKeyToken=1550524b5ba07e29
FusionLog==== Zustandsinformationen vor Bindung ===
LOG: Benutzer = Malte-PC\Malte
LOG: DisplayName = tessnet2_64, Version=2.0.4.0, Culture=neutral, PublicKeyToken=1550524b5ba07e29
(Fully-specified)
LOG: Appbase = file:///C:/Users/Malte/documents/visual studio 2010/Projects/Freicode/Freicode/bin/Debug/
LOG: Ursprünglicher PrivatePath = NULL
Aufruf von Assembly : Freicode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: Diese Bindung startet im default-Load-Kontext.
LOG: Es wurde keine Anwendungskonfigurationsdatei gefunden.
LOG: Die Hostkonfigurationsdatei wird verwendet:
LOG: Die Computerkonfigurationsdatei von C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config wird verwendet.
LOG: Verweis nach der Richtlinie: tessnet2_64, Version=2.0.4.0, Culture=neutral, PublicKeyToken=1550524b5ba07e29
LOG: Download von neuem URL file:///C:/Users/Malte/documents/visual studio 2010/Projects/Freicode/Freicode/bin/Debug/tessnet2_64.DLL.
ERR: Das Setup der Assembly konnte nicht abgeschlossen werden (hr = 0x8007000b). Die Suche wurde beendet.
StackTrace:
bei Freicode.Form1.Button2_Click(Object sender, EventArgs e)
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(ApplicationContext context)
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
bei Freicode.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
Der Verweis auf die Tessnet2_64.dll ist gesetzt und ich habe einfach keine Idee mehr woran es scheitert.
Ich versuche das ganze mit folgendem:
VB.NET-Quellcode
- Dim image As Bitmap = New Bitmap("C:\test.jpg")
- Dim ocr As New tessnet2.Tesseract
- ocr.Init("C:\...Pfad zum tessdata Ordner...\tessdata", "deu", False)
- Dim result As List(Of tessnet2.Word) = ocr.DoOCR(image, Rectangle.Empty)
- For Each word As tessnet2.Word In result
- TextBox1.Text = TextBox1.Text & word.Text
- Next
Infos und den Download von Tessnet2 gibts übrigengs hier pixel-technology.com/freeware/tessnet2/