
最近、OpenCVで顔検出するのが流行ってるっぽい。
rubyとかperlとかだと、モジュールを作ってる人がいて、
rubyやperlからOpenCVを簡単に使えそうなのに、
PHPだけ出来ないのは、あんまりずるいので自分で作った。
使い方は、
OpenCVをインストールする。
./configure
make
make install
これをダウンロードして解凍
face_detect-0.0.1.tar.gz
tar xvfz face_detect-0.0.1.tar.gz
cd face_detect-0.0.1
phpize
./configure
make
make install
あとは、php.iniに
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
extension=face_detect.so
見たいな感じに書く。
これを入れると、
face_detect
という関数が使えるようになる。
$picture = "picture.jpg";
$cascade = "/usr/local/share/opencv/haarcascades/haarcascade_frontalface_alt.xml";
//顔の位置を検出
$faces = face_detect($picture ,$cascade);
とすると、
$facesに見つけた顔の数だけ配列で、
帰って来きます。
なお、使用したPHPは、
5.2.1です。
ちなみに、phpの拡張は初めて作りました。
動くかどうかとても不安です。動いた方、教えてくれると嬉しいです。


openCVはyumで入れたので、インストール先は違いましたけど。感謝です!
動きましたか!
やった。嬉しい。
不具合とかありましたら教えてくださいね。
私もyumでOpenCV入れましたが、大丈夫でした。
ありがとうございました☆
商用サービスのインターフェースに利用してもいいですか?
面白いですね、これ。
ところで、OpenCVの他の機能はPHPから使えるようになりませんか?
よしけん さん
あーる さん
みなさん、動作報告ありがとうございます。
結構ちゃんと動くんですねぇ。
拡張は、pecl-codegenが作ってくれるので作るのは結構楽チンです。
OpenCVはAPIが大量に有るようなので、
全部に対応するのは難しいかと思いますが、
要望があれば、必要な物から対応して行こうと思います。
Nice to meet you!And I search keyword"face detect" from Google.com. That I come here!
My name is Anson Ho. I am Chinese.Work in Hongkong & GuangZhou. And I very interesting for face detect technology with Web Application.
But Sorry, with I can't speak Japanese more,So I just can use my poor English talk with you.
Shell we be friend and study more face detect Tech together?
And I am a Tomice toy car's fans too!haha!
Thank you again!And wait your feed back!
my mail:gz.anson@gmail.com
Nice to meet you!
I am interesting very much for face detecte too.
Let to study technorogy for face detect.
I will go to Shanghai in Chaina next Week.
I like Chaina.
I am happy to receive you reply.
And I hope can met your in Shanghai.But I am in Guangzhou,that's far from Shanghai. So how can I met you?
And your use MSN,or other IM software?
I am really heart to met you, and with a happy talk!
My MSN is:gz.anson@live.cn And Gtalk:gz.anson@gmail.com
I will be online in 10:00PM-00:00AM every night.Hope can see you.
GoodLucky for you,and enjoy your Chinese tour!
By the way,If you need some help,You can call me tel:+86-13609720974 Anson. I have some Shanghai's Friend can help you!
Thank You reply.
Im happy too.
I am using Skype and MSN IM.
I will talk you by IM.
I will be enjoy talk with you.
> By the way,If you need some help,
Thank You very much.
I would like to meet chinese web system engineer.
if your friend live in Shanghai who is systems engineer
Could you introduce it?
MY MSN:gz.anson@live.cn call me:)
And What kind of web system engineer your found? Is about the search engineer, or programer, or development, or the other?
I am a web developer and Operating Officer.
I forgot to tell you.I have a interesting think point with in secret.So MSN me or GIVE ME YOUR EMAIL.
I am finding web system engineer and web developper.
are you web developer ?
I send you mail.