[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage
[VB6] Compare two images in percentage [VB6] Compare two images in percentage
[VB6] Compare two images in percentage
Go Back  Xtreme Visual Basic Talk > > > [VB6] Compare two images in percentage


Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2014, 10:29 PM
minhduc minhduc is offline
Newcomer
 
Join Date: Jul 2014
Posts: 2
Question [VB6] Compare two images in percentage


I found a project that compare two images in the fast way but I want it to show exactly the percentage that one matches the other. I would appreciate if you help me work out the problem. Thank you in advance, here is the project :
CompareImages.zip

Last edited by minhduc; 07-29-2014 at 11:02 PM.
Reply With Quote
  #2  
Old 07-30-2014, 05:56 AM
Cerian Knight's Avatar
Cerian Knight[VB6] Compare two images in percentage Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,199
Default

To get you started, I've modified the comparison function to calculate and return the percent difference (rather than a Boolean):
Code:
Private Function ComparePixels() As Double
    Dim lonU1 As Long, lonU2 As Long
    Dim lonLoop As Long
    Dim dblCnt As Double
    lonU1 = UBound(lonPix_1())
    lonU2 = UBound(lonPix_2())
    
    If lonU1 = lonU2 and lonU1 > 0 Then 'handle only real images that are same size
        For lonLoop = LBound(lonPix_1()) To lonU1
            If lonPix_1(lonLoop) <> lonPix_2(lonLoop) Then
                dblCnt = dblCnt + 1 'count bad pixels
            End If
        Next lonLoop
        'Calculate bad pixels as a fraction of total and convert to percent
        ComparePixels = dblCnt / (lonU1 - LBound(lonPix_1()) + 1) * 100
    Else
        ComparePixels = 100 'you could make this -1 to flag images are not the same size
    End If
    
End Function
You'll have to modify the calling functions to handle the Double that is returned.
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').

Last edited by Cerian Knight; 07-30-2014 at 06:02 AM.
Reply With Quote
  #3  
Old 07-30-2014, 10:43 AM
minhduc minhduc is offline
Newcomer
 
Join Date: Jul 2014
Posts: 2
Default

Thank you very much, it works like a charm
Reply With Quote
  #4  
Old 11-14-2016, 10:39 PM
romanc5 romanc5 is offline
Newcomer
 
Join Date: Nov 2016
Posts: 1
Default help

there is any way to show the difference percentage in text1.text
Reply With Quote
  #5  
Old 11-15-2016, 02:12 AM
Flyguy's Avatar
Flyguy[VB6] Compare two images in percentage Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,165
Default

The function returns a value, which you can show in textbox or whatever.
Reply With Quote
Reply

Tags
compare images, in percentage, vb6


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage [VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage [VB6] Compare two images in percentage
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
 
[VB6] Compare two images in percentage
[VB6] Compare two images in percentage
 
-->