https://github.com/cetra3/dhash
An implementation of `dhash` image signatures for rust
https://github.com/cetra3/dhash
image-processing rust-lang
Last synced: 11 months ago
JSON representation
An implementation of `dhash` image signatures for rust
- Host: GitHub
- URL: https://github.com/cetra3/dhash
- Owner: cetra3
- Created: 2019-03-06T01:20:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-06T01:27:44.000Z (over 7 years ago)
- Last Synced: 2025-06-04T09:43:51.550Z (about 1 year ago)
- Topics: image-processing, rust-lang
- Language: Rust
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](http://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html) blog
## Usage (CLI)
Install this crate:
```bash
cargo install dhash
```
Run `dhash ` to print out a `dhash` of the image at path `img1`
```bash
$ dhash test.jpg
dhash for test.jpg is `13547707017824698364`
```
Run `dhash ` to print out a `dhash` of both images and the distance between them (a lower number is closer):
```bash
$ dhash test.jpg other.jpg
dhash for test.jpg is `4485936524854165493`
dhash for other.jpg is `3337201687795727957`
distance is: 11
```