0
我想要使用opencv和python2.7從給定圖像創建視頻的源代碼。我試試這個代碼,但它給了我NoneType對象的錯誤有沒有屬性「形」如何使用python 2.7創建視頻從給定的圖像
import cv2
img1 = cv2.imread('1.jpg')
img2 = cv2.imread('2.jpg')
img3 = cv2.imread('3.jpg')
height , width , layers = img1.shape
video = cv2.VideoWriter('video.avi',-1,1,(width,height))
video.write(img1)
video.write(img2)
video.write(img3)
cv2.destroyAllWindows()
video.release()
進口CV2 IMG1 = cv2.imread( '1.JPG') IMG2 = cv2.imread( '2.JPG') IMG3 = cv2.imread( '3.JPG') 高度,寬度,層= img1.shape 視頻= cv2.VideoWriter( 'video.avi', - 1,1,(寬度,高度)) video.write(IMG1) video.write(IMG2) video.write(IMG3 ) cv2.destroyAllWindows() video.release() –
這是代碼和抱歉上傳圖像 –
我編輯的問題,請幫助 –