将“stasm_lib.h”添加到我的项目,opencv,面部特征检测

时间:2015-05-11 22:14:23

标签: opencv

我是C ++和OpenCV的初学者。如您所知stasm是一个C ++软件库,用于查找在http://www.milbo.users.sonic.net/stasm中引入的面部特征。我想使用stasm 4.1库进行图像识别。我读了手动stasm,但我不明白如何将“stasm_lib.h”添加到我的项目中!请指导我一步一步找到面部标志,运行后我收到此错误: 无法打开包含文件:胎儿错误C1083'stasm_lib.h'没有这样的文件或目录

#include <stdio.h>
#include <stdlib.h>
#include "opencv/highgui.h"
#include "stasm_lib.h"

int main()
{
  static const char* path = "../data/testface.jpg";

cv::Mat_<unsigned char> img(cv::imread(path, CV_LOAD_IMAGE_GRAYSCALE));

if (!img.data)
{
    printf("Cannot load %s\n", path);
    exit(1);
}

int foundface;
float landmarks[2 * stasm_NLANDMARKS]; // x,y coords

if (!stasm_search_single(&foundface, landmarks,
                         (char*)img.data, img.cols, img.rows, path, "../data"))
{
    printf("Error in stasm_search_single: %s\n", stasm_lasterr());
    exit(1);
}

if (!foundface)
     printf("No face found in %s\n", path);
else
{
    // draw the landmarks on the image as white dots
    stasm_force_points_into_image(landmarks, img.cols, img.rows);
    for (int i = 0; i < stasm_NLANDMARKS; i++)
        img(cvRound(landmarks[i*2+1]), cvRound(landmarks[i*2])) = 255;
}

cv::imshow("stasm minimal", img);
cv::waitKey();
return 0;
}`

非常感谢

0 个答案:

没有答案