Store your images SIFT descriptors using sqlite3.
See build.py for minimal usage:
from build_database import SIFTDatabase
SIFTDatabase().build((100, 100))
It
- creates a time-named database file
CREATE TABLE sift (id INTEGER PRIMARY KEY, tag TEXT, descriptors BLOB)
- reads all the image files (ends with extension
.jpg
/.png
) underimages/
- resizes all the images to
100 * 100
- calculates the image descriptors
INSERT INTO sift (tag, descriptors) VALUES (?, ?)
,[image_path.stem, descriptors.tobytes()]
conn.commit()
from pathlib import Path
class SIFTDatabase:
EXTS = [".jpg", ".png"]
def __init__(
self,
images_path: Path = Path(os.getcwd()) / "images",
output_file: str = f"sift_{int(time.time())}.db",
): ...
See build_database.py for details.
This repository's .gitignore
is an "allow list":
**/*
!.git*
!/build_database.py
!/build.py
!/README.md
so you can safely put any files you need right after you clone this repository, and easily update the script with git pull
. Have fun using!