opencv仿射变换
https://i-blog.csdnimg.cn/direct/c29e2417ffa64704b9d35ffc4a761045.png代码如下:
import numpy as np
import cv2
# 读取图像
img = cv2.imread("../image/dog.jpg")
# 图像平移
height, width = img.shape[:2]
# 创建平移矩阵, 表示 x 轴平移 100 个像素, 表示 y 轴平移 50 个像素
translation_matrix = np.float32([, ])
# 应用平移变换
translated_img = cv2.warpAffine(img, translation_matrix, (width, height))
# 结果
# 显示平移后的图像
cv2.imshow("Translated img", translated_img)
# 显示原始图像
cv2.imshow("original", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]