def transform_img(self):
""" Transform the top-down image of the arc so that it lays flat in a plane on our cv_image """
if self.vel is not None and self.omega is not None:
pts1 = np.float32([[0,0], [0, IMG_HEIGHT], [IMG_WIDTH, IMG_HEIGHT], [IMG_WIDTH, 0]])
pts2 = np.float32([[200,240], [0, IMG_HEIGHT], [IMG_WIDTH, IMG_HEIGHT], [400, 240]])
M = cv2.getPerspectiveTransform(pts1, pts2)
self.transformed = cv2.warpPerspective(self.arc_image, M, (self.cv_image.shape[0], self.cv_image.shape[1]))
rows, cols, channels = self.transformed.shape
self.transformed = self.transformed[0:IMG_HEIGHT, 0: cols]
评论列表
文章目录