Skip to content

dkumar247/cbir

Repository files navigation

CBIR Web Interface

A web-based interface for Content-Based Image Retrieval. Upload a query image and find similar images using various feature extraction methods.

Quick Start

Prerequisites

  • Python 3.8+python --version
  • CMakeDownload or brew install cmake (macOS) / sudo apt install cmake (Linux)
  • OpenCVDownload (Windows) or brew install opencv (macOS) / sudo apt install libopencv-dev (Linux)
  • C++ Compiler — Visual Studio (Windows), Xcode (macOS), or GCC (Linux)
image image

You can watch the demo of this project at the link below:

Demo Video:
https://drive.google.com/file/d/1NYAok6uiD5psRPR5hImfyYbnEgWzRcQx/view?usp=sharing

Run

Windows

Double-click setup_and_run.bat or run via command prompt:

git clone https://github.com/dkumar247/cbir.git
cd cbir
setup_and_run.bat

macOS / Linux

git clone https://github.com/dkumar247/cbir.git
cd cbir
chmod +x setup_and_run.sh
./setup_and_run.sh

The script will:

  1. Build the C++ backend (using CMake)
  2. Install Python dependencies (Flask)
  3. Start the web server at http://localhost:5001

How to Use

  1. Click "Choose Image" and select any .jpg image
  2. Select a feature extraction method from the dropdown
  3. Set the number of results (1–20)
  4. Click "Search Similar Images"

Feature Methods

Method Description
Baseline (7×7) Center patch comparison
RGB Histogram Global color distribution
Multi-Histogram Top/bottom spatial color matching
Texture + Color Sobel gradients + RGB histogram
DNN Embedding ResNet18 semantic similarity

Configuration

All paths and settings are in config.py. By default, relative paths are used so everything works out of the box.


Project Structure

cbir/
├── setup_and_run.sh        # ← Run this to start
├── config.py               # All configurable settings
├── app.py                  # Flask backend
├── templates/
│   └── index.html          # Web UI
├── cpp_src/                # C++ CBIR engine (built automatically)
├── data/                   # Image database + pre-computed features
└── requirements.txt        # Python dependencies

Troubleshooting

Problem Solution
Problem Solution
--------- ----------
cmake: command not found Install CMake and ensure it's in your system PATH.
OpenCV not found (Windows) Set OpenCV_DIR environment variable to your opencv/build folder or run CMake with -DOpenCV_DIR="C:/path/to/opencv/build".
dll missing (Windows) Add OpenCV bin (containing DLLs) to PATH or copy DLLs next to the executable.
flask not found Run pip install -r requirements.txt.
Port 5001 in use (macOS/Linux) lsof -ti:5001 | xargs kill
(Windows) Use Task Manager to kill Python processes.

Authors

Deepanshu Kumar and Prathmesh Barapatre

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors