def affineTransform(self):
folder=self.sort_files()
P=self.get_points()
self.height,self.width=cv2.imread("Frames/1.jpg").shape[:2]
# Process frames
for i in folder:
pic="Frames/"+str(i)+".jpg"
img = cv2.imread(pic)
pts1 = np.float32([[P[0][0],P[0][1]],[P[1][0],P[1][1]],[P[2][0],P[2][1]]])
pts2 = np.float32([[P[0][2],P[0][3]],[P[1][2],P[1][3]],[P[2][2],P[2][3]]])
M = cv2.getAffineTransform(pts1,pts2)
dst = cv2.warpAffine(img,M,(self.width,self.height))
cv2.imwrite("Frames/%d.jpg" % i, dst)
# Method for Perspective transformation: OpenCV Module
评论列表
文章目录