Files
pdlib/src/face_landmark_detection.h
Branko Kokanovic 1a402fc63c Landmark detection (custom model and class-based)
This change extends existing landmark detection in new ways:
1. Existing logic is hiding HOG model (frontal_face_detector)
underneath and user cannot use other models (CNN model, for example).
2. Bounding box is exposed as additional argument, and user
can define custom bounding box (which is needed, if image used to detect
faces is changed (for example scaled), and we want to crop only face
from original image to feed into shape predictor).
3. This approach is class-based, so no need for multiple loadings of
shape predictor model (only once, in ctor)
2018-08-27 20:46:47 +02:00

35 lines
922 B
C++

//
// Created by goodspb on 2018/5/23.
//
#ifndef PDLIB_FACE_LANDMARK_DETECTION_H
#define PDLIB_FACE_LANDMARK_DETECTION_H
#include <dlib/dnn.h>
using namespace dlib;
ZEND_BEGIN_ARG_INFO_EX(dlib_face_landmark_detection_arginfo, 0, 0, 1)
ZEND_ARG_INFO(0, shape_predictor_file_path)
ZEND_ARG_INFO(0, img_path)
ZEND_END_ARG_INFO()
PHP_FUNCTION(dlib_face_landmark_detection);
typedef struct _face_landmark_detection {
shape_predictor *sp;
zend_object std;
} face_landmark_detection;
ZEND_BEGIN_ARG_INFO_EX(face_landmark_detection_ctor_arginfo, 0, 0, 1)
ZEND_ARG_INFO(0, shape_predictor_file_path)
ZEND_END_ARG_INFO()
PHP_METHOD(FaceLandmarkDetection, __construct);
ZEND_BEGIN_ARG_INFO_EX(face_landmark_detection_detect_arginfo, 0, 0, 2)
ZEND_ARG_INFO(0, img_path)
ZEND_ARG_INFO(0, bounding_box)
ZEND_END_ARG_INFO()
PHP_METHOD(FaceLandmarkDetection, detect);
#endif //PDLIB_FACE_LANDMARK_DETECTION_H