Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PHP Kansai 2013 LT
Search
Hideo Hattori
June 01, 2013
Programming
110
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
580
RustとPython
hhatto
4
2.7k
PyCon APAC 2013 LT
hhatto
0
95
Other Decks in Programming
See All in Programming
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
560
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
350
スマート反転とウェブアクセシビリティ
camiha
0
210
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
0
1.5k
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
290
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
180
The Rails Doctrine Decade
koic
2
130
新卒PdEのリアル
ryu1013
1
500
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
150
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
200
アクセシビリティから考える情報設計
high_g_engineer
0
380
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1k
Featured
See All Featured
Odyssey Design
rkendrick25
PRO
2
810
Being A Developer After 40
akosma
91
590k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
So, you think you're a good person
axbom
PRO
2
2.2k
WCS-LA-2024
lcolladotor
0
830
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Mobile First: as difficult as doing things right
swwweet
225
10k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Balancing Empowerment & Direction
lara
6
1.3k
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