please make it a habit to check the output from imread() or cap.read() like:
if (np.shape(img)==())
break # read fail, invalid data
please make it a habit to check the output from imread() or cap.read() like:
if (np.shape(img)==())
break # read fail, invalid data