# Finding Similarity Between Images

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Environment: MFC

Content-Based Image Retrieval (CBIR) is a way to index or find a similarity between images in a multimedia database. There are methods such as Fourier Transform, Hough Transform, Wavelet Transform, Gabor Transform, and Hadamard transform coefficients to be used as the engine in the CBIR system. Retrieval by image content has received great attention in the last decades. Several techniques have been proposed to solve the problem of finding or indexing images based on their contents. Each method used have strong and weak points.

In this article, I try to give a sight view about CBIR because this kind of topic is the most frequently asked question in Digital Image Processing. Here I used the CxImage library from Davide Pizzolato. The latest version of CxImage library contains a function to transform an image into its frequency domain; that is, the FFT2() function. The technique I used here is not really efficient, but at least will be a guide for you to learn more advanced CBIR. If you want more efficient method try to follow this link:

http://debut.cis.nctu.edu.tw/pages/slides/jeffrey/present2.pdf
.

There are four steps to performing image retrieval based on their similarity:

1. Load Query Image (the image we want to search for or find images similar to this).
2. Generate Signature of Key Image using Fourier Transform.
3. For every image in the database, load and generate the signature.
4. Calculate Euclidean Distance for Key Image Signature and Database Image Signature.
5. Put the value in an auto-sorted listbox to make similarity investigation easier because the smallest value stays in the top of the list and steps down for similar images.

The image similarity depends on Euclidean Distance. The smaller the distance, the more similiar the image. In measuring similarity, there are few famous math formulas such as Dice similarity coefficients, Jackard, Otsuka, Simpson, Manhattan, Robinson, and more.

The libraries used are:

That’s all there is to it!

Danang Suharno
Yogyakarta 55143
Indonesia

http://www.geocities.com/kinclong2