|
-
Apr 24th, 2005, 08:09 PM
#1
Thread Starter
Fanatic Member
Image Comparison
hi buddies..
i wanna need help about
is there possible to compare to images in VB6.
if yes then
can we tell in % ...
like
100 % same
75 % same ......
-
Apr 24th, 2005, 08:45 PM
#2
-
Apr 24th, 2005, 09:11 PM
#3
Re: Image Comparison
If you were to compare images of the same size, you would do something like this:
VB Code:
Option Explicit
Private Type Picture_Type
Size As Long
Width As Long
Height As Long
End Type
Private Sub Command1_Click()
Dim Pic(1) As Picture_Type
Dim X As Long, Y As Long
Dim Is_The_Same As Long
Dim Comparison As Single
With Picture1
.BorderStyle = False
.Picture = LoadPicture("C:\Jacob's Stuff\Pics\Alice.jpg")
.AutoSize = True
.AutoRedraw = True
.ScaleMode = 3
End With
With Picture2
.BorderStyle = False
.Picture = LoadPicture("C:\Jacob's Stuff\Pics\whiterabbit.jpg")
.AutoSize = True
.AutoRedraw = True
.ScaleMode = 3
End With
With Pic(0)
.Size = Picture1.ScaleWidth * Picture1.ScaleHeight
.Width = Picture1.ScaleWidth
.Height = Picture1.ScaleHeight
End With
With Pic(1)
.Size = Picture2.ScaleWidth * Picture1.ScaleHeight
.Width = Picture2.ScaleWidth
.Height = Picture2.ScaleHeight
End With
If Pic(0).Size = Pic(1).Size Then
For Y = 0 To Pic(0).Height - 1
For X = 0 To Pic(0).Width - 1
If Picture1.Point(X, Y) = Picture2.Point(X, Y) Then
Is_The_Same = Is_The_Same + 1
End If
Next X
Next Y
Comparison = (Is_The_Same / Pic(0).Size) * 100
MsgBox "Both images are " & Comparison & "% the same", vbInformation
Else
MsgBox "The pictures are not the same size, so no comparison will be made.", vbCritical
End If
That's funny. Deja Vu
Last edited by Jacob Roman; Apr 24th, 2005 at 09:16 PM.
-
Apr 24th, 2005, 09:17 PM
#4
Re: Image Comparison
Well, sure, if they're the same size, and color depth, then you could. You could also mask them both to get a more accurate view. In the other thread they said that the images were different sizes.
-
Apr 25th, 2005, 06:29 AM
#5
Thread Starter
Fanatic Member
Re: Image Comparison
Thanks RhinO
but i want to compare two pictures in very real sense.
like
Picture is same ...
but One is coloured
and other is Black & White ..
So when i will compare program should say that pictures LOOK TO BE SAME
I do not want to compare COLORS only ....
-
Apr 25th, 2005, 08:41 AM
#6
Re: Image Comparison
Rhino?
-
Apr 25th, 2005, 09:33 AM
#7
Addicted Member
Re: Image Comparison
I'd like to mention that if the image was offsetted by as much as one pixel, Jake's approach will likely say it's very different(especially if JPG, since the actual pixels aren't the same even if they were before compression).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|