westonplatter/phashion — pull request #30 by dannguyen (2013-12-30 17:00:36+00:00)
Title: distance_from convenience method for Image

Additions to Phashion::Image:

- `distance_from`, which returns the calculated Hamming distance
- options Hash for `duplicate?` to allow setting of distance threshold
- Possible breaking change: Previously, the duplicate method used `< [threshold]` as a test, which means a distance of `15` would return `false`. I've changed it to be `<= [threshold]`, which means that `15` returns `true`. This was to make the result of `img1.duplicate?(img2, threshold: 0)` to be less surprising. Otherwise, with a `threshold:0`, the result would **always** be `false`.

Additions to tests and documentation:

- tests to show Hamming distance from source image given image variations (lossy, thumbnail, black and white, rotations, etc)
- Added corresponding documentation for new methods and added more information to pre-reqs