Opencv Camera crashes with exit code -1073741819 (0xC0000005)

0

Here is the code for my live camera in 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()

The problem is, it runs good. Quite good, but after certain time, (not exactly the same every time), the camera crashes with the exit code -1073741819 (0xC0000005). No errors, nothing. I don't even remember tweaking any settings, apart from one regedit setting when camera was failed to be detected by the laptop, but later I reverted whatever I did. Any solution for this problem please?

python
windows
opencv
camera
asked on Stack Overflow Sep 16, 2019 by Sanjiv Gautam • edited Sep 16, 2019 by Sanjiv Gautam

1 Answer

1

if you are running it on the Raspberry Pi, it crashes when the memory is full and you have to reload it in order to bypass this error

answered on Stack Overflow Sep 16, 2019 by Bloom

User contributions licensed under CC BY-SA 3.0