opencv 小tips
pdf 路径 D:\2_Noteexpress数据库\fulltext\电子书\CV\Practical Python and OpenCV by Adrian Rosebrock (z-lib.org).pdf
6.1 Image Transformations
6.1.1 Translation 函数的用法,该函数可以将图像前后左右移动,重点关注M矩阵。
1 import numpy as np
2 import argparse
3 import imutils
4 import cv2
5 6
ap = argparse.ArgumentParser()
7 ap.add_argument("-i", "--image", required = True,
8 help = "Path to the image")
9 args = vars(ap.parse_args())
10
11 image = cv2.imread(args["image"])
12 cv2.imshow("Original", image)
13
14 M = np.float32([[1, 0, 25], [0, 1, 50]])
15 shifted = cv2.warpAf