A FastAPI-based web service that detects and returns the most visually similar image to a user-uploaded file by comparing it with previously stored images using feature matching techniques.
- Upload and store original images via REST API
- Upload a new image to compare with stored ones
- Detects visually similar images using:
- ORB (Oriented FAST and Rotated BRIEF) for feature extraction
- BFMatcher with Hamming distance for descriptor comparison
- Returns the most similar image using a match scoring algorithm
- Streaming response for efficient image delivery
-
Upload Original Image
http://127.0.0.1:8000/docs - detect-duplicate/v1/upload- Saves the image in the
original_imagesdirectory
-
Find Matching Image
http://127.0.0.1:8000/docs - detect-duplicate/v1/match- Accepts an uploaded image
- Uses ORB to detect keypoints and descriptors
- Compares descriptors with each stored image using BFMatcher
- Calculates match score (lower score = more similar)
- Returns the closest matching image as a response
- FastAPI – for building RESTful APIs
- OpenCV – for image processing and feature detection
- Python – core programming language
- NumPy – for handling image buffers
-
Install dependencies: pip install -r requirements.txt
-
Start the server: uvicorn script:app --reload