【发布时间】:2021-12-04 14:59:01
【问题描述】:
我正在使用 Emgu 从图像中提取字符串,但我在最后一步(识别)中遇到了问题,请帮帮我..
我在代码中输入了问题消息作为评论
代码:
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", OcrEngineMode.Default)
Dim pic As Bitmap = New Bitmap(270, 100)
Dim gfx As Graphics = Graphics.FromImage(pic)
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
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
PictureBox1.Image = Nothing
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim img As New Image(Of Bgr, Byte)(pic) 'try another way to solve the problem
OCRz.Recognize(pic) 'not work: Too many arguments to 'Public Function Recognize() As Integer.
OCRz.Recognize(img) 'not work: Too many arguments to 'Public Function Recognize() As Integer.
OCRz.Recognize(New Image(Of Bgr, Byte)(pic)) 'not work: Overload resolution failed because of no accessible_
'New' can be called with these arguments.
'Public Sub New(channels() As Emgu.CV.Image(Of Emgu.CV.Structure.Gray, Byte))' Value of type Bitmap cannot_
be converted to 1-dimensional array of Emgu.CV.Image(Of Emgu.CV.Structure.Gray, Byte.
RichTextBox1.Text = OCRz.GetBoxText
End Sub
End Class
【问题讨论】:
-
现在可以了,非常感谢..我用旧方法和新版本,这就是问题..再次感谢您。
标签: vb.net image text extract emgucv