l have a set of images of different sizes (45,50,3), (69,34,3), (34,98,3)
. l want to add padding to these images as follows:
Take the max width and length of the whole images then put the image in that size
import os
import glob
import cv2
input_path="/home/images"
os.chdir(indput_path)
images=glob.glob("*.png")
Length=[]
Width=[]
for img in images:
img=cv2.imread(img)
width,length=img.shape[0:2]
Length.append(length)
Width.append(width)
W=max(Width)
L=max(Length)
How can l add padding in opencv so that all the images will have the same size? In the example l gave the images will get the shape of (69,98,3)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…