Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP Kansai 2013 LT

PHP Kansai 2013 LT

php-otama

Hideo Hattori

June 01, 2013
Tweet

More Decks by Hideo Hattori

Other Decks in Programming

Transcript

  1. 使い方(類似度を求める) Python 実行結果 from otama import Otama db = Otama()

    db.open('./otama.conf') filename1 = 'images/lena.jpg' filename2 = 'images/lena-affine.jpg' print(db.similarity({'file': filename1}, {'file': filename2})) 0.362881481647
  2. 使い方(類似度を求める) PHP 実行結果 $db = new Otama(); $db->open("./otama.conf"); $filename1 =

    "images/lena.jpg"; $filename2 = "images/lena-affine.jpg"; var_dump($db->similarity($filename1, $filename2)); double(0.36288148164749)
  3. 使い方(類似画像を検索) Python import os from glob import glob from otama

    import Otama db = Otama.open('test.conf') db.create_table() files = glob('images/*.jpg') + glob('images/*.png') kvs = {} for filename in files: kvs[db.insert(filename)] = filename db.pull() for result in db.search(5, 'lena.jpg'): print("file=%s, sim=%f" % (kvs[result['id']], result['similarity']))
  4. 参考資料 PHP Extension を作ろう第1回 - まず は Hello World 30分でわかる

    PHP Extensionの作り方 を学べる記事をかいたよー \(^o^)/ mongo-php-driver php-memcached