我对bmp 图遍历一次 就能把对应浓度值得点 计数
我现在能直接得到 对应点的浓度值 dim a(256)
for a=1 to 256
a(x)=0
For i = 0 To lWidth - 1 '统计像素个数
For j = 0 To lHeight - 1
if orgdata(i,j)=x then 点的浓度值 x
a(x)=a(x)+1 数组中对应的元素
end if
next
next我现在的问题的不只到怎么能让数组中的元素和 浓度值对应 计数
我现在能直接得到 对应点的浓度值 dim a(256)
for a=1 to 256
a(x)=0
For i = 0 To lWidth - 1 '统计像素个数
For j = 0 To lHeight - 1
if orgdata(i,j)=x then 点的浓度值 x
a(x)=a(x)+1 数组中对应的元素
end if
next
next我现在的问题的不只到怎么能让数组中的元素和 浓度值对应 计数
http://community.csdn.net/Expert/topic/4865/4865373.xml?temp=.9388697
Private Declare Function SendMessagebyString Lib _
"user32" Alias "SendMessageA" (ByVal hWND As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As String) As LongPrivate Const LB_FINDSTRINGEXACT = &H1A2 '在 ListBox 中精确查找
Dim p As LongList1.Clear
For i = 0 To lWidth - 1
For j = 0 To lHeight - 1
p = SendMessage(List1.hWnd, LB_FINDSTRINGEXACT, -1, CStr(orgdata(i,j)))
If p >= 0 Then
List1.ItemData(p) = List1.ItemData(p) + 1 '数组中对应的元素
Else
List1.AddItem CStr(orgdata(i,j))
List1.ItemData(p) = 1
End If
Next j
Next i'这样,List1 中的 List 项就是像素浓度,对应的 ItemData 就是频数。
For i = 0 To List1.Listcount - 1
Debug.print List1.List(i), List1.ItemData(i)
Next i