以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]怎样循环多文件进行OCR识别 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=117057) |
-- 作者:jyh7081 -- 发布时间:2018/4/4 20:49:00 -- [求助]怎样循环多文件进行OCR识别 原贴:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=108960&authorid=0&page=0&star=3 识别代码: Dim doc = CreateObject("MODI.Document") doc.Create("d:\\test.jpg") doc.OCR(2052, True, True) For i As Integer = 0 To doc.Images.count - 1 Dim layout = doc.images(i).Layout output.show(layout.text) Next i doc.close doc = Nothing 我在窗口放入一个ListBox1控件,拖进多个图片文件,控件显示的是图片的全路径地址。 怎样循环ListBox1中的文件逐个进行识别,然后将识别的全部图片结果,每张之间用空行隔开合并显示。 谢谢! Dim lst As WinForm.ListBox lst = e.Form.Controls("ListBox1") For i As Integer = 0 To lst.Items.Count - 1 ...... Next |
-- 作者:有点甜 -- 发布时间:2018/4/4 20:58:00 -- Dim lst As WinForm.ListBox lst = e.Form.Controls("ListBox1") For i As Integer = 0 To lst.Items.Count - 1 Dim doc = CreateObject("MODI.Document") doc.Create(lst.items(i)) doc.OCR(2052, True, True) For ii As Integer = 0 To doc.Images.count - 1 Dim layout = doc.images(ii).Layout output.show(layout.text) Next doc.close doc = Nothing Next |
-- 作者:jyh7081 -- 发布时间:2018/4/6 20:06:00 -- 老师,怎样把 output.show(layout.text)值写入文本框,只写入了最后一个识别的值。 Dim lst As WinForm.ListBox lst = e.Form.Controls("ListBox1") For i As Integer = 0 To lst.Items.Count - 1 Dim doc = CreateObject("MODI.Document") doc.Create(lst.items(i)) doc.OCR(2052, True, True) For ii As Integer = 0 To doc.Images.count - 1 Dim layout = doc.images(ii).Layout ’output.show(layout.text) e.Form.Controls("TextBox1").value = layout.text & lst.items(i) & vbcrlf
Next doc.close doc = Nothing Next |
-- 作者:有点蓝 -- 发布时间:2018/4/7 8:38:00 -- e.Form.Controls("TextBox1").value = e.Form.Controls("TextBox1").value & layout.text & lst.items(i) & vbcrlf |