本文主要是介绍移动梦网2005版图形码识别vb.net2003源代码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
因为涉及到商业软件,所以要等过期以后才发布出来。
2005年4月初,识别入门的时候写的,代码不好,凑合着看吧。
要点:
1.去背景:这个图形码的背景色和文字色是有规律的,所以很好去背静
2.分割随即位置的字符,方法:http://blog.csdn.net/Qqwwee_Com/archive/2006/04/14/662505.aspx
Imports System.Net
Imports System.Drawing


Public Class CrMonterNetImg Class CrMonterNetImg

Private ImgUrl As String
Private Cookie As System.Net.CookieCollection

Sub New()Sub New(ByVal StrUrl As String, ByVal Cookies As System.Net.CookieCollection)
ImgUrl = StrUrl
Cookie = Cookies
End Sub


识别:返回数字!#Region "识别:返回数字!"

Public Function proc()Function proc() As String
Dim Img As Bitmap
Dim cc(1) As Color
Dim Va As Array
Dim IntRang As Integer '检查图象分段

Dim IntS(4) As Integer '左边
Dim IntE(4) As Integer '右边
Dim T(4) As Integer '上面
Dim B(4) As Integer '下面
Dim StrCode As String = ""
Try
While Not IntRang = 4
Img = crImg() '抓取图片

cc = GetDeepColor(Img) '得到深浅色
FormatImg(Img, cc) '去背景色+单色显示
Va = GetV(Img)
IntRang = chkImg(Va, IntS, IntE)
End While
getTB(Img, IntS, IntE, T, B)
StrCode = crImg(Img, IntS, IntE, T, B)

Img.Dispose()

Catch ex As Exception
Finally
If Not Img Is Nothing Then
Img.Dispose()
End If
End Try

Return StrCode

End Function
#End Region


加载图片数据#Region "加载图片数据"

Private Function crImg()Function crImg() As Bitmap
Dim 请求 As Net.HttpWebRequest
Dim 响应 As Net.HttpWebResponse
Dim img As System.Drawing.Bitmap
Try
请求 = Net.HttpWebRequest.Create(ImgUrl)
这篇关于移动梦网2005版图形码识别vb.net2003源代码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!