使用dlib的视频人脸检测
video face detection using dlib
我正在尝试制作一个离线视频人脸检测程序。我已经使用了人脸检测的示例代码,它运行良好。但由于dlib库不能直接用于视频(或者我不知道它是否可以),我将为图像人脸检测程序提供帧。对于像20-30帧视频这样的小视频,它工作得很好,但如果给一个更大的视频,它就会出现缓冲区溢出错误。我必须明确地删除数据或清除某些动态内存吗?还是它只处理很少的人脸检测图像?
以下是的代码片段
// Loop over all the images provided on the command line.
for (int i = 1; i <= 629; ++i)
{
//cout << "processing image " << endl;
array2d<unsigned char> img;
//load_image(img, argv[i]);
sprintf(image, "./frame/frame%d.jpg",i);
load_image(img, image);
pyramid_up(img);
// Now tell the face detector to give us a list of bounding boxes
// around all the faces it can find in the image.
std::vector<rectangle> dets = detector(img);
//cout << "Number of faces detected: " << dets.size() << endl;
//cout<<i<<"t"<<dets.size()<<endl;
// Now we show the image on the screen and the face detections as
// red overlay boxes.
win.clear_overlay();
win.set_image(img);
win.add_overlay(dets, rgb_pixel(255,0,0));
//cout << "Hit enter to process the next image..." << endl;
//cin.get();
}
以下是这种集成的示例
http://dlib.net/webcam_face_pose_ex.cpp.html
您应该只更改
cv::VideoCapture cap(0);
进入
cv::VideoCapture videoCapture;
videoCapture.open(fileName);
如果你的帧很大,那么检测就会很慢。因此,最好调整帧的大小,然后执行跟踪/检测过程。
相关文章:
- 如何在c++中录制具有精确帧时间戳的视频
- 使用 IMFSinkWriter 编码的视频的播放速度会根据宽度而变化
- 如何实时捕获相机的视频?
- 帧提取 使用OpenCV的视频文件开头只有几秒钟
- 使用 OpenCV C++ 每 1 分钟创建新的视频文件
- 从iPhone相机拍摄的视频似乎被OpenCV旋转了90度?我该如何解决这个问题?
- 在Qt3D中进行碰撞检测的预期方法(或好方法)是什么?
- 具有周期检测的呼叫研磨性能分析
- OpenCV没有显示来自Macbook网络摄像头的视频
- CGAL:手动创建用于形状检测的点集
- 在何处更改参考代码以从 HEVC 编码的视频中提取运动矢量
- 如何使用FFMPEG从编码的视频中提取AVPACKET的重要信息
- 我的视频流程在运行darknet.exe以进行检测对象时崩溃了
- 如何使用Raspberry Pi相机作为C ++ OpenCV中的视频输入
- OpenCV噪声消除静态摄像机的视频
- 用于成员函数检测的递归type_traits
- 如何使用FFMPEG与C拦截编码的视频数据
- 如何检测两个连续的视频帧是否相同
- 使用dlib的视频人脸检测
- 检测实时视频上的冲浪点