diff --git a/.gitignore b/.gitignore index 54983d3..2f6ab2a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,12 +28,11 @@ missing mkinstalldirs modules run-tests.php -tests/*/*.diff -tests/*/*.out -tests/*/*.php -tests/*/*.exp -tests/*/*.log -tests/*/*.sh - +tests/*.diff +tests/*.out +tests/*.php +tests/*.exp +tests/*.log +tests/*.sh .idea cmake-build-debug diff --git a/README.md b/README.md index 81ca51b..f2a800e 100644 --- a/README.md +++ b/README.md @@ -100,9 +100,8 @@ If you want to use HOG based approach: img; load_image(img, img_path); - pyramid_up(img); + array_init(return_value); + std::vector dets = detector(img); - RETURN_LONG(dets.size()); + for (unsigned long i = 0; i < dets.size(); ++i) { + zval rect_arr; + array_init(&rect_arr); + add_assoc_long(&rect_arr, "left", dets[i].left()); + add_assoc_long(&rect_arr, "top", dets[i].top()); + add_assoc_long(&rect_arr, "right", dets[i].right()); + add_assoc_long(&rect_arr, "bottom", dets[i].bottom()); + // Add this assoc array to returned array + // + add_next_index_zval(return_value, &rect_arr); + } } catch (exception& e) { diff --git a/tests/dlib_face_detection.phpt b/tests/dlib_face_detection.phpt new file mode 100644 index 0000000..8057bf4 --- /dev/null +++ b/tests/dlib_face_detection.phpt @@ -0,0 +1,18 @@ +--TEST-- +Frontal face detection. +--SKIPIF-- + +--FILE-- + $detected_face) { + printf("Face[%d] in bounding box (left=%d, top=%d, right=%d, bottom=%d)\n", $index, + $detected_face["left"], $detected_face["top"], $detected_face["right"], $detected_face["bottom"]); +} +?> +--EXPECT-- +Detection +Faces found = 1 +Face[0] in bounding box (left=214, top=194, right=393, bottom=373) \ No newline at end of file