当前位置: 首页 > news >正文

爱用网站建设南江县规划和建设局网站

爱用网站建设,南江县规划和建设局网站,电脑网页尺寸一般是多少,宿迁网页设计培训前面我们介绍了使用dlib进行人脸检测#xff0c;下面我们给出如何使用dlib进行人脸特征点检测。我们直接贴出代码。我们的代码包括如下几部分功能#xff1a; 检测单张图片检测一个视频检测一个camera 先给出代码#xff1a; #include dlib/image_processing/frontal_…前面我们介绍了使用dlib进行人脸检测下面我们给出如何使用dlib进行人脸特征点检测。我们直接贴出代码。我们的代码包括如下几部分功能 检测单张图片检测一个视频检测一个camera 先给出代码 #include dlib/image_processing/frontal_face_detector.h #include dlib/image_processing/render_face_detections.h #include dlib/image_processing.h #include dlib/gui_widgets.h #include dlib/image_io.h #include iostream #include string #include dlib/opencv.h #include opencv2/highgui/highgui.hppusing namespace dlib; using namespace std;// ---------------------------------------------------------------------------------------- void PrintHelp(); int FaceDetectionAndAlignment(const char* inputname);int main(int argc, char** argv) {try{// This example takes in a shape model file and then a list of images to// process. We will take these filenames in as command line arguments.// Dlib comes with example images in the examples/faces folder so give// those as arguments to this program.if (argc 1){PrintHelp();return 0;}if (strcmp(argv[1],Demo)0){if (2argc){return FaceDetectionAndAlignment();}else if (3argc){return FaceDetectionAndAlignment(argv[2]);}}else{PrintHelp();return 0;}}catch (exception e){cout \nexception thrown! endl;cout e.what() endl;} }// ---------------------------------------------------------------------------------------- void PrintHelp() {cout Useage: endl;cout 1. test model via a camera: face_alignment.exe Demo endl;cout 2. test model on a pic: face_alignment.exe Demo xx.jpg endl; cout 3. test model on a video: face_alignment.exe Demo xx.avi endl;cout endl; } int FaceDetectionAndAlignment(const char* inputname) {string inputName;CvCapture* capture 0; cv::Mat frame, frameCopy, image;image_window win;frontal_face_detector detector get_frontal_face_detector();shape_predictor pose_model;deserialize(D:/dlib/model/shape_predictor_68_face_landmarks.dat) pose_model;if (inputname ! NULL){inputName.assign(inputname);}// name is empty or a numberif (inputName.empty()){capture cvCaptureFromCAM(0);if (!capture){cout Capture from camera didnt work endl;return -1;}}// name is not emptyelse if (inputName.size()){if (inputName.find(.jpg) ! string::npos || inputName.find(.png) ! string::npos|| inputName.find(.bmp) ! string::npos){image cv::imread(inputName, 1);if (image.empty()){cout Read Image fail endl;return -1;}}else if (inputName.find(.mp4) ! string::npos || inputName.find(.avi) ! string::npos|| inputName.find(.wmv) ! string::npos){capture cvCaptureFromAVI(inputName.c_str());if (!capture){cout Capture from AVI didnt work endl;return -1;}}}// -- 2. Read the video streamif (capture!nullptr){cout In capture ... endl;// Grab and process frames until the main window is closed by the user.while (!win.is_closed()){// Grab a frameIplImage* iplImg cvQueryFrame(capture);iplImg cvQueryFrame(capture);frame cv::cvarrToMat(iplImg);if (frame.empty())break;if (iplImg-origin IPL_ORIGIN_TL) //frame.copyTo(frameCopy);elsecv::flip(frame, frameCopy, 0);// Turn OpenCVs Mat into something dlib can deal with. Note that this just// wraps the Mat object, it doesnt copy anything. So cimg is only valid as// long as temp is valid. Also dont do anything to temp that would cause it// to reallocate the memory which stores the image as that will make cimg// contain dangling pointers. This basically means you shouldnt modify temp// while using cimg.cv_imagebgr_pixel cimg(frameCopy);// Detect faces std::vectorrectangle faces detector(cimg);// Find the pose of each face.std::vectorfull_object_detection shapes;for (unsigned long i 0; i faces.size(); i)shapes.push_back(pose_model(cimg, faces[i]));// Display it all on the screenwin.clear_overlay();win.set_image(cimg);win.add_overlay(render_face_detections(shapes));if (cv::waitKey(10) 0)goto _cleanup_;}cv::waitKey(0);_cleanup_:cvReleaseCapture(capture);}else{if (!image.empty()){cout In image read endl;cv_imagebgr_pixel cimg(image);// Detect faces std::vectorrectangle faces detector(cimg);// Find the pose of each face.std::vectorfull_object_detection shapes;for (unsigned long i 0; i faces.size(); i)shapes.push_back(pose_model(cimg, faces[i]));// Display it all on the screenwin.clear_overlay();win.set_image(cimg);win.add_overlay(render_face_detections(shapes));cout Hit enter to exit... endl;cin.get();}}return 0;} 再逐一介绍。 检测单张图片 右击项目选择属性调试填写 Demo E:\\datasets\\helen\\testset\\30427236_1.jpg 如下图 实验结果 相当不错的效果了。 检测视频 右击项目选择属性调试填写 Demo E:\\datasets\\vid.wmv 效果视频地址 http://7xtmgn.com1.z0.glb.clouddn.com/dlibvideo.mp4 检测camera 右击项目选择属性调试填写 Demo 效果视频地址 http://7xtmgn.com1.z0.glb.clouddn.com/dlibcamera.mp4 完整源代码dlib face_alignment
http://www.pierceye.com/news/201577/

相关文章:

  • 如何在百度上注册自己的网站郓城做网站哪家好
  • 企业电子商务网站建设总结安徽建设工程信息网查询平台公司
  • 推荐常州微信网站建设做外汇看的网站
  • 网站页面优化方案网页设计培训费用多少
  • 落寞文学网单本多本小说wordpress主题哈尔滨网站优化指导
  • 网站域名使用费用网站在vps能访问 在本地访问不了
  • wordpress可以做成企业站吗一个域名可以建设几个网站
  • 企业网站备案需要什么资料工装装饰公司
  • 网站建设精美模板下载邢台165信息交友
  • 普陀区建设工程质检网站网站关键词优化排名
  • 云服务器多网站解析企业网站打不开了
  • 搭建flv视频网站如何注册域名步骤
  • 平面设计公司网站单页模板
  • 网站模板 代码免费建设部网站有项目经理资质查询系统
  • 网站建设注意哪些方面wordpress 做手机站
  • 淄博网站制作定制推广网站程序源代码
  • 二手房地产中介网站建设wordpress改背景图片
  • 可以自己做安卓app的网站Wordpress会员插件出错
  • 做网站优化有前景吗可信网站验证服务中心
  • 韩国设计欣赏网站天津工程建设网官方网站
  • 微网站建设多少钱网站空间管理
  • 济南网站制作定制公司wordpress重新安装主题
  • python 网站开发教程怎么做网站跳转
  • 个人盈利网站怎么建立网站建设 深圳 凡科
  • 网站后台登录地址滨州论坛网站建设
  • 怎么给钓鱼网站做防红wordpress插件合集
  • 骆驼网站建设is_category wordpress
  • 网站中链接怎么做的怎么做资源网站
  • 石家庄建站模板搭建cdr做网站分辨率
  • 学校网站建设有限公司长春网站设计策划书