Ich habe ein Problem mit dem Programm in Python mit OpenCV geschrieben. Ich benutze Xubuntu (16.04), Python 3.6.Python OpenCV: Assertion fehlgeschlagen
Dies ist mein Code:
import cv2
import numpy as np
if __name__ == "__main__":
cap = cv2.VideoCapture('movie.mp4')
key = ord('a')
while key != ord('q'):
# Capture frame by frame
ret, frame = cap.read()
# Display the result of our processing
cv2.imshow('result', frame)
# Wait a little (30 ms) for a key press - this is required
# to refresh the image in our window
key = cv2.waitKey(30)
# When everytihnd done, releas the captyur and destroy created windows
cap.release()
cv2.destroyAllWindows
und das ist Fehler, die ich erhielt:
/home/xubuntu/anaconda3/bin/python "/home/xubuntu/PycharmProjects/untitled/lab1/zad7 wideo v2.py"
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/travis/miniconda/conda-bld/conda_1486587069159/work/opencv-3.1.0/modules/highgui/src/window.cpp, line 281
Traceback (most recent call last):
File "/home/xubuntu/PycharmProjects/untitled/lab1/zad7 wideo v2.py", line 13, in <module>
cv2.imshow('result', frame)
cv2.error: /home/travis/miniconda/conda-bld/conda_1486587069159/work/opencv-3.1.0/modules/highgui/src/window.cpp:281: error: (-215) size.width>0 && size.height>0 in function imshow
Process finished with exit code 1
zu übernehmen ich hinzufügen möchte, dass der gleiche Code unter Windows funktioniert. Könnten Sie mir bitte helfen?
Der Rahmen ist hier leer: 'cv2.imshow ('Ergebnis', Rahmen)' – ZdaR
Nun, der Rahmen scheint ein 0x0 Rahmen zu sein (also kein Inhalt). –
Das ist die Sache, die ich jetzt wirklich habe. Unter Linux funktioniert es nicht, aber unter Windows funktioniert es. Ich habe versucht, Berechtigungen für diese Datei zu ändern, aber es hat nicht funktioniert – fafal