当前位置:网站首页>Maixll-Dock 摄像头使用
Maixll-Dock 摄像头使用
2022-07-06 10:14:00 【咸鱼箘】
我玩V831的顺序是,先测试单个硬件,了解相关用法,后面结合使用。所以想看完整案例的小伙伴可以先不用看摄像头的使用和屏幕的使用这两篇文章。直接看后面案例就可以。
摄像头工作原理
图像传感器-摄像头
摄像头(CAMERA或WEBCAM)又称为电脑相机、电脑眼、电子眼等,是一种视频输入设备,被广泛的运用于视频会议、远程医疗及实时监控等方面。普通的人也可以彼此通过摄像头在网络进行有影像、有声音的交谈和沟通。
原理:景物通过镜头(LENS)生成光学图像投射到图像传感器表面上,转为电信号,经过A/D(模数转换)后变为数字信号.
再传到数字信号处理芯片(DSP)中加工处理,通过USB接口传输到电脑中处理,通过显示器可以看到图像。
PS:原理不用深究,咱又不做摄像头设计,了解一下就行
camera 模块
PS:单纯地讲一个模块的使用方法,后面讲完其他模块才会结合使用。
- 导入模块
from maix import camera
- 方法说明
方法 | 说明 |
---|---|
camera.width() | 返回当前摄像头配置的图像的宽 |
camera.height() | 返回当前摄像头配置的图像的高 |
camera.config(size=(240, 240)) | 主要用于配置摄像头,设置获取图像大小 |
camera.capture() | 捕获一张图像并返回 _maix_image.image |
camera.close() | 关闭、释放当前设备 |
- 方法演示
摄像头用法不算难,后面我们用到哪个案例就讲哪个。
拍摄图片并保存
摄像头综合案例较多,我们本篇只搞一个最简单的,就是拍照保存。有了这个功能,我们后面可以搞人员识别(识别人脸,在识别库的人进行下一步动作)。
我们保存的目标是我们的U盘,方便我们后续提取。地址为root/app/设置的图片.格式
from maix import camera
img = camera.capture()
img.save('root/app/xianyu.jpg')
将上面的代码放到IDE上
在运行代码之前,打开U盘
ADB进入root/app(U盘)路径
[email protected]:/# cd root/app
cd root/app
[email protected]:~/app# ls
main.py maixhub main.py.log run.py
运行代码后发现U盘没有图片。
ADB执行ls后,可以看到root/app
下已经有了我们想要保存的照片。说明照片已经存了,但是U盘没有显示。
[email protected]sipeed:~/app# ls
main.py maixhub main.py.log run.py xianyu.jpg
此时执行reboot重启一下
照片就来了。~
下一篇,屏幕的使用,有了屏幕和摄像头结合我们就可以做更多的事情了
边栏推荐
- Five data structures of redis
- C语言指针*p++、*(p++)、*++p、*(++p)、(*p)++、++(*p)对比实例
- C language exchanges two numbers through pointers
- 从交互模型中蒸馏知识!中科大&美团提出VIRT,兼具双塔模型的效率和交互模型的性能,在文本匹配上实现性能和效率的平衡!...
- There is a gap in traditional home decoration. VR panoramic home decoration allows you to experience the completion effect of your new house
- Windows connects redis installed on Linux
- Interview shock 62: what are the precautions for group by?
- Virtual machine VirtualBox and vagrant installation
- 第三季百度网盘AI大赛盛夏来袭,寻找热爱AI的你!
- Jerry's updated equipment resource document [chapter]
猜你喜欢
Comparative examples of C language pointers *p++, * (p++), * ++p, * (++p), (*p) + +, +(*p)
78 year old professor Huake has been chasing dreams for 40 years, and the domestic database reaches dreams to sprint for IPO
关于这次通信故障,我想多说几句…
Rb157-asemi rectifier bridge RB157
Ms-tct: INRIA & SBU proposed a multi-scale time transformer for motion detection. The effect is SOTA! Open source! (CVPR2022)...
Today in history: the mother of Google was born; Two Turing Award pioneers born on the same day
2019阿里集群数据集使用总结
2019 Alibaba cluster dataset Usage Summary
Interesting - questions about undefined
Getting started with pytest ----- test case pre post, firmware
随机推荐
The easycvr authorization expiration page cannot be logged in. How to solve it?
OpenEuler 会长久吗
關於這次通信故障,我想多說幾句…
The shell generates JSON arrays and inserts them into the database
Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery
2022暑期项目实训(一)
Smart street lamp based on stm32+ Huawei cloud IOT design
2022 Summer Project Training (III)
2019 Alibaba cluster dataset Usage Summary
Jerry's watch reading setting status [chapter]
In terms of byte measurement with an annual salary of 30W, automated testing can be learned in this way
Common - magic number 7
FMT开源自驾仪 | FMT中间件:一种高实时的分布式日志模块Mlog
Olivetin can safely run shell commands on Web pages (Part 1)
MSF horizontal MSF port forwarding + routing table +socks5+proxychains
Declval of template in generic programming
Heavy! Ant open source trusted privacy computing framework "argot", flexible assembly of mainstream technologies, developer friendly layered design
Codeforces Round #803 (Div. 2)
What is the reason why the video cannot be played normally after the easycvr access device turns on the audio?
Getting started with pytest ----- test case pre post, firmware