网站建设建设公司哪家好,自己如何建设个网站首页,wordpress微缩图,单页网站源码树莓派摄像头基础配置
step 1 硬件连接
硬件连接#xff0c;注意不要接反了#xff0c;排线蓝色一段朝向网口的方向。#xff08;笔者的设备是树莓派4B#xff09; step 2 安装raspi-config
安装 raspi-config
raspi-config在raspbian中是预装的#xff0c;而在kali、…树莓派摄像头基础配置
step 1 硬件连接
硬件连接注意不要接反了排线蓝色一段朝向网口的方向。笔者的设备是树莓派4B step 2 安装raspi-config
安装 raspi-config
raspi-config在raspbian中是预装的而在kali、ubuntu mate、ubuntu server、osmc等系统中则是没有内置raspi-config的但是raspi-config的gui设置有时是相对方便的比如kali默认没有完整的使用整个SD卡空间而针对树莓派最好的扩展工具是raspi-config 下载deb包 wget http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20200601_all.deb安装相关依赖 sudo apt install lua5.1 libatopology2 libfftw3-single3 libsamplerate0 alsa-utils安装raspi-config sudo dpkg -i raspi-config_20200601_all.deb测试打开raspi-config远程ssh连接用终端也可以打开哦 sudo raspi-config出现以下界面表示安装成功。 step 3 启动摄像头
上一步成功后选择iterfacing options再选择camera。 如果此步出现如下报错的情况 解决方法
先看一下自己的磁盘分区情况
df -hl找到/dev/mmcblk0p2不同的机器后面的名称可能不同。
挂载到/boot
sudo mount /dev/mmcblk0p2 /bootstep 4 测试摄像头
我们用拍照的形式测试摄像头是否正常运作
raspistill -v -o /tmp/a.jpg如果摄像头正常即可在/tmp目录下找到a.jpg文件。 OpenCV C/Python 摄像头测试代码
C
#include opencv.hppint main()
{//读取视频或摄像头cv::VideoCapture capture(0);capture.set(cv::CAP_PROP_FRAME_WIDTH, 640);capture.set(cv::CAP_PROP_FRAME_HEIGHT, 480);while (true){cv::Mat frame;capture frame;cv::imwrite(cam_test.jpg, frame);cv::waitKey(30); //延时30}return 0;
}Python
import cv2vc cv2.VideoCapture(0)
ret, frame vc.read()
print(ret, frame)
if ret:img frame
# print(img.shape)
cv2.imwrite(test.jpg, img)之后打算做一下人脸识别手、势识别之类的计算机视觉树莓派的应用有兴趣的小伙伴一起留言讨论呀。
Ref
https://blog.csdn.net/oray2013/article/details/90045179
https://blog.csdn.net/qq_34493401/article/details/107672691
https://my.oschina.net/zhenggao/blog/4336535