附件是一个现成的图像文字识别程序,C#调用OpenCV,原来的程序还能茄晌动态识别摄像头图像里的州纳配文字,册指但我为了简化修改成识别静态图片的了,解压后双击ContourAnalysisDemo.exe运行。
参考资料:
http://www.codeproject.com/Articles/196168/Contour-Analysis-for-Image-Recognition-in-C
新建工程,添加一个picturebox,一个textbox,两个command buttonDim vCode As String
Private Sub Command1_Click()
drawvc
End Sub
Private Sub drawvc() '显示校验码
Dim i, vc, px, py As Long
Dim r, g, b As Byte
Randomize '初始化随机种子
'生成随机校验码
vc = CLng(8999 * Rnd + 1000)
vCode = vc
'显示校验码
Picture1.Cls
Picture1.Print vc
'添加噪点(颤斗防止自衫晌动图像识别)
For i = 0 To 2000 '茄塌磨画2000个噪点
'画点随机位置
px = CLng(Picture1.Width * Rnd)
py = CLng(Picture1.Height * Rnd)
'画点随机颜色
r = CByte(255 * Rnd)
g = CByte(255 * Rnd)
b = CByte(255 * Rnd)
Picture1.Line (px, py)-(px + 1, py + 1), RGB(r, g, b)
Next
End Sub
Private Sub Command2_Click()
If Text1.Text = vCode Then
MsgBox ("正确")
Else
MsgBox ("错误")
drawvc
End If
End Sub
Private Sub Form_Load()
Picture1.FontSize = 12
Picture1.FontBold = True
Picture1.AutoRedraw = True
drawvc
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)