otama Python Interface
C Python
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
otama
test
tools
.gitignore
.travis.yml
LICENSE
MANIFEST.in
README.rst
setup.py
tasks.py
tox.ini

README.rst

otamapy

Build status

About

otamapy is Python Interface for otama (otama is CBIR.).

Installation

from pip:

$ pip install --upgrade otamapy

from easy_install:

$ easy_install -ZU otamapy

Requirements

  • Python2.6+ and Python3.2+
  • otama library (otama, nv, eiio)

Installation otama

on MacOSX (via homebrew-tap):

$ brew tap hhatto/otama
$ brew install otama

on Linux:

$ sh tools/install-libotama.sh

on MacOSX (from source):

$ sh tools/install-libotama-for-macosx.sh

Usage

config file (example.conf)

{
    'namespace': 'testnamespace',
    'driver': {'name': 'color', 'data_dir': './data', 'color_weight': 0.2},
    'database': {'driver': 'sqlite3', 'name': './data/store.sqlite3'}
}

store to database, and search from database.

# store_and_search.py
from otama import Otama
db = Otama.open('example.conf')

kvs = {}
db.create_database()
for filename in ('foo.jpg', 'bar.jpg'):
    kvs[db.insert(filename)] = filename

for result in db.search(10, 'foo.jpg'):
    key = result['id']
    print("sim=%.3f, file=%s" % (result['similarity'], kvs[key]))
$ python store_and_search.py
sim=1.000, file=foo.jpg
sim=0.969, file=bar.jpg

see examples .

Links