文号
t16238
阅读
4611
回复
7
收藏
3
【图像操作】修复一些点
2009/06/21
IP:广东
第一个函数是修复图像中缺少的点 (4方向)
输入:
1  图像的二维数组 (二值)
2  阈值 要具体测试,使用0~5之间的阈值获得最佳效果

return nothing
图像的二维数组被直接操作

    Public Function FixPoints(ByVal PicAInput(,) As Integer, ByVal L As Integer)
        Dim i, j As Integer
        Dim Tmp_Count As Integer
        For i = 1 To 50
            For j = 1 To 50
                'If PicAInput(i, j) = 1 Then Tmp_Count += 1
                If PicAInput(i + 1, j) = 1 Then Tmp_Count += 1
                If PicAInput(i - 1, j) = 1 Then Tmp_Count += 1
                If PicAInput(i, j + 1) = 1 Then Tmp_Count += 1
                If PicAInput(i, j - 1) = 1 Then Tmp_Count += 1
                If Tmp_Count > L Then
                    PicAInput(i, j) = 1
                End If
                Tmp_Count = 0
            Next
        Next
        Return Nothing
    End Function


函数2
输入同上,不过是修复独立的点 (对验证码中的干扰线有去除功能

    Public Function FixSpoint(ByVal PicAInput(,) As Integer, ByVal L As Integer)
        Dim i, j As Integer
        Dim Tmp_Count As Integer
        For i = 1 To 50
            For j = 1 To 50
                'If PicAInput(i, j) = 1 Then Tmp_Count += 1
                If PicAInput(i + 1, j) = 0 Then Tmp_Count += 1
                If PicAInput(i - 1, j) = 0 Then Tmp_Count += 1
                If PicAInput(i, j + 1) = 0 Then Tmp_Count += 1
                If PicAInput(i, j - 1) = 0 Then Tmp_Count += 1
                If Tmp_Count > L Then
                    PicAInput(i, j) = 0
                End If
                Tmp_Count = 0
            Next
        Next
        Return Nothing
    End Function
+197
科创币
delete
2009/06/21
17年7个月前IP:未同步
112032
1楼
第一个过滤白点,第二个过滤黑点。不用每个教程都给你加注释吧……
引用
评论
17年7个月前IP:未同步
112033
2楼
请upload效果图帮助同学们理解。
引用
评论
93°作者
17年7个月前IP:未同步
112149
3楼
原图 chekc1.png

函数一

chekc2.png

函数二

chekc3.png
引用
评论
93°作者
17年6个月前IP:未同步
126106
4楼
我上来找资料。

看来我还是建立个库比较好……
引用
评论
17年6个月前IP:未同步
126115
5楼
用什么方法来区别空白地方和字体本身?
引用
评论
93°作者
17年6个月前IP:未同步
126131
6楼
LS不及格。

Public Function ColorRGB(ByVal Color As Long) As Long
If Color = -1 Then ColorRGB = 999: Exit Function
Const ByN As Integer = 256
Const ByN2 As Long = 65536
Dim A(2) As Byte
A(0) = (Color Mod ByN)
A(1) = ((Color Mod ByN2) \\ ByN)
A(2) = (Color \\ ByN2)

ColorRGB = (Color Mod ByN) + ((Color Mod ByN2) \\ ByN) + (Color \\ ByN2)
End Function

https://www.kechuang.org/t/12553
引用
评论
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的