Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHP Kansai 2013 LT
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Hideo Hattori
June 01, 2013
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PHP Kansai 2013 LT
php-otama
Hideo Hattori
June 01, 2013
More Decks by Hideo Hattori
See All by Hideo Hattori
gocloc
hhatto
0
570
RustとPython
hhatto
4
2.6k
PyCon APAC 2013 LT
hhatto
0
87
Other Decks in Programming
See All in Programming
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
140
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
380
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
240
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.7k
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
220
Performance Engineering for Everyone
elenatanasoiu
0
250
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
270
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
570
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
1
160
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
620
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
230
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
150
Featured
See All Featured
Leo the Paperboy
mayatellez
7
1.9k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
240
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
580
KATA
mclloyd
PRO
35
15k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
The Invisible Side of Design
smashingmag
301
52k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
590
Navigating Weather and Climate Data
rabernat
0
260
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Transcript
OTAMA あるPHP拡張のお話 PHPカンファレンス関西2013 / HIDEO HATTORI
自己紹介 , , PHPがっつり使ったのはここ1年程度 CとかPythonとかZshとかが好き アプリケーション開発とか運営とかし ています Hideo Hattori @hhatto
Github Bitbucket
今日話すこと CBIRって? php-otamaの紹介
OTAMAとは いわゆるひとつのCBIR(Content-based image retrieval) 画像同士の類似度を出力できる 画像をクエリに画像が検索できる https://github.com/nagadomi/otama
OTAMAPYとは otamaのPythonインターフェース PythonのC拡張でotamaライブラリをた たけるようにしたもの https://github.com/hhatto/otamapy
得意な亊 CとかPython CとかPython CとかPython CとかPython CとかPython CとかPython CとかPython CとかPython
ある日言われました 「もう少しPHPにも興味持ってください よ」と。
興味ないわけじゃないよ!! 得意な亊(C/Python) × PHP = PHP拡張モジュールを書こう!!
PHP-OTAMAとは otamaのPHPインターフェース いわゆるPHP拡張モジュール
使い方(類似度を求める) lena.jpg lena-affine.jpg
使い方(類似度を求める) 設定ファイル(otama.conf) {'driver': {'name': 'vlad_nodb'}}
使い方(類似度を求める) 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
使い方(類似度を求める) 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)
使い方(類似画像を検索) 設定ファイル(otama.conf) { 'namespace': 'testnamespace', 'driver': {'name': 'color', 'data_dir': './data',
'color_weight': 0.2}, 'database': {'driver': 'sqlite3', 'name': './data/otama.sqlite3'} }
使い方(類似画像を検索) 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']))
使い方(類似画像を検索) 実行結果 file=image/lena.jpg, sim=1.000000 file=image/lena-768x768.jpg, sim=0.968963 file=image/lena-affine.jpg, sim=0.770081 file=image/lena-rotate.jpg, sim=0.747762
file=image/baboon.png, sim=0.303697
使い方(類似画像を検索) PHP まだ使えません!!
絶賛開発中 Pull-Requestお待ちしてます!! php-otama
参考資料 PHP Extension を作ろう第1回 - まず は Hello World 30分でわかる
PHP Extensionの作り方 を学べる記事をかいたよー \(^o^)/ mongo-php-driver php-memcached
ご清聴ありがとうございまし た!! m(_ _)m