【问题标题】:Opencv Camera crashes with exit code -1073741819 (0xC0000005)Opencv 相机崩溃,退出代码为 -1073741819 (0xC0000005)
【发布时间】:2020-01-17 07:48:57
【问题描述】:

这是我在 opencv 中的实时摄像头的代码。

 cap = cv2.VideoCapture(0)
 while(True):
    ret, frame = cap.read()
    # Our operations on the frame come here
    # Display the resulting frame

    cv2.rectangle(frame, (0,0,int(frame.shape[0]/3),frame.shape[1]),(255,0,0),2)
    cv2.rectangle(frame, (int(frame.shape[0]),0,int(frame.shape[0]*(1/3)),frame.shape[1]),(0,0,255),2)
    #
    # leftPortion = frame[:,0:int(frame.shape[0]/3),:]
    # rightPortion = frame[:,int(frame.shape[0]*(3/3)):,:]

    # BOXES = detect_hands(frame,graph,sess)
    # boxes = predict(BOXES,frame.shape[0],frame.shape[1])
    #
    # x_min, x_max, y_min, y_max = boxes[0]
    # x = int((x_min + x_max) / 2)
    # y = int((y_min + y_max) / 2)
    # cv2.circle(frame, (x, y), 5, (255,0,0), -1)
    # if len(boxes) == 1:
    #     x_min, x_max, y_min, y_max = boxes[0]
    #     x = int((x_min + x_max) / 2)
    #     y = int((y_min + y_max) / 2)
    #     cv2.circle(frame, (x, y), 20, (255,0,0), -1)
    cv2.imshow('window',frame)
    if cv2.waitKey(1)==ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

问题是,它运行良好。相当不错,但经过​​一段时间后(每次都不完全相同),相机崩溃,退出代码为 -1073741819 (0xC0000005)。没有错误,什么都没有。我什至不记得调整任何设置,除了笔记本电脑无法检测到相机时的一个注册表设置,但后来我恢复了我所做的一切。请问这个问题有什么解决办法吗?

【问题讨论】:

    标签: python windows opencv camera


    【解决方案1】:

    如果你在树莓派上运行它,当内存已满时它会崩溃,你必须重新加载它才能绕过这个错误

    【讨论】:

    • 在笔记本电脑上运行。 1060 GTX NVIDIA,16 GB RAM。
    • 你是在 jupyter notebook 中运行它吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-18
    • 1970-01-01
    • 2018-11-10
    • 2020-06-13
    • 2021-09-03
    • 1970-01-01
    相关资源
    最近更新 更多