Dlib库【7】——物体追踪
来源:互联网 发布:大数据信息安全论文 编辑:程序博客网 时间:2024/06/16 22:59
配置Dlib环境: 链接
另外因为需要JPEG_SUPPORT所以最好利用Cmake编译一下Dlib.lib然后添加到附加依赖项
(当然也可以用opencv的载入图片,需要稍微修改下)
追踪效果如图:
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt/*This example shows how to use the correlation_tracker from the dlib C++ library. Thisobject lets you track the position of an object as it moves from frame to frame in avideo sequence. To use it, you give the correlation_tracker the bounding box of theobject you want to track in the current video frame. Then it will identify thelocation of the object in subsequent frames.In this particular example, we are going to run on the video sequence that comes withdlib, which can be found in the examples/video_frames folder. This video shows a juicebox sitting on a table and someone is waving the camera around. The task is to track theposition of the juice box as the camera moves around.*/#define DLIB_JPEG_SUPPORT#include <dlib/image_processing.h>#include <dlib/gui_widgets.h>#include <dlib/image_io.h>#include <dlib/dir_nav.h>using namespace dlib;using namespace std;int main(int argc, char** argv) try{if (argc != 2){cout << "Call this program like this: " << endl;cout << "./video_tracking_ex ../video_frames" << endl;return 1;}// Get the list of video frames. std::vector<file> files = get_files_in_directory_tree(argv[1], match_ending(".jpg"));std::sort(files.begin(), files.end());if (files.size() == 0){cout << "No images found in " << argv[1] << endl;return 1;}// Load the first frame. array2d<unsigned char> img;load_image(img, files[0]);// Now create a tracker and start a track on the juice box. If you look at the first// frame you will see that the juice box is centered at pixel point(92,110) and 38// pixels wide and 86 pixels tall.correlation_tracker tracker;tracker.start_track(img, centered_rect(point(93, 110), 38, 86));// Now run the tracker. All we have to do is call tracker.update() and it will keep// track of the juice box!image_window win;for (unsigned long i = 1; i < files.size(); ++i){load_image(img, files[i]);tracker.update(img);win.set_image(img);win.clear_overlay();win.add_overlay(tracker.get_position());cout << "hit enter to process next frame" << endl;cin.get();}}catch (std::exception& e){cout << e.what() << endl;cout << 233;}
效果看着真的好棒啊,哈哈
阅读全文
0 0
- Dlib库【7】——物体追踪
- Dlib库【2】——Socket相关
- Dlib库【8】——多层神经网络
- dlib 06 dlib自带demo 视频内物体跟踪
- 【机器学习】Dlib——机器学习库学习系列
- Dlib库【3】——Thread线程,数据统计
- Dlib库【4】——定时器Timer,线程对象
- Dlib库【10】——计算积分,读取xml显示
- Dlib库【9】——Surf特征点
- 用anaconda安装dlib库(python—opencv)
- 图像处理13:物体追踪
- dlib——机器学习工具箱
- DSAPI之摄像头追踪指定颜色物体
- python+opencv实现动态物体追踪
- 【图像处理】openCV光流法追踪运动物体
- opencv+arduino进行物体点追踪
- Opencv光流运动物体追踪
- 用于物体追踪的.avi视频文件
- Logger日志级别说明及设置方法、说明
- 532
- PHP那些琐碎的知识点
- C# iTextSharp 带书签合并多个PDF
- 删除字符串中出现最少次数的字符
- Dlib库【7】——物体追踪
- C++接口:纯虚类
- 关闭页面时提示是否关闭
- JAVA二维数组动态赋值
- j2ee的web项目中,什么是分布式系统,很简单的例子,易上手
- HTML代码中%%、%=%、%%各是什么意思
- .py文件打包成.exe可执行文件方法
- ODOO的data_dir参数不可改变
- (HDU 6027 女生专场)Easy Summation 水题 预处理