#image-processing #lang #language

bin+lib dhash

An implementation of dhash image signatures for rust

1 unstable release

0.1.0 Mar 6, 2019

#99 in #image-processing

Download history 5/week @ 2023-10-22 6/week @ 2023-10-29 5/week @ 2023-11-05 5/week @ 2023-11-12 6/week @ 2023-11-19 12/week @ 2023-11-26 3/week @ 2023-12-03 4/week @ 2023-12-10 5/week @ 2023-12-17 5/week @ 2023-12-24 3/week @ 2023-12-31 4/week @ 2024-01-07 5/week @ 2024-01-14 36/week @ 2024-01-21 43/week @ 2024-01-28 11/week @ 2024-02-04

96 downloads per month

MIT/Apache

8KB
71 lines

Dhash

This crate allows a dhash signature to be constructed from an image.

Requires the image crate

A dhash is a differential gradient hash that compares the difference in gradient between adjacent pixels, and provides a 64 bit signature of an image.

A dhash can be used to compare against other images for similarity and is resilient to differences in:

  • Aspect Ratio
  • Image Size
  • Brightness and Contrast

Implementation details taken from the Kind of Like That blog

Usage (CLI)

Install this crate:

cargo install dhash

Run dhash <img1> to print out a dhash of the image at path img1

$ dhash test.jpg
dhash for test.jpg is `13547707017824698364`

Run dhash <img1> <img2> to print out a dhash of both images and the distance between them (a lower number is closer):

$ dhash test.jpg other.jpg
dhash for test.jpg is `4485936524854165493`
dhash for other.jpg is `3337201687795727957`
distance is: 11

Dependencies

~19MB
~177K SLoC