简体   繁体   English

OpenCV 退出代码 -1073741819 (0xC0000005)

[英]OpenCV exit code -1073741819 (0xC0000005)

This is my program:这是我的程序:

import numpy as np
import cv2

cap = cv2.VideoCapture(1)

while(True):

    ret, frame = cap.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)


    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break


cap.release()
cv2.destroyAllWindows()

And the result:结果:

exit code -1073741819 (0xC0000005)

I am running my program in Windows 7. My Python version is 3.6 in Pycharm.我在 Windows 7 中运行我的程序。我的 Python 版本是 Pycharm 中的 3.6。

I got this code to run on my computer by changing the 1 to a 0 in the line cap = cv2.VideoCapture(1) .我通过将cap = cv2.VideoCapture(1)行中的 1 更改为 0 来让此代码在我的计算机上运行。 This integer value determines which camera is used to capture an image.这个 integer 值决定了使用哪个相机来捕捉图像。 Passing 0 tells OpenCV to use the first camera on your device.传递 0 告诉 OpenCV 使用设备上的第一个摄像头。 If your device, like mine, only has one camera, then telling it to use the second camera by passing 1 will result in errors.如果你的设备和我的一样只有一个摄像头,那么通过传递 1 来告诉它使用第二个摄像头会导致错误。

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

相关问题 使用 OpenCV 退出代码 -1073741819 (0xC0000005) - Exit code -1073741819 (0xC0000005) with OpenCV Opencv相机崩溃,退出代码为-1073741819(0xC0000005) - Opencv Camera crashes with exit code -1073741819 (0xC0000005) 进程在 Pycharm 中以退出代码 -1073741819 (0xC0000005) 完成 - Process finished with exit code -1073741819 (0xC0000005) in Pycharm 进程以退出代码 -1073741819 (0xC0000005) Pycharm 结束 - Process finished with exit code -1073741819 (0xC0000005) Pycharm 进程完成,退出代码 -1073741819 (0xC0000005) - Rpy2 - Process finished with exit code -1073741819 (0xC0000005) - Rpy2 运行成功后,Django Web应用程序偶尔会退出代码-1073741819(0xC0000005) - Occasional Exit code -1073741819 (0xC0000005) with Django web app after a successful Run 在 PyCharm 上使用 PyWavelets 完成退出代码 -1073741819 (0xC0000005) - Process finished with exit code -1073741819 (0xC0000005) using PyWavelets on PyCharm 使用 numba.jit 以退出代码 -1073741819 (0xC0000005) 完成的过程 - Process finished with exit code -1073741819 (0xC0000005) with numba.jit 如何修复错误“进程以退出代码-1073741819(0xC0000005)完成” - How to fix the error `Process finished with exit code -1073741819 (0xC0000005)` 流程结束,退出代码为-1073741819(0xC0000005)(Cython,TeamSpeak3) - Process finished with exit code -1073741819 (0xC0000005) (Cython, TeamSpeak3)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM