微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

图形密码比较图像

如何解决图形密码比较图像

有人可以告诉我如何处理它,因为这个 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 举报,一经查实,本站将立刻删除。