python - Lepton PureThermal 在 Python3 OpenCV 中不起作用
问题描述
错误 [ERROR:0] 打开 VIDEOIO(AVFOUNDATION): 引发了未知的 c++ 异常!
规格详情
- MacBook Pro 2020 13"
- MacOS 版本:Bigsur 11.3.1
- OpenCV 版本:4.5.1
- Python版本:3.9.4
- 摄像头:连接到PureThermal 2的Lepton 2.5
- 在 iTerm 2 Build 3.4.6 上运行
问题说明
- 在Program Source下面运行 python 程序时出错
- cameraID = 0 指的是 Lepton,而 cameraID = 1 指的是默认网络摄像头。
- 如果我将 cameraID 更改为 1,代码将完美运行并显示我的网络摄像头
- 我检查了相机没有任何问题。我试图通过缩放应用程序将相机作为网络摄像头打开,并且显示出来了。
代码
import cv2
cv2.namedWindow("preview")
cameraID = 0
vc = cv2.VideoCapture(cameraID)
if vc.isOpened(): # try to get the first frame
rval, frame = vc.read()
else:
rval = False
while rval:
cv2.imshow("preview", frame)
rval, frame = vc.read()
key = cv2.waitKey(20)
if key == 27: # exit on ESC
break
其他附件
- 错误屏幕截图 - 终端:
- 缩放 - 选择网络摄像头(证明相机工作):
解决方案
推荐阅读
- javascript - 范围选择器日期在 Highcharts.Chart() 中始终为 1970-01-01
- angular - 如何在 Html angular5 中连接两个数组
- mysql - 用于选择没有与输入日期关联的预订的房间的 SQL 查询
- symfony - Symfony .env 生产模式下的安全密码
- c# - ASP.NET Core 自定义标签助手不起作用
- google-app-engine - Google AppEngine Standard 是否支持 java CDI?
- kubernetes - 对 kubernetes 上的 ravendb 部署进行故障排除
- python - 添加不同形状的numpy数组
- javascript - 带有映射的javascript中特定格式的数组显示
- c# - 使用 ChangeView() 缩放图像 - Windows 通用应用程序 - UWP Win10 - XAML