30 #ifndef KJB_FLANDMARK_DETECTOR_H_
31 #define KJB_FLANDMARK_DETECTOR_H_
33 #ifdef KJB_HAVE_OPENCV
45 #define INDEX(ROW, COL, NUM_ROWS) ((COL)*(NUM_ROWS)+(ROW))
46 #define ROW(IDX, ROWS) (((IDX)-1) % (ROWS))
47 #define COL(IDX, ROWS) (((IDX)-1) / (ROWS))
49 typedef struct psig_struct {
54 typedef struct options_struct {
57 int bw[2], bw_margin[2];
58 FLANDMARK_PSIG *PsiGS0, *PsiGS1, *PsiGS2;
59 int PSIG_ROWS[3], PSIG_COLS[3];
62 typedef struct lbp_struct {
66 int WINS_ROWS, WINS_COLS;
69 typedef struct data_struct {
73 FLANDMARK_Options options;
76 typedef struct model_struct {
80 uint8_t *normalizedImageFrame;
85 typedef struct psi_struct {
87 uint32_t PSI_ROWS, PSI_COLS;
90 typedef struct psi_sparse {
92 uint32_t PSI_ROWS, PSI_COLS;
93 } FLANDMARK_PSI_SPARSE;
103 ERROR_DATA_MAPTABLE=6,
105 ERROR_DATA_OPTIONS_S=8,
106 ERROR_DATA_OPTIONS_PSIG=9,
120 FLANDMARK_Model * flandmark_init(
const char* filename);
130 void flandmark_write_model(
const char* filename, FLANDMARK_Model* model);
141 EError_T flandmark_check_model(FLANDMARK_Model* model, FLANDMARK_Model* tst);
150 void flandmark_free(FLANDMARK_Model* model);
159 void flandmark_get_psi_mat(FLANDMARK_PSI* Psi, FLANDMARK_Model* model,
int lbpidx);
168 void flandmark_get_psi_mat_sparse(FLANDMARK_PSI_SPARSE* Psi, FLANDMARK_Model* model,
int lbpidx);
178 void flandmark_maximize_gdotprod(
double *maximum,
double *idx,
const double *first,
const double *second,
const int *third,
const int cols,
const int tsize);
185 int flandmark_get_normalized_image_frame(IplImage *input,
const int bbox[],
double *bb, uint8_t *face_img, FLANDMARK_Model *model);
191 int flandmark_imcrop(IplImage *input, IplImage *output,
const CvRect region);
197 void flandmark_argmax(
double *smax, FLANDMARK_Options *options,
const int *mapTable, FLANDMARK_PSI_SPARSE *Psi_sparse,
double **q,
double **g);
209 int flandmark_detect_base(uint8_t *face_image, FLANDMARK_Model *model,
double *landmarks);
217 int flandmark_detect(IplImage *img,
int * bbox, FLANDMARK_Model *model,
double *landmarks,
int * bw_margin = 0);
219 std::vector<double> flandmark_detect
222 const Axis_aligned_rectangle_2d& box,
223 FLANDMARK_Model* model,
disp(num2str([lambda(1, 1) lambda(2, 2)])) r
#define W(X)
Definition: Wide.h:45
Class representing an axis-aligned, 2D rectangle.
Code for a wrapper class around the C struct KJB_Image.