标签:windows 图片 change waitkey img oat print des inf
# 图像平移
image1=‘C:\\Users\\10107472\\Desktop\\myfile\\tensorflow-yolov\\read.jpg‘
img = cv.imread(image1,0)
rows,cols = img.shape
print(‘image_original=‘,img.shape)
M = np.float32([[1,0,100],[0,1,50]]) # 平移矩阵
dst = cv.warpAffine(img,M,(300,420)) # img为需要变换的图像,M为需要平移的位置,(300,420)为平移后图像尺寸
print(‘dst.shape=‘,dst.shape)
cv.imshow(‘original img‘,img)
cv.imshow(‘change img‘,dst)
cv.waitKey(0)
cv.destroyAllWindows()
标签:windows 图片 change waitkey img oat print des inf
原文地址:https://www.cnblogs.com/tangjunjun/p/11468728.html