From 92b77809e61332440dc30d4e09f9cc62080df148 Mon Sep 17 00:00:00 2001 From: rapclimber <31192540+rapclimber@users.noreply.github.com> Date: Thu, 28 Jun 2018 18:16:38 +0500 Subject: [PATCH] Added sharpness Added sharpness will make detection of face more accurate. --- FaceDetector.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/FaceDetector.php b/FaceDetector.php index 2a2cde5..8473be5 100644 --- a/FaceDetector.php +++ b/FaceDetector.php @@ -79,6 +79,16 @@ public function faceDetect($file) throw new Exception("Can not load $file"); } + + $sharpen = array( + array(0.0, -1.0, 0.0), + array(-1.0, 5.0, -1.0), + array(0.0, -1.0, 0.0) + ); + + $divisor = array_sum(array_map('array_sum', $sharpen)); + + imageconvolution($this->canvas, $sharpen, $divisor, 0); $im_width = imagesx($this->canvas); $im_height = imagesy($this->canvas);