ubantu打开摄像头失败
摘要-针对ubantu20
sudo apt install v4l-utils
v4l2-ctl --list-devices
- cv2 install on ubantu20
```
针对ubantu20
sudo apt install v4l-utils
v4l2-ctl --list-devices
pip uninstall opencv-python
conda install pyqt
pip install opencv-python==4.1.2.30
```
(py38) itdb@ai:/opt/aisty/doc/aitools$ /opt/aisty/app/anaconda3/envs/py38/bin/python /opt/aisty/doc/aitools/case/face/04-tt.py
VIDEOIO ERROR: V4L2: Could not obtain specifics of capture window.
[ WARN:0] global /io/opencv/modules/videoio/src/cap_v4l.cpp (802) open VIDEOIO ERROR: V4L: can't open camera by index 1
/dev/video1 does not support memory mapping
Traceback (most recent call last):
File "/opt/aisty/doc/aitools/case/face/04-tt.py", line 18, in <module>
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 转换为灰度图
cv2.error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
查看摄像头编号
v4l2-ctl --list-devices
(base) itdb@ai:~/Desktop$ find /lib/modules/ -name "*v4l2*.ko"
/lib/modules/5.8.0-59-generic/kernel/drivers/media/v4l2-core/v4l2-dv-timings.ko
/lib/modules/5.8.0-59-generic/kernel/drivers/media/v4l2-core/v4l2-flash-led-class.ko
/lib/modules/5.8.0-59-generic/kernel/drivers/media/v4l2-core/v4l2-fwnode.ko
/lib/modules/5.8.0-59-generic/kernel/drivers/media/v4l2-core/v4l2-mem2mem.ko
/lib/modules/5.8.0-59-generic/kernel/drivers/media/i2c/adv7511-v4l2.ko
/lib/modules/5.8.0-59-generic/kernel/drivers/media/common/v4l2-tpg/v4l2-tpg.ko
/lib/modules/5.8.0-59-generic/kernel/drivers/media/common/videobuf2/videobuf2-v4l2.ko
/lib/modules/5.8.0-43-generic/kernel/drivers/media/v4l2-core/v4l2-dv-timings.ko
/lib/modules/5.8.0-43-generic/kernel/drivers/media/v4l2-core/v4l2-flash-led-class.ko
/lib/modules/5.8.0-43-generic/kernel/drivers/media/v4l2-core/v4l2-fwnode.ko
/lib/modules/5.8.0-43-generic/kernel/drivers/media/v4l2-core/v4l2-mem2mem.ko
/lib/modules/5.8.0-43-generic/kernel/drivers/media/i2c/adv7511-v4l2.ko
/lib/modules/5.8.0-43-generic/kernel/drivers/media/common/v4l2-tpg/v4l2-tpg.ko
/lib/modules/5.8.0-43-generic/kernel/drivers/media/common/videobuf2/videobuf2-v4l2.ko
/lib/modules/5.8.0-63-generic/kernel/drivers/media/v4l2-core/v4l2-dv-timings.ko
/lib/modules/5.8.0-63-generic/kernel/drivers/media/v4l2-core/v4l2-flash-led-class.ko
/lib/modules/5.8.0-63-generic/kernel/drivers/media/v4l2-core/v4l2-fwnode.ko
/lib/modules/5.8.0-63-generic/kernel/drivers/media/v4l2-core/v4l2-mem2mem.ko
/lib/modules/5.8.0-63-generic/kernel/drivers/media/i2c/adv7511-v4l2.ko
/lib/modules/5.8.0-63-generic/kernel/drivers/media/common/v4l2-tpg/v4l2-tpg.ko
/lib/modules/5.8.0-63-generic/kernel/drivers/media/common/videobuf2/videobuf2-v4l2.ko
(base) itdb@ai:~/Desktop$ sudo apt-get install v4l2-ctl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package v4l2-ctl
(base) itdb@ai:~/Desktop$ v4l2-ctl --list-devices Command 'v4l2-ctl' not found, but can be installed with: sudo apt install v4l-utils (base) itdb@ai:~/Desktop$ sudo apt install v4l-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-5.8.0-43-generic linux-hwe-5.8-headers-5.8.0-43 linux-image-5.8.0-43-generic linux-modules-5.8.0-43-generic
linux-modules-extra-5.8.0-43-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libv4l2rds0
The following NEW packages will be installed:
libv4l2rds0 v4l-utils
0 upgraded, 2 newly installed, 0 to remove and 15 not upgraded.
Need to get 602 kB of archives.
After this operation, 2,274 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 libv4l2rds0 amd64 1.18.0-2build1 [15.8 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu focal/universe amd64 v4l-utils amd64 1.18.0-2build1 [586 kB]
Fetched 602 kB in 3s (180 kB/s)
Selecting previously unselected package libv4l2rds0:amd64.
(Reading database ... 252070 files and directories currently installed.)
Preparing to unpack .../libv4l2rds0_1.18.0-2build1_amd64.deb ...
Unpacking libv4l2rds0:amd64 (1.18.0-2build1) ...
Selecting previously unselected package v4l-utils.
Preparing to unpack .../v4l-utils_1.18.0-2build1_amd64.deb ...
Unpacking v4l-utils (1.18.0-2build1) ...
Setting up libv4l2rds0:amd64 (1.18.0-2build1) ...
Setting up v4l-utils (1.18.0-2build1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
(base) itdb@ai:~/Desktop$ v4l2-ctl --list-devices
Synaptics RMI4 Touch Sensor (rmi4:rmi4-00.fn54):
/dev/v4l-touch0 USB Camera: USB Camera (usb-0000:00:14.0-1):
/dev/video2
/dev/video3 Integrated Camera: Integrated C (usb-0000:00:14.0-6):
/dev/video0
/dev/video1
Integrated Camera 电脑集成摄像机的编号是0,1
外部插的USB摄像机编号是2,3
编号改为2,即可调用外部摄像头
# 摄像头
cap = cv2.VideoCapture(2)
ubantu打开摄像头失败的更多相关文章
- OpenCV打开摄像头失败
<span style="font-family: Arial, Helvetica, sans-serif;">#include <stdio.h>< ...
- 项目实战:Qt+Ffmpeg+OpenCV相机程序(打开摄像头、支持多种摄像头、分辨率调整、翻转、旋转、亮度调整、拍照、录像、回放图片、回放录像)
若该文为原创文章,未经允许不得转载原博主博客地址:https://blog.csdn.net/qq21497936原博主博客导航:https://blog.csdn.net/qq21497936/ar ...
- JS打开摄像头并截图上传
直入正题,JS打开摄像头并截图上传至后端的一个完整步骤 1. 打开摄像头主要用到getUserMedia方法,然后将获取到的媒体流置入video标签 2. 截取图片主要用到canvas绘图,使用dra ...
- python3脚本打开摄像头
openCamera 脚本地址:https://github.com/Mrlshadows/openCamera Mac OS 安装 OpenCV Python 环境为 python3 终端执行如下指 ...
- opencvbase 实现opencv打开摄像头和初步处理等效果操作(附源码)
// TwoCameraOnTimer2Dlg.cpp : 实现文件 /* CvMat, Mat, IplImage之间的互相转换 IpIImage -> CvMat CvMat mathead ...
- html5打开摄像头并用canvas模拟拍照 - 转
<video id="video" width="640" height="480" autoplay></video&g ...
- andriod打开摄像头和打开相册
package com.example.yanlei.picture; import android.support.v7.app.AppCompatActivity; import android. ...
- html5打开摄像头并用canvas模拟拍照
网上很多关于用HTML5打开本地摄像头的文章,但各有瑕疵.根据我自己的亲身体验,我分享一下我用HTML5打开摄像头的经验. 废话不多说,直接看代码. HTML代码: <video id=&quo ...
- 解决Android调用相机拍照,要报“打开相机失败”查看debug日志显示“setParameters failed”的问题
使用CameraLibrary项目,在部分手机或平板上不能正常使用,要报“打开相机失败”查看debug日志显示“setParameters failed”. 找到CameraView.java中的se ...
随机推荐
- 谷歌chrome多个相同用户登陆同一个机器多开配置
创建快捷方式,目标中填写:路径+参数如下所示即可 参数:--user-data-dir=%LOCALAPPDATA%\Google\Chrome\%SessionName%
- clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused)
clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused) 关闭防火墙,可以连, ...
- Linux下向windows传输文件【sz 文件】没有弹框提示下载到什么位置
Linux环境向windows环境传输文件 security crt工具,同同一个软件,连接不同服务器,有的服务器传送文件没有弹框选择要下载的文件路径,可以在[Options]-[Session Op ...
- Cobar SQL审计的设计与实现
背景介绍 Cobar简介 Cobar 是阿里开源的一款数据库中间件产品. 在业务高速增长的情况下,数据库往往成为整个业务系统的瓶颈,数据库中间件的出现就是为了解决数据库瓶颈而产生的一种中间层产品. 在 ...
- httprunner3源码解读(2)models.py
源码目录结构 我们首先来看下models.py的代码结构 我们可以看到这个模块中定义了12个属性和22个模型类,我们依次来看 属性源码分析 import os from enum import Enu ...
- c++ IO库
1:为了支持使用宽字符的语言,标准库定义了一组类型和对象来操作wchar_t类型的数据.宽字符版本的类型和函数的名字以w开头.宽字符版本和普通的char版本定义在同一个头文件中,例如头文件fstrea ...
- CCCC-exercise
CCCC-exercise 1.L1 总结L1 1-27里面我觉得有东西可以总结的题目 贴了部分的代码 L1-006(20) 一个正整数 N 的因子中可能存在若干连续的数字.例如 630 可以分解为 ...
- 教你用SQL进行数据分析
摘要:采用 SQL 作为数据查询和分析的入口是一种数据全栈的思路. 本文分享自华为云社区<如何使用 SQL 对数据进行分析?>,作者:zuozewei . 前言 我们通过 OLTP(联机事 ...
- BootStrap中模态框踩坑
在模态框中使用html标签上的自定义属性来打开模态框后,在使用JS关闭模态框,就会出现多层蒙板问题 出现这个问题的原因就是没有仔细看bootstrap的官方文档,我人麻了,搞了好久 务必将模态框的 H ...
- [luogu7340]Balance
构造一个坐标系,共有$n$个黑点和百点,第$i$个黑点为$(p_{i},a_{i})$,第$i$个白点为$(-q_{i},-b_{i})$ 考虑第$i$个黑点和第$j$个白点连线的斜率,恰好就是$f( ...