Skip to content

Commit c765571

Browse files
committed
bin/idhash
1 parent 09141f7 commit c765571

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
/.byebug_history
1111
.DS_Store
1212
*.jpg
13-
*.png
13+
/test_images/*.png
1414

1515
/temp.*

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ gem "dhash", github: "nakilon/dhash"
77
gem "phamilie"
88
gem "mini_magick"
99
gem "dhashy"
10+
gem "phashion"
1011

1112
gem "get_process_mem"
1213
gem "mll"

README.md

100755100644
+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ and visualization of IDHash (`rake compare_images -- image1.jpg image2.jpg`):
3939

4040
Here in each of 64 cells, there are two circles that color the difference between that cell and the neighbor one. If the difference is low the Importance bit is set to zero and the circle is invisible. So there are 128 pairs of corresponding circles and when you take one, if at least one circle is visible and is of different color the line is to be drawn. Here you see 15 lines and so the distance between fingerprints will be equal to 15 (that is pretty low and can be interpreted as "images look similar"). Also, you see here that floor on this photo matters -- classic dHash won't see that it's darker than wall because it's comparing only horizontal neighbors and if one photo had no floor the distance function won't notice that. Also, it sees the Important difference between the very right and left columns because the wall has a slow but visible gradient.
4141

42+
As of version 0.2.4.0 the gem includes a binary that you can call to get similar visualisation in terminal:
43+
44+
```bash
45+
idhash test_images/3f9....jpg test_images/309....jpg
46+
```
47+
48+
![screenshot](doc_bin.png)
49+
4250
### Remaining problems
4351

4452
* Neither dHash nor IDHash can't automatically detect very shifted crops and rotated images but you can make a wrapper that would call the comparison function iteratively.

Rakefile

100755100644
File mode changed.

dhash-vips.gemspec

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
Gem::Specification.new do |spec|
22
spec.name = "dhash-vips"
3-
spec.version = "0.2.3.0"
3+
spec.version = "0.2.4.0"
44
spec.summary = "dHash and IDHash perceptual image hashing/fingerprinting"
5-
spec.metadata = {"source_code_uri" => "https://github.com/nakilon/dhash-vips"}
65

76
spec.author = "Victor Maslov aka Nakilon"
87
spec.email = "[email protected]"
98
spec.license = "MIT"
9+
spec.metadata = {"source_code_uri" => "https://github.com/nakilon/dhash-vips"}
1010

1111
spec.add_dependency "ruby-vips", "~> 2.0", "!= 2.1.0", "!= 2.1.1"
1212

1313
spec.require_path = "lib"
1414
spec.extensions = %w{ extconf.rb }
15-
spec.files = %w{ LICENSE.txt dhash-vips.gemspec lib/dhash-vips.rb idhash.c lib/dhash-vips-post-install-test.rb } + spec.extensions
15+
spec.files = %w{ LICENSE.txt dhash-vips.gemspec lib/dhash-vips.rb idhash.c lib/dhash-vips-post-install-test.rb } + spec.extensions +
16+
%w{ bin/idhash }
17+
spec.executables = %w{ idhash }
18+
spec.bindir = "bin"
1619
end

doc_bin.png

351 KB
Loading

0 commit comments

Comments
 (0)