bubo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/bubo.rb +12 -16
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/bubo.rb
CHANGED
@@ -40,25 +40,25 @@ class Bubo
|
|
40
40
|
# Add a new image to your searchable collection.
|
41
41
|
# Returns true or false
|
42
42
|
def add_image(key, url)
|
43
|
-
send('images/add',
|
43
|
+
send('images/add', {:key => key, :url => url}) == 'OK'
|
44
44
|
end
|
45
45
|
|
46
46
|
# Remove an image from your searchable collection.
|
47
47
|
# Returns true or false
|
48
48
|
def remove_image(key)
|
49
|
-
send('images/remove',
|
49
|
+
send('images/remove', {:key => key}) == 'OK'
|
50
50
|
end
|
51
51
|
|
52
52
|
# Get the analysis status of an image in your collection.
|
53
53
|
# Returns either:
|
54
54
|
#
|
55
|
-
# "OK\
|
55
|
+
# "OK\tNUMBER" where NUMBER is the number of feature points used for searching
|
56
56
|
#
|
57
57
|
# or
|
58
58
|
#
|
59
|
-
# "FAIL\
|
59
|
+
# "FAIL\tERROR MESSAGE"
|
60
60
|
def inspect_image(key)
|
61
|
-
send('images/inspect',
|
61
|
+
send('images/inspect', {:key => key})
|
62
62
|
end
|
63
63
|
|
64
64
|
# Retrieve an array of keys of images, which failed to import.
|
@@ -73,29 +73,25 @@ class Bubo
|
|
73
73
|
# Returns an array of strings. Each member is either a comment line starting with # or a search result.
|
74
74
|
# Search result lines are formatted as:
|
75
75
|
#
|
76
|
-
# "
|
76
|
+
# "KEY\tSCORE\tMATRIX"
|
77
77
|
#
|
78
|
-
# KEY is the key you specified when adding the image
|
79
|
-
# SCORE is a confidence score from 0 to 1 with anything above 0.9 considered excellent
|
80
|
-
# MATRIX is a 2x3 affine transformation matrix which can be used to transform the image specified by KEY as to cover the search image.
|
78
|
+
# KEY is the key you specified when adding the image.
|
79
|
+
# SCORE is a confidence score from 0 to 1 with anything above 0.9 considered excellent.
|
80
|
+
# MATRIX is a 2x3 affine transformation matrix which can be used to transform the image specified by KEY as to cover the search image.
|
81
81
|
def retrieve(url)
|
82
|
-
send('images/retrieve',
|
82
|
+
send('images/retrieve', {:url => url}).split("\n")
|
83
83
|
end
|
84
84
|
|
85
85
|
private
|
86
86
|
|
87
|
-
def send(path,
|
87
|
+
def send(path, form_data = {})
|
88
88
|
form_data = form_data.merge(api_verification)
|
89
89
|
form_data = form_data.inject({}) { |m, (k, v)| m[k.to_s] = v; m }
|
90
90
|
|
91
91
|
response = ''
|
92
92
|
http = Net::HTTP.new(host, port)
|
93
93
|
http.start do |http|
|
94
|
-
|
95
|
-
request = Net::HTTP::Get.new('/'+path)
|
96
|
-
else
|
97
|
-
request = Net::HTTP::Post.new('/'+path)
|
98
|
-
end
|
94
|
+
request = Net::HTTP::Post.new('/'+path)
|
99
95
|
request.set_form_data(form_data)
|
100
96
|
response = http.request(request)
|
101
97
|
response = response.body.strip
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bubo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Hajo Nils Krabbenh\xC3\xB6ft"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-03 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|