在python / linux中运行这段代码时:
import numpy as numpy
import cv2
import os
os.system('clear')
cap = cv2.VideoCapture('vid_1.mp4')
q = 0
while(cap.isOpened()):
ret, frame == cap.read()
if ret == True:
q += 1
print("Frame No: " + q)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2,destroyAllWindows()
我遇到以下错误:
print("Frame No: " + q)
^
IndentationError: unindent does not match any outer indentation level
此外, os.system(' clear')似乎没有清除屏幕。我认为基本缺失了,有什么可以取悦的?感谢