简体   繁体   English

Visual Studio 代码不会将 opencv 库导入 python

[英]Visual studio code doesn't import opencv library into python

I was trying to write a python file that opens the camera,only that when I write import cv2 it gives me an error我试图编写一个打开相机的 python 文件,只是当我写import cv2时它给了我一个错误

在此处输入图像描述

Try the following:尝试以下操作:

import cv2
vc = cv2.VideoCapture(0)

while True:
    _, frame = vc.read()
   cv2.imshow('frame', frame)

vc.release()
cv2.destroyAllWindows()

If this does not work, can you specify your error?如果这不起作用,你能指定你的错误吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM