当前位置:   article > 正文

基于Visuanl stdio 2017 检测人脸坐标C++代码_c++如何获取人脸识别的坐标

c++如何获取人脸识别的坐标
  1. #include <opencv2/opencv.hpp>
  2. #include <iostream>
  3. using namespace cv;
  4. using namespace std;
  5. CascadeClassifier face_cascader;
  6. CascadeClassifier eye_cascader;
  7. //记得是/而不是\
  8. //位置确定,在opencv中找到这两个文件,
  9. //haarcascade_frontalface_alt.xml
  10. //haarcascade_eye.xml
  11. //可以使用相对路径,可以使用绝对路径
  12. String facefile = "D:\\Program Files\\opencv\\opencv\\build\\etc\\haarcascades\\haarcascade_frontalface_alt.xml";
  13. String eyefile = "D:\\Program Files\\opencv\\opencv\\build\\etc\\haarcascades\\haarcascade_eye.xml";
  14. int main(int argc, char** argv) {
  15. if (!face_cascader.load(facefile)) {//载入xml
  16. printf("could not load face feature data...\n");
  17. return -1;
  18. }
  19. if (!eye_cascader.load(eyefile)) {//载入xml
  20. printf("could not load eye feature data...\n");
  21. return -1;
  22. }
  23. //创建窗体
  24. namedWindow("camera-demo", CV_WINDOW_AUTOSIZE);
  25. //打开摄像头
  26. VideoCapture captur
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/324776
推荐阅读
  

闽ICP备14008679号