Segmentation error (kernel flushing) python

I am a beginner python. I want to read a frame from avi files, and I am writing the following code. When I run this code, I get a message like "Segment dump" (core dumped). Can anyone tell me the reason. I am sure I used the correct root of the avi file. I am trying to find the problem using ipython. I found that an error occurred while reaching the line ret, frame = cap.read ().

import numpy as np
import cv2

cap = cv2.VideoCapture('/home/sunjia/code/night_goto.avi')

while(cap.isOpened()):
    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()
+4
source share
1 answer

Change Bye Condition

   while(ret):

Try it!

**** **** while : ret, frame = cap.read().read() : frame boolean: "True", - "False", . , 'ret' 'while()'. while() , "ret, frame = cap.read()" .

+1

Source: https://habr.com/ru/post/1618965/


All Articles