opencv学习+

1、安装imutils依赖包
sudo pip install imutils报错could not create’….’
——>pip install –user imutils

2、python与opencv进行基础的运动检测和追踪

笔记本摄像头人脸检测
  1 #coding=utf-8
  2 
  3 import cv2
  4 import time
  5 
  6 print("Press esc to exit")
  7 cascade_fn = "/usr/share/opencv/haarcascades/haarcascade_frontalface_default.xml"
  8 faceCascade = cv2.CascadeClassifier(cascade_fn)
  9 imgWindow = cv2.namedWindow("FaceDetect", cv2.WINDOW_NORMAL)
 10 
 11 def detect_face():
 12         capInput = cv2.VideoCapture(0)
 13         # 避免处理时间过长造成画面卡顿
 14         nextCaptureTime = time.time()
 15         faces = []
 16         if not capInput.isOpened():
 17                 print("Capture failed because of camera")
 18         while True:
 19                 ret, img = capInput.read()
 20                 gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
 21                 if nextCaptureTime < time.time():
 22                         nextCaptureTime = time.time() + 0.1
 23                         faces = faceCascade.detectMultiScale(gray, 1.3, 5)
 24                         for x, y, w, h in faces:
 25                                 img = cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
 26                 cv2.imshow("FaceDetect", img)
 27                 # 这是简单的读取键盘输入,27即ESC的acsii码
 28                 if cv2.waitKey(1) & 0xFF == 27:
 29                         break
 30         capInput.release()
 31         cv2.destroyAllWindows()
 32 
 33 if __name__ == "__main__":
 34         detect_face()

3、安装dlib第三方库
安装依赖库
sudo apt-get install libboost-python-dev cmake

python 依赖库
$ sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags Cython ipython

下载: dlib-18.16.tar.bz2
wget https://github.com/davisking/dlib/releases/download/v18.16/dlib-18.16.tar.bz2
解压: tar -jxvf dlib-18.16.tar.bz2
cd dlib-18.16/python_examples
运行 ./compile_dlib_python_module.bat
需要把dlib.so(需要先确认一下所在目录)拷贝到python的packages目录中
sudo cp dlib.so /usr/local/lib/python2.7/dist-packages/

4、

5、ssh连接
从远程主机拷贝东西
scp root@192.168.0.1:/home/root/XXX.tar /home/XXX/Downloads/
从本地上传远程主机
scp /home/XXX/xxx.tar root@192.168.0.1:/home/root

参考备注:
python.jobbole.com/84666/
www.cnblogs.com/darkknightzh/p/5652791.html
blog.youkuaiyun.com/zhou199019901990/article/details/21049163
http://blog.youkuaiyun.com/xingchenbingbuyu/article/details/68482838
http://blog.youkuaiyun.com/vicdd/article/details/52641615
http://dlib.net/files/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值