• 大小: 4.32MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-20
  • 语言: 其他
  • 标签: 人脸检测  

资源简介

简单的人脸检测,并将人脸区域截取保存,有代码的借鉴意义

资源截图

代码片段和文件信息

#include
#include
#include
#include
#include
using namespace cv;
//CascadeClassifier faceCascade;
int main()
{

//faceCascade.load(“D:/Program Files/opencv248/opencv/sources/data/haarcascades/haarcascade_frontalface_alt2.xml“);
//载入图像
VideoCapture cap;
cap.open(0);
//cap.open(“E:/12.avi“);   
Mat img imgGray m_ResImgroi_img;
//vector faces;
int c = 0;

if (!cap.isOpened())
{
return 1;
}
while (c != 27)
{
cap >> img;
IplImage* show;
*show= IplImage(img);
//rectangle(img Point(img.rows / 8 img.cols / 8) Point(img.cols / 8 * 7 img.rows / 8*7) Scalar(0 0 255) 2 8);
//roi_img = img(Range(100 400) Range(100 500));
//if (roi_img.channels() == 3)
//{
// cvtColor(roi_img imgGray CV_RGB2GRAY);
//}
//else
//{
// imgGray = roi_img;
//}
//equalizeHist(imgGray m_ResImg);
//Mat face_src;
//faceCascade.detectMultiScale(m_ResImg faces 1.2 6 0 Size(0 0));//检测人脸

//if (faces.size() > 0)
//{
// for (int i = 0; i < faces.size(); i++)
// {
// face_src = roi_img(Range(faces[i].y + 1 faces[i].y + faces[i].height - 1) Range(faces[i].x + 1 faces[i].x + faces[i].width - 1));
//
// rectangle(roi_img Point(faces[i].x faces[i].y) Point(faces[i].x + faces[i].width faces[i].y + faces[i].height) Scalar(0 255 0) 1 8);
//
// /*switch (i)
// {
// case 0:imwrite(“D:/out/face0.jpg“ face_src); break;
// case 1:imwrite(“D:/out/face1.jpg“ face_src); break;
// case 2:imwrite(“D:/out/face2.jpg“ face_src); break;
// case 3:imwrite(“D:/out/face3.jpg“ face_src); break;
// case 4:imwrite(“D:/out/face4.jpg“ face_src); break;
// case 5:imwrite(“D:/out/face5.jpg“ face_src); break;
// case 6:imwrite(“D:/out/face6.jpg“ face_src); break;
// default:
// break;
// }*/
// }
//}


cvShowImage(“Camerafacedetection“ show);
//imshow(“roi_img“ roi_img);

c = waitKey(1);

}

return 0;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-10-17 19:12  videofacedetection(人脸可保存)\
     目录           0  2017-10-17 19:12  videofacedetection(人脸可保存)\videofacedetection\
     文件        2141  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\videofacedetection.cpp
     文件        7689  2017-07-13 15:35  videofacedetection(人脸可保存)\videofacedetection\videofacedetection.vcxproj
     文件         959  2017-04-11 13:23  videofacedetection(人脸可保存)\videofacedetection\videofacedetection.vcxproj.filters
     文件         165  2017-07-13 15:33  videofacedetection(人脸可保存)\videofacedetection\videofacedetection.vcxproj.user
     目录           0  2017-10-17 19:12  videofacedetection(人脸可保存)\videofacedetection\x64\
     目录           0  2017-10-17 19:12  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\
     文件      782336  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\vc120.pdb
     目录           0  2017-10-17 19:12  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\
     文件         604  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\cl.command.1.tlog
     文件       15422  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\cl.read.1.tlog
     文件         516  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\cl.write.1.tlog
     文件        2888  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\link.command.1.tlog
     文件        8582  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\link.read.1.tlog
     文件         338  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\link.write.1.tlog
     文件         201  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofac.4D4BDC2E.tlog\videofacedetection.lastbuildstate
     文件        1179  2017-08-29 08:45  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofacedetection.Build.CppClean.log
     文件         345  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofacedetection.log
     文件      130572  2017-09-15 19:44  videofacedetection(人脸可保存)\videofacedetection\x64\Debug\videofacedetection.obj
     目录           0  2017-10-17 19:12  videofacedetection(人脸可保存)\videofacedetection\x64\Release\
     文件      782336  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\vc120.pdb
     目录           0  2017-10-17 19:12  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\
     文件         742  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\cl.command.1.tlog
     文件       14734  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\cl.read.1.tlog
     文件         482  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\cl.write.1.tlog
     文件        3094  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\link.command.1.tlog
     文件        7282  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\link.read.1.tlog
     文件         456  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\link.write.1.tlog
     文件         182  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofac.4D4BDC2E.tlog\videofacedetection.lastbuildstate
     文件        2615  2017-04-26 09:29  videofacedetection(人脸可保存)\videofacedetection\x64\Release\videofacedetection.log
............此处省略10个文件信息

评论

共有 条评论