时间:2022-06-14 10:11:25 | 栏目:Python代码 | 点击:次
# -*- coding: utf-8 -*- import cv2 image = cv2.imread("lena.jpg") image_v = cv2.vconcat([image, image]) cv2.imshow("Result", image_v) cv2.waitKey(0)
样式:
# -*- coding: utf-8 -*- import cv2 image = cv2.imread("lena.jpg") image_h = cv2.hconcat([image, image]) cv2.imshow("Result", image_h) cv2.waitKey(0)
样式:
import cv2 img = cv2.imread('icon/big.jpg') img2=cv2.imread("icon/small.jpg") def vconcat_resize_min(im_list, interpolation=cv2.INTER_CUBIC): w_min = min(im.shape[1] for im in im_list) im_list_resize = [cv2.resize(im, (w_min, int(im.shape[0] * w_min / im.shape[1])), interpolation=interpolation) for im in im_list] return cv2.vconcat(im_list_resize) im_v_resize = vconcat_resize_min([img, img2]) cv2.imwrite('opencv_vconcat_resize.jpg', im_v_resize)