【发布时间】:2017-06-09 19:49:50
【问题描述】:
所以我几天前刚开始编程,我遇到了这个问题:AttributeError: 'NoneType' object has no attribute 'tostring'。不知道怎么回事。
#Reads through each frame, calculates the timestamp, places it on the frame and
#exports the frame to the output video.
while current_frame < total_frames:
success, image = video.read()
elapsed_time = video.get(cv2.CAP_PROP_POS_MSEC)
current_frame = video.get(cv2.CAP_PROP_POS_FRAMES)
timestamp = initial + dt.timedelta(microseconds = elapsed_time*1000)
cv2.putText(image, 'Date: ' + str(timestamp)[0:10], (50,int(height-150)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 2, (255, 255, 255), 3)
cv2.putText(image, 'Time: ' + str(timestamp)[11:-4], (50,int(height-100)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 2, (255, 255, 255), 3)
pipe.stdin.write(image.tostring())
【问题讨论】:
标签: python-2.7 opencv ffmpeg