Similarity is an image similarity search server built on top of Lire. The images can be filtered using a query and are afterwards optically ranked. Similarity provides an easy to use REST interface and returns the search results as XML. If you're familiar with Ruby and the RestClient gem, check out the following examples.
First, you need to start the server:
$ sh start.sh
After you started similarity, you can index some images using cURL:
$ curl http://localhost:8984/uploads -F file=@/path/to/file.jpg -F "text=keyword1 keyword2" -F id=1 ...
Finally, you can search for similary images:
$ curl http://localhost:8984/search -F file=@/path/to/reference.jpg -F q=keyword1 -F start=0 -F limit=10 <response num="2"> <result> <id>1</id> <identifier>/path/to/file.jpg</identifier> <text>keyword1 keyword2</text> <score>1.0</score> </result> ... </response>
After you started similarity, you can index some images using e.g. Ruby and the RestClient gem:
gem install rest-client $ irb irb> require "rubygems" irb> require "rest-client" irb> RestClient.post("http://localhost:8984/uploads", :file => File.new("/path/to/file.jpg"), :text => "keyword1 keyword2", :id => 1) ...
Finally, you can search for similar images:
irb> puts RestClient.post("http://localhost:8984/search", :file => File.new("/path/to/reference.jpg"), :q => "keyword1", :start => 0, :limit => 10) <response num="2"> <result> <id>1</id> <identifier>/path/to/file.jpg</identifier> <text>keyword1 keyword2</text> <score>1.0</score> </result> ... </response> => nil
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request