Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / artificial-intelligence / machine-learning

Faster Image Comparison iJS Algorithm for opencv

4.00/5 (7 votes)
1 Nov 2015CPOL2 min read 16K  
Faster image matching or comparison in large set of categorized images or training set in machine learning

Introduction

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.

Background

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.

Algorithm

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

Conclusion

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

Drawbacks

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

Technology

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.

History

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

License

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