Skip to content

Commit fe23e87

Browse files
committed
phpdoc
1 parent 2310c09 commit fe23e87

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Diff for: detect_face_by_dnn_ssd.php

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
<?php
22

33
use CV\Scalar, CV\Size;
4-
use function CV\{imread, imwrite, cvtColor, equalizeHist, rectangle};
5-
use const CV\{COLOR_BGR2GRAY};
4+
use function CV\{imread, imwrite, rectangle};
65

76

87
$src = imread("images/faces.jpg");
9-
$gray = cvtColor($src, COLOR_BGR2GRAY);
10-
equalizeHist($gray, $gray);
118

12-
\CV\resize($src, $resised, new Size(300, 300));
13-
14-
$blob = \CV\DNN\blobFromImage($resised, 1, new Size(300, 300), new Scalar(104, 177, 123));
9+
$blob = \CV\DNN\blobFromImage($src, 1, new Size(300, 300), new Scalar(104, 177, 123), true, false);
1510

1611
$net = \CV\DNN\readNetFromCaffe('models/ssd/res10_300x300_ssd_deploy.prototxt', 'models/ssd/res10_300x300_ssd_iter_140000.caffemodel');
1712

1813
$net->setInput($blob, "");
1914

2015
$r = $net->forward();
2116

17+
var_export($r->shape);
18+
2219
$scalar = new Scalar(0, 0, 255);
2320
for ($i = 0; $i < $r->shape[2]; $i++) {
2421
$confidence = $r->atIdx([0,0,$i,2]);
2522
//var_export($confidence);echo "\n";
26-
if ($confidence > 0.5) {
23+
if ($confidence > 0.2) {
2724
$startX = $r->atIdx([0,0,$i,3]) * $src->cols;
2825
$startY = $r->atIdx([0,0,$i,4]) * $src->rows;
2926
$endX = $r->atIdx([0,0,$i,5]) * $src->cols;

0 commit comments

Comments
 (0)