掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
静止画の文字認識 (ID:100724)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Office 2003 / Office 2007 の OCR 機能を使うとか。 http://msdn.microsoft.com/en-us/library/aa167607%28office.11%29.aspx "Microsoft Office Document Imaging *.* Type Library" を参照設定: '---------------------- Option Explicit Private WithEvents D As MODI.Document Private hasCancelRequest As Boolean Private Sub Command2_Click() hasCancelRequest = True End Sub Private Sub Form_Load() Me.Caption = App.EXEName Text1.Text = "C:\test.jpg" Command1.Caption = "OCR" Command2.Caption = "キャンセル" Command2.Enabled = False hasCancelRequest = False Combo1.Clear Combo1.AddItem "English" Combo1.ItemData(0) = miLANG_ENGLISH Combo1.AddItem "日本語" Combo1.ItemData(1) = miLANG_JAPANESE Combo1.ListIndex = 0 End Sub Private Sub D_OnOCRProgress(ByVal Progress As Long, Cancel As Boolean) Cancel = hasCancelRequest If Cancel Then Me.Caption = "キャンセル" Else Me.Caption = CStr(Progress) & "%" End If End Sub Private Sub Command1_Click() Command1.Enabled = False Set D = New MODI.Document D.Create Text1.Text Dim i As MODI.Image Set i = D.Images(0) Set Picture1.Picture = i.Picture Command2.Enabled = True hasCancelRequest = False On Error Resume Next i.OCR Combo1.ItemData(Combo1.ListIndex) If Err.Number <> 0 Then MsgBox "&H" & Hex(Err.Number) & Err.Description, vbExclamation, Err.Source Else If Not hasCancelRequest Then Me.Caption = App.EXEName End If Text2.Text = i.Layout.Text ShowResult i.Layout.Words End If Command1.Enabled = True Command2.Enabled = False End Sub Private Sub ShowResult(ByVal Words As MODI.Words) Dim wd As MODI.Word Dim w As Integer For w = 0 To Words.Count - 1 Set wd = Words(w) List1.AddItem CStr(w + 1) & ":" & wd.Text Dim r As MODI.MiRect For Each r In wd.Rects Dim s As String s = "(" & CStr(r.Left) & "," & CStr(r.Top) & ")-" s = s & "(" & CStr(r.Right) & "," & CStr(r.Bottom) & ")" List1.AddItem vbTab & s Next Next End Sub
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.