Home>

I can do everything with still images, but I don't know how to convert them to video
I want to be able to do this with videos
Thank you.

import cv2
import numpy as np
from matplotlib import pyplot as plt
path = 'syaei_3.jpg'
#I want to make a video here
i = cv2.imread (path, 1)
# Load video
print (i.shape)

# Set corresponding points before and after conversion
#Enter the 4 point coordinates checked above into p_original
p_original = np.float32 ([[247,388], [805,408], [17, 833], [1063, 860]])
#Set to fill the screen but no frame
p_trans = np.float32 ([[0,0], [500,0], [0,690], [500,690]])
# Transformation matrix and projective transformation
M = cv2.getPerspectiveTransform (p_original, p_trans)
i_trans = cv2.warpPerspective (i, M, (500, 690))
cv2.imwrite ("syaei_31.jpg", i_trans)
#Graph settings from here
fig = plt.figure ()
ax1 = fig.add_subplot (111)
# Plot image
show = cv2.cvtColor (i_trans, cv2.COLOR_BGR2RGB)
ax1.imshow (show)


fig.tight_layout ()
plt.show ()
plt.close ()