Click here to Skip to main content
15,113,086 members
Articles / Artificial Intelligence / Machine Learning
Posted 1 Nov 2015


5 bookmarked

Faster Image Comparison iJS Algorithm for opencv

Rate me:
Please Sign up or sign in to vote.
4.00/5 (7 votes)
1 Nov 2015CPOL2 min read
Faster image matching or comparison in large set of categorized images or training set in machine learning


This algorithm is introduced to achieve faster image matching or comparison in large set of categorized images or training set in machine learning [ opencv C++ with Surf ]. This algorithm was implemented by Mr. Johnson Augustine, Sr. Research Developer and CTO of Airo global Software Pvt Ltd and Mr.Stephin Francis, Sr. Developer Airo global Software Pvt Ltd with opencv, C++ linux platfroms.


When we have a large set of images, the comparison to find the best matching is difficult, it took a lot of time to compare a large set of training images, so I tried to find out a logic.


When we implement machine learning algorithms to compare or match images to find most matching images, we will have two set of modules:

  1. Add training set for image to train the system
  2. Search or matching

Add Training Set for Image to Train the System

This is the first step of the algorithm we add training images to database and the main thing is the training set should have minimum 5 images, we will compare between images in training set in storage and we will make index for images as per the matching confidence interval in ascending order.

Process flow

Fig (1.1)

In this, Image 1 has some similarities to image 2 and image 2 has some similarities to image 3 and so on. So when we store image, we will compare to each image and update the index values. This algorithm is giving focus to image search speed and matching speed.

Search or Matching

To match image faster, we will do the following:

  1. Input image
  2. Select the first image inside the image category and compare with input
  3. If first image matches, then got the result
  4. Else we will store the confidence interval of match
  5. And compare with 5th image after the first image, if confidence interval is > previous image, then will compare the next 5th image in the position
  6. If image confidence level is less than previous confidence level, we will select the previous one and compare with Previous + 1 image and if again greater is the confidence level we will select Previous +2 else select the image and respond result

Process flow

Fig 1.2


It is easy to discard large set of image comparisons and find the related image faster.


  • Adding training set images takes time to process
  • Needs mimimum 5 number of training set images


C++, opencv, machine Learning, Data mining, Artificial Intelligence

Points of Interest

When I try to compare 1000 images to find a best match, I reached this algorithm.


I just made this algorithm and used in few tasks and it seems to be working fine.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Johnson Augustine
CEO Airo Global Software Pvt Ltd
India India
I am a Business man as well as Tech Guy and having 8 + of experience in programming and have knowledge and hands own experience in the following platforms and technologies

Embedded System Development
C,C++,Linux C++,C++/CLI,Mono frame work,Raspberry PI Embedded programming,Open MAX

Windows Based Applications
VC++,Managed C++, VB,, ,Java,Com,Device Driver,File System Driver,Plugin Development,Directx

Web Technologies
************************,MVC,PHP,JSP,Html5, Jquery, Javascript,Ajax,CSS JSON,JSP, Dream-viewer,Photoshop

Content Management
Word Press, Joomla,Magneto

Linux And Open Source Technologies
QT++,Mono Frame Work,Linux shell scripting ,JAVA

MAC OSx / IPhone/IPad,
Apple authorised Safari,MAC,IOS developer .Xcode,QT C++,Objective c

Mobile Technologies
IOS(iPhone) ,Android , Windows Mobile APP,Nokia Symbian,Mobile Ethical Hacking

Server and Hosting Technologies
Windows Server2003,2008,IIS7.5,Linux Server Cent OS,Apache, Plesk (All versions),Cpanel,Dot net panel,HSphere,Server Security,Server Migration Expert.

Ethical Hacking and Certifications
Trained Ethical hacker and Anti Hacking Solution Developer and Annalist .Data Recovery Expert ,Security Penetration testing : metasploit Penetration , Packet filtering and Decryption,Traffic analysis,Vulnerability Assessment,Dynamic App development for security.DB Hijacking

Data Base Technologies
MS SQL,MS Access, MySQL,Oracle,SQLLite.

Networking And System Config

Server Configuration And Setup, Network Setup,VPN Setup, Live video streaming , Audio Streaming , Streaming servers .Packet Filter

Comments and Discussions

GeneralMy vote of 5 Pin
kukkudan993-Nov-15 4:08
Memberkukkudan993-Nov-15 4:08 
PraiseGood article Pin
kukkudan993-Nov-15 4:07
Memberkukkudan993-Nov-15 4:07 
GeneralMy vote of 4 Pin
Phebous2-Nov-15 17:44
MemberPhebous2-Nov-15 17:44 
GeneralMy vote of 5 Pin
kondadu1-Nov-15 23:13
Memberkondadu1-Nov-15 23:13 
GeneralMy vote of 5 Pin
Member 119902761-Nov-15 21:14
MemberMember 119902761-Nov-15 21:14 
GeneralMy vote of 5 Pin
Member 119902761-Nov-15 21:14
MemberMember 119902761-Nov-15 21:14 
QuestionThere is nothing here! Pin
Warrick Procter1-Nov-15 21:04
MemberWarrick Procter1-Nov-15 21:04 
Brilliant. This could equally serve as a dissertation on the Euro refugee problems and man's inhumanity to man Smile | :)
I look forward to enlightenment.
Troft not lest ye be sponned on the nurg! (Milligan)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.