phashion 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
- metadata.gz: c79341235f99694415039b6b706bfe48d3d5c425
4
- data.tar.gz: 651fa7bba67c389b06b60dc24f73283ff1394397
5
- !binary "U0hBNTEy":
6
- metadata.gz: c47fdc783f464800a1c3b1bd2b4fe93cdcb938ca2ff0e49887bfc1e74305c7d4acca8fb72afbc4cfccacdd76d3b3c0a698999cb0e47d16780b84d4bd1feef0e1
7
- data.tar.gz: 73d416a8f6b0393adfaceff857deec9c7d1e33095bc6c0cd0c47782c41acf1bc814cd893ce88bc6b64ae559bfbcae98ffe001795d9652a8327958948ece76f36
3
+ metadata.gz: !binary |-
4
+ MDIxY2E0ZDAwODcwMjNhMjk1NzQyMTg5ZmU3NGE3MGYxY2YzMTJjZA==
5
+ data.tar.gz: !binary |-
6
+ MDU4NmM0NGQxZmYzMzkxZGQ5ZmYzOTUxYzFhMDk0MjIxYzQ5ZDAzNw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTRhZDJjZDFiNGVlZDhjZGQ0ZjgwMGU5OWRiNjA4MTUxMzExNDVhYmM2NGZh
10
+ MjJkYTYyNDZiZTYyZWU1NmZhODg4ZDMxNDM3ZTA4YTU2Y2YyOTgzZDA0NDVk
11
+ OGUzNzg4NWVjODI3ZjQ4ODljMjkyNWYxYmNjYTc1NWQwODExNWY=
12
+ data.tar.gz: !binary |-
13
+ NjA2NDI5YTdkMjRmNGQ0ZDgwNDAwZGI5NjA0NTEzNThkY2NlZWFkMDUzMWI5
14
+ ODM3NWRmN2U1YmViYTUwMjA4ZGE3ZjI3OTVkZjBlZjNiZGZkNWFmZmJlNzc4
15
+ ZjgzOTM0YWIxMzg4NGUyMDFmNDFlM2E2MDU2ODdkMDc5N2I2Mjc=
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  History
2
- =========
2
+ =======
3
+
4
+ 1.1.1
5
+ -----
6
+ * Added Ruby method to call into pHash's Mexican Hat Wavelet funcition (issue #37, Terence Lee / @hone)
7
+ * Removed duplicate version reference
3
8
 
4
9
  1.1.0
5
10
  -----
@@ -9,7 +14,7 @@ History
9
14
 
10
15
  1.0.8
11
16
  ------
12
- * Renamed the pHashion tar.gz archive as "pHash-0.9.6.tar.gz" to solve/enable install from github
17
+ * Renamed the pHashion tar.gz archive as "pHash-0.9.6.tar.gz" to solve/enable install from github.
13
18
 
14
19
  1.0.7
15
20
  ------
@@ -27,29 +32,24 @@ History
27
32
 
28
33
  1.0.5
29
34
  -------
30
-
31
35
  * Fix CImg.h compilation problems. [#10]
32
36
 
33
37
  1.0.4
34
38
  -------
35
-
36
39
  * Fix pthread linking on Ubuntu 11.04
37
40
 
38
41
  1.0.3
39
42
  -------
40
-
41
43
  * Update pHash to version 0.9.3 and CImg 1.4.7.
42
44
  * Fix a few build issues.
43
45
 
44
46
  1.0.2
45
47
  -------
46
-
47
48
  * Make installation much easier by distributing and building locally all the native dependencies.
48
49
  This includes pHash 0.9.0 and CImg 1.3.4.
49
50
 
50
51
  1.0.1
51
52
  -------
52
-
53
53
  * Remove RubyInline, use standard Ruby extension infrastructure.
54
54
  * Update duplicate threshold constant based on wider image testing.
55
55
  * Make duplicate threshold variable so users can tune it based on their dataset.
@@ -58,5 +58,4 @@ History
58
58
 
59
59
  1.0.0
60
60
  -------
61
-
62
- Initial release.
61
+ * Initial release.
data/lib/phashion.rb CHANGED
@@ -9,8 +9,6 @@
9
9
  require 'rbconfig'
10
10
 
11
11
  module Phashion
12
- VERSION = '1.0.8'
13
-
14
12
  class Image
15
13
  DEFAULT_DUPE_THRESHOLD = 15
16
14
 
@@ -24,6 +22,10 @@ module Phashion
24
22
  Phashion.hamming_distance(fingerprint, other.fingerprint)
25
23
  end
26
24
 
25
+ def mh_distance_from(other)
26
+ Phashion.hamming_distance2(mh_fingerprint, other.mh_fingerprint)
27
+ end
28
+
27
29
  def duplicate?(other, opts={})
28
30
  threshold = opts[:threshold] || DEFAULT_DUPE_THRESHOLD
29
31
 
@@ -33,6 +35,14 @@ module Phashion
33
35
  def fingerprint
34
36
  @hash ||= Phashion.image_hash_for(@filename)
35
37
  end
38
+
39
+ def mh_fingerprint
40
+ @mh_hash ||= Phashion.mh_hash_for(@filename)
41
+ end
42
+ end
43
+
44
+ def self.mh_hash_for(filename, alpha = 2.0, lvl = 1.0)
45
+ _mh_hash_for(filename, alpha, lvl)
36
46
  end
37
47
 
38
48
  def self.so_file
@@ -1,3 +1,3 @@
1
1
  module Phashion
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -50,6 +50,25 @@ class TestPhashion < Minitest::Test
50
50
  assert_equal expected, rows.first.first
51
51
  end
52
52
 
53
+ def test_mh_hash_for
54
+ jpg = File.dirname(__FILE__) + '/jpg/Broccoli_Super_Food.jpg'
55
+ png = File.dirname(__FILE__) + '/png/Broccoli_Super_Food.png'
56
+
57
+ hash1 = Phashion.mh_hash_for jpg
58
+ hash2 = Phashion.mh_hash_for png
59
+
60
+ assert_kind_of Array, hash1
61
+ assert_kind_of Array, hash2
62
+ assert_in_delta 0.100, Phashion.hamming_distance2(hash1, hash2), 0.028
63
+ end
64
+
65
+ def test_mh_distance_from
66
+ jpg = File.dirname(__FILE__) + '/jpg/Broccoli_Super_Food.jpg'
67
+ png = File.dirname(__FILE__) + '/png/Broccoli_Super_Food.png'
68
+
69
+ assert_in_delta 0.100, Phashion::Image.new(jpg).mh_distance_from(Phashion::Image.new(png)), 0.028
70
+ end
71
+
53
72
  def test_duplicate_detection
54
73
  files = %w(86x86-0a1e.jpeg 86x86-83d6.jpeg 86x86-a855.jpeg)
55
74
  images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/jpg/'}#{f}")}
@@ -58,8 +77,6 @@ class TestPhashion < Minitest::Test
58
77
  assert_duplicate images[0], images[2]
59
78
  end
60
79
 
61
-
62
-
63
80
  def test_duplicate_detection_2
64
81
  files = %w(b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg e7397898a7e395c2524978a5e64de0efabf08290.jpeg)
65
82
  images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/jpg/'}#{f}")}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phashion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.0.14
117
+ rubygems_version: 2.2.2
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: Simple wrapper around the pHash library
@@ -140,4 +140,3 @@ test_files:
140
140
  - test/png/grass.png
141
141
  - test/png/linux.png
142
142
  - test/test_phashion.rb
143
- has_rdoc: