1.opencv 打开一张图片
import cv2
src = cv2.imread('2.jpg')#图片路径
cv2.imshow('opencv打开图片',src)
cv2.waitKey(0)
cv2.destroyAllWindows()
2.图片平移
import cv2
import numpy
img = cv2.imread('2.jpg')
box = numpy.float32([[1,0,25],[0,1,25]])#构建一个移动矩阵。
rows,cols = img.shape[:2]
res = cv2.warpAffine(img,box,(cols,rows))
cv2.imshow('pic',img)
cv2.imshow('pic1',res)
cv2.waitKey(0)
cv2.destroyAllWindows()