垃圾 / php-mtcnn
PHP 的 MTCNN 人脸检测器实现
0.1.0
2021-08-12 17:28 UTC
Requires
- ext-opencv: *
This package is auto-updated.
Last update: 2024-09-19 02:05:41 UTC
README
PHP-MTCNN - PHP 的 MTCNN 人脸检测器实现
需求
- PHP 7.4 / 8.0
- PHP 扩展 php-opencv
安装
安装 PHP-MTCNN 的最佳方式是使用 Composer
php composer.phar require junker/php-mtcnn
用法
use \Junker\MTCNN\MTCNN; $mtcnn = new MTCNN(); $factor = 0.709; $threshold = [0.7, 0.6, 0.6]; $minSize = 12; $image = \CV\imread($image_path, 1); $faces = $mtcnn->detect($image, $minSize, $threshold, $factor); foreach ($faces as $face) { $x = (int) $face->bbox->xmin; $y = (int) $face->bbox->ymin; $x2 = (int) $face->bbox->xmax; $y2 = (int) $face->bbox->ymax; $score = $face->bbox->score; \CV\rectangle($image, $x, $y, $x2, $y2, new \CV\Scalar(255, 0, 0), 2); print_r($face); } \CV\imshow("image", $image); \CV\waitKey(0);