## 基于GPU加速的OpenCV人体检测(Full Body Detection)
### 1、CUDA和OpenCV的安装
首先,确定一下自己的平台是否安装好了CUDA和OpenCV。
CUDA的安装可以参考:[http://blog.csdn.net/frd2009041510/article/details/42042807](http://blog.csdn.net/frd2009041510/article/details/42042807)和[http://blog.csdn.net/frd2009041510/article/details/42925205](http://blog.csdn.net/frd2009041510/article/details/42925205)
OpenCV的安装可以参考:[http://blog.csdn.net/frd2009041510/article/details/42930113](http://blog.csdn.net/frd2009041510/article/details/42930113)
### 2、Simply build the OpenCV HOG (Hough Of Gradients) sample person detector program
~~~
cd opencv-2.4.9/samples/gpu
g++ hog.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_video -lopencv_videostab -o hog
~~~
进入目录:
![](https://box.kancloud.cn/2016-05-07_572d61737f9a4.jpg)
编译:
![](https://box.kancloud.cn/2016-05-07_572d617395e43.jpg)
### 3、run the HOG demo
~~~
./hog --video 768x576.avi
~~~
注意:You can run the HOG demo such as on a pre-recorded video of people walking around. The HOG demo displays a graphical output, hence you should plug a HDMI monitor in or use a remote viewer such as X Tunneling or VNC or TeamViewer on your desktop in order to see the output.
结果截图如下:
![](https://box.kancloud.cn/2016-05-07_572d6173aacd9.jpg)
![](https://box.kancloud.cn/2016-05-07_572d6173c2d62.jpg)
如果有摄像头,可以执行下面的命令来完成演示:
~~~
./hog --camera 0
~~~
![](https://box.kancloud.cn/2016-05-07_572d61740fe61.jpg)
注意:Note: This looks for whole bodies and assumes they are small, so you need to stand atleast 5m away from the camera if you want it to detect you!
结果截图如下:
![](https://box.kancloud.cn/2016-05-07_572d617423687.jpg)
### 4、HOG demo中的一些控制命令
**You can toggle between CPU vs GPU by pressing 'm', where you will see that the GPU is typically 5x faster at HOG than the CPU!**
![](https://box.kancloud.cn/2016-05-07_572d617451017.jpg)
- 前言
- NVIDIA Jetson TK1学习与开发(一):NVIDIA Jetson TK1介绍
- NVIDIA Jetson TK1学习与开发(二):入门指导
- NVIDIA Jetson TK1学习与开发(三):图文详解Jetson TK1平台搭建
- NVIDIA Jetson TK1学习与开发(四):一些细节问题
- NVIDIA Jetson TK1学习与开发(五):helloworld的C版本与C++版本
- NVIDIA Jetson TK1学习与开发(六):如何安装CUDA
- NVIDIA Jetson TK1学习与开发(七):图文详解OpenCV在Jetson TK1上的安装和使用
- NVIDIA Jetson TK1学习与开发(八):图文详解OpenGL在Jetson TK1上的安装和使用
- NVIDIA Jetson TK1学习与开发(九):基于GPU加速的OpenCV人体检测(Full Body Detection)
- NVIDIA Jetson TK1学习与开发(十):人脸检测(Face Detection)
- NVIDIA Jetson TK1学习与开发:如何解决输入和输出音频问题