Add padding to images to get them into the same shape

前端 未结 6 1767
野趣味
野趣味 2020-12-31 04:21

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 leng

6条回答
  •  抹茶落季
    2020-12-31 04:42

    Like this (Padding is called borders on openCV):

    BLUE = [255,255,255]
    constant= cv2.copyMakeBorder(image.copy(),10,10,10,10,cv2.BORDER_CONSTANT,value=BLUE)
    

    And blue can become white even

    source: https://docs.opencv.org/3.4/da/d0c/tutorial_bounding_rects_circles.html

提交回复
热议问题