[python][转载]opencv-python横向纵向拼接图片

import cv2
import numpy as np
img1 = cv2.imdecode(np.fromfile('./zly.jpg', dtype=np.uint8), -1)
img2 = cv2.imdecode(np.fromfile('./yx.jpg', dtype=np.uint8), -1)
# 纵向合并
img_zhong = np.vstack((img1, img2))
# axis=1:横向合并 axis=0 纵向合并
img_heng = np.concatenate([img1, img2], axis=1)
cv2.imshow('img_zhong', img_zhong)
cv2.imshow('img_heng', img_heng)
cv2.waitKey(0)
 

你可能感兴趣的:(Python,opencv,python,计算机视觉)