1.图像平移 代码: import cv2 import numpy as np img = cv2.imread('img2.png') # 构造移动矩阵H # 在x轴方向移动多少距离,在y轴方向移动多少距离 H = np.float32([[1, 0, 50], [0, 1, 25]]) rows, cols = img.shape[:2] print(img.shape) print(rows, cols) # 注意这里rows和cols需要反置,即先列后行 res = cv2.warpAf.