gpt4 book ai didi

python - Opencv相机崩溃,退出代码-1073741819(0xC0000005)

转载 作者:行者123 更新时间:2023-12-02 17:27:56 26 4
gpt4 key购买 nike

这是我在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)。没有错误,没事。除了笔记本电脑无法检测到相机时的一个注册表编辑设置外,我什至不记得进行任何设置调整,但是后来我恢复了所做的一切。对这个问题有什么解决办法吗?

最佳答案

如果您在Raspberry Pi上运行它,则在内存已满时它将崩溃,并且您必须重新加载它才能绕过此错误

关于python - Opencv相机崩溃,退出代码-1073741819(0xC0000005),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57957437/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com