Crystal Melting Dot
||12 months ago|
|demo||12 months ago|
|src||12 months ago|
|tests||12 months ago|
|.gitignore||12 months ago|
|LICENSE||1 year ago|
|README.md||12 months ago|
|alike.nimble||12 months ago|
|config.nims||12 months ago|
|gendoc||12 months ago|
A nim implementation of preceptual image hash. Useful when searching for duplicate or similar pictures.
How it works
- Get a small grayscale square image from original by scaling it
- Compute average image brightness
- Compare each pixel against average image brightness
- Write the result into bit array where 1 is 'brighter' and 0 is 'darker'
- Voila! We got the hash.
RGBA is basically simple algoritm x 4 for each channel.
Computing the difference is basically counting different bits in two hashes.
- Get source code by cloning this repository or downloading as zip
- Open directory where the source code is in terminal and run
nimble build(yeah, you'll need to have nimble installed first)
- After successful build the binaries will be in
./binfolder, you can run them
alike Usage: [options] COMMAND Commands: compare2 Compare 2 image files hash Compute hash for image file Options: -h, --help -a, --algorithm=ALGORITHM Algorithm to use for hash computation Possible values: [simple, rgba] (default: rgba)
Alike can be used as a library. See full API reference.
import pixie import alike let img1 = readImage("img1.png") img2 = readImage("img2.png") echo img1.getRGBAImgHash.diff(img2.getRGBAImgHash)