macos - M1 MAC 的 opencv 问题 - OpenCV imshow 不起作用

我购买了 M1 Mac。有人对 imshow with opencv 有问题吗?我做了 pip install opencv-python 和 brew install opencv 以及 brew install opencv。

import cv2
import urllib
import numpy as np
import requests
url = 'https://www.visitcalifornia.com/sites/visitcalifornia.com/files/styles/welcome_image/public/vc_crtr_borntobewild_module_mendocino_st_rf_623667652_1280x640.jpg'
from skimage import io
img = io.imread(url)
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
cv2.imshow('URL Image', img)
cv2.waitKey()

还有


import cv2

cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)

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

cv2.destroyWindow("preview")
vc.release()

不适合我

最佳答案

解决了

 pip install opencv-python opencv-python-headless

https://stackoverflow.com/questions/65278632/

相关文章:

flutter - 有什么方法可以将查询参数插入 flutter web 中的命名路由?

css - react/next.js 中的 * 选择器

docker - containerd 中的 docker volumes 是什么?

docker - Docker 中 dotnet/aspnet :3. 1 的 list 条目中没有

python - 如何在 Python 的 Tkinter 中使用 .create_image

reactjs - 如何强制更新功能组件?

python - 将前导零添加到日期和时间字符串中的小时数

typescript - 是否可以修改 TypeScript 中文字的推断类型?

gpu - Spacy + GPU 给出错误 : GPU is not accessible. 库是

bootstrap-modal - Bootstrap v5,如何在模式中传递变量(没有 jquer