图形密码比较图像

问题描述

有人可以告诉我如何处理它,因为这个 vb.net 不是真的用于图形,真的希望有人能给我解决方案,因为我现在已经死了想想哈哈哈

我遇到这个问题 ExternalException was unhandled 使用 vb.net express 2010 做图像比较密码

bmp.Save("C:\Users\admin\Pictures\G raphical Password\CompareImage.png",Imaging.ImageFormat.Png)

总是出现这个问题


Private Sub cmdCompare_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles cmdCompare.Click

        pbDraw.DrawToBitmap(bmp,New Rectangle(567,325,pbDraw.Width,pbDraw.Height))
        bmp.Save("C:\Users\admin\Pictures\G raphical Password\CompareImage.png",Imaging.ImageFormat.Png)
        bmp = New Bitmap(pbDraw.Width,pbDraw.Height)

        Dim bmp1 As Bitmap = Image.FromFile("C:\Users\admin\Pictures\Graphical Password\CompareImage.png")
        Dim bmp2 As Bitmap = Image.FromFile("C:\Users\admin\Pictures\Graphical Password\ImagePassword.png")


        Dim sameCount As Integer = 0
        Dim diffCount As Integer = 0

        For x As Integer = 0 To (bmp1.Width) - 1
            For y As Integer = 0 To (bmp1.Height) - 1
                If bmp1.GetPixel(x,y).Equals(bmp2.GetPixel(x,y)) Then
                    sameCount += 1
                Else
                    diffCount += 1
                End If
            Next
        Next

        Dim total As Integer = sameCount + diffCount

        Dim compare As Double = 0.9
        Dim totalSame As Double = sameCount / total
        Dim totalDiff As Double = diffCount / total

        MessageBox.Show(String.Format("Same Percentage: {0}{1}Difference Percentage: {2}",_
                                      (totalSame).ToString("p"),Environment.NewLine,(totalDiff).ToString("p")))

        If totalSame > compare Then
            Me.Hide()
            frmMain.Show()

        ElseIf totalSame < compare Then
            MessageBox.Show("Password not match,try again")


        End If

        'IO.File.Delete("C:\Users\admin\Pictures\Graphical Password\CompareImage.png")
   End Sub

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)