This was the final project for the subject digital image and video processing. Based on a 2000 image database (UKentuckyDatabase) I created an algorithm where you give it an image and it gives you an array of the most similar ones. In the database there are 4 "similar images" per image(including the original). So the F score is calculated that way
Author: Guillem Moreno
Date: May 2025
This project implements a content-based image retrieval (CBIR) system that compares image similarity using color-based descriptors. It builds upon a grayscale-based system (sistema1) and introduces a color descriptor using HMMD (Hue, Max-Min, and Diff).
The system (sistema2) consists of the following main stages:
- Input: RGB image of shape M × N × 3
- Output: HMMD color space using
rgb2hmmd(I)
- Supported bins: 32, 64, 128, 256
- Uses predefined tables for hue and sum bins
- Normalized histogram vector (unit sum)
- Matrix
H_dbstores all descriptors:Ndb × numCells
- Distance metrics used:
- Chi-squared
- Bhattacharyya
- Jensen-Shannon
- Hellinger
- KL-divergence
Each method was evaluated with different bin counts. Sample visualizations:
| Bins | Precision-Recall Curve |
|---|---|
| 256 | ![]() |
| 128 | ![]() |
| 64 | ![]() |
| 32 | ![]() |
| Bins | Method | Time (s) | F1-Score |
|---|---|---|---|
| 256 | Chi2 | 1.14 | 0.787 |
| Bhattacharyya | 1.39 | 0.838 | |
| Jensen-Shannon | 1.61 | 0.838 | |
| Hellinger | 1.17 | 0.838 | |
| KL-divergence | 1.16 | 0.775 | |
| 128 | All top methods | ~1.2 | 0.800 |
| 64 | Hellinger | 0.84 | 0.812 |
| 32 | Hellinger | 0.78 | 0.775 |
- Hellinger with 64 bins: Best tradeoff between quality (F1=0.812) and speed (<1s per query)
Main.m— system orchestrationalgo1_indexar.m— descriptor constructionalgo2_similitud.m— similarity calculationalgo3_busqueda.m— query executionprecision_recall.m— evaluation scriptrgb2hmmd.m— RGB to HMMD conversionquantizeHMMD.m— quantization logic- you can also generate a random input.txt based on the generate_input_file.m
- MATLAB
- Image database: UKBench (
ukbench%05d.jpg) - Input:
input.txtfile with query image names



