vb中在picturebox控件中先画点,后给各点赋像素值,在picturebox中显示图像。程序如下
为什么显示的图像和数据不符?PrivateSubc1_Click()DimwAsDoubleDimStrLineAsString,a()AsString,p(1000,1...
为什么显示的图像和数据不符?
Private Sub c1_Click()
Dim w As Double
Dim StrLine As String, a() As String, p(1000, 1000) As String, i As Long, j As Long
Open "e:\aa.txt" For Input As #1
j = -1
Do Until EOF(1)
j = j + 1
Line Input #1, StrLine
If StrLine <> "" Then
a() = Split(StrLine, " ")
For i = 0 To Text1
p(i, j) = a(j)
Next
End If
Loop
Close #1
For i = 0 To Text1
For j = 0 To Text2
Print p(i, j)
w = Val(p(i, j))
If w Then
Picture1.PSet (i, j), vbBlack
Else
Picture1.PSet (i, j), vbRed
End If
Next j
Next i
Dim iWidth As Integer
Dim iHeight As Integer
iWidth = Text1 '位图宽度
iHeight = Text2 '位图高度
End Sub 展开
Private Sub c1_Click()
Dim w As Double
Dim StrLine As String, a() As String, p(1000, 1000) As String, i As Long, j As Long
Open "e:\aa.txt" For Input As #1
j = -1
Do Until EOF(1)
j = j + 1
Line Input #1, StrLine
If StrLine <> "" Then
a() = Split(StrLine, " ")
For i = 0 To Text1
p(i, j) = a(j)
Next
End If
Loop
Close #1
For i = 0 To Text1
For j = 0 To Text2
Print p(i, j)
w = Val(p(i, j))
If w Then
Picture1.PSet (i, j), vbBlack
Else
Picture1.PSet (i, j), vbRed
End If
Next j
Next i
Dim iWidth As Integer
Dim iHeight As Integer
iWidth = Text1 '位图宽度
iHeight = Text2 '位图高度
End Sub 展开
4个回答
展开全部
如果只是想画一条线,建议使用 line 函数。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
数据想表达什么样的意思?
追问
就是想让摄像头照图像,然后将二值化后的数据(就是0和1,一黑一白)存入sd卡中,再将数据导入我编的软件,显示出图像,看看和现实图像哪里不同,哪里需要滤波。就是这样。但是我编的程序不知道哪里不对。图像和数据不对应。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
邮箱已发,,选最佳爱爱爱
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询