Skip to content

Implementation of the MTCNN face detector for PHP

License

Notifications You must be signed in to change notification settings

Junker/PHP-MTCNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTCNN

License Minimum PHP Version

PHP-MTCNN - Implementation of the MTCNN face detector for PHP

Requirements

Installation

The best way to install PHP-MTCNN is to use a Composer:

php composer.phar require junker/php-mtcnn

Usage

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);

Based on https://github.com/imistyrain/MTCNN

About

Implementation of the MTCNN face detector for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages