php**
opencv安裝之前必須依賴的包:(請先安裝好)
pkgconfig
libpng
zlib
libjpeg
libtiff
python
[opencv安裝] www.opencv.org.
tar xvzf opencv-1.0.0.tar.gz
cd opencv-1.0.0
./configure
make
make install
make check (檢查是否安裝全部正確)
[facedetect]
tar xzvf facedetect-1.0.0.tar.gz
cd facedetect-1.0.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make test
make install
[imagemagick]
tar jxvf imagemagick-6.5.0-0.tar.bz2
cd imagemagick-6.5.0-0
./configure
make
make install
[imagick]
tar zxvf imagick-2.3.0b1.tgz
imagick-2.3.0b1
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make test
make install
[配置]
ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
看看有沒有 facedetect.so 和 imagick.so
vi /usr/local/php/lib/php.ini
在[php]模組下增加:
extension = facedetect.so
extension = imagick.so
重啟apache
[測試**]
從opencv源**/data/haarcascades/裡頭取出所有xml檔案放在php的執行目錄下
//------------------
// 監測有幾個人臉
//------------------
//檢查有多少個臉型
var_dump(face_count('party.jpeg'
, haarcascade_frontalface_alt.xml'));
//返回臉型在中的位置引數,多個則返回陣列
$arr
= face_detect(
'party.jpeg'
, haarcascade_frontalface_alt2.xml');
print_r($arr
);
//------------------
// 人臉扭曲
//------------------
<?php if(
$_files
) }
header( "content-type: image/png"
);
echo
$im;
}else
?>
//------------------
// 人臉識別
//------------------
<?php
header("content-type:text/html; charset:utf-8"
); if(
empty
empty
($_post
)) else
else
$allowtype
= 1;
switch
($_files
['pic'
]['type'
]) if(
$allowtype
== 0)
$tmp_name
= time();
$src_pic
= "./"
.$tmp_name
.$fix_pic
; move_uploaded_file($_files
['pic'
]['tmp_name'
], $src_pic
);
$pic_src
= $pic_dst
= array
(); if(
is_array
($all
))
} foreach
($pic_src
as$key
=>
$value
)
} ?>
在測試。。。。
OpenCV和PHP的人臉識別技術
php opencv安裝之前必須依賴的包 請先安裝好 pkgconfig libpng zlib libjpeg libtiff python opencv安裝 www.opencv.org.tar xvzf opencv 1.0.0.tar.gz cd opencv 1.0.0 configure...
OpenCV和PHP的人臉識別技術
opencv安裝之前必須依賴的包 請先安裝好 pkgconfig libpng zlib libjpeg libtiff python opencv安裝 www.opencv.org.tar xvzf opencv 1.0.0.tar.gz cd opencv 1.0.0 configure mak...
基於opencv的人臉識別
1前言參考的是 這篇用的是dlib的對齊還加了mask。本文方法 人臉檢測 shiqiyu libfacedetection opencv提取ptr類 2 facedetect.h include include include include include facedetect dll.h us...