File size: 644 Bytes
36cd99b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
Created By: ishwor subedi
Date: 2024-07-12
"""

import cv2


def add_pixel(image, top: bool = False, left: bool = False, right: bool = False, bottom: bool = False,
              ):
    value = [255, 255, 255]
    if top:
        image = cv2.copyMakeBorder(image, 200, 0, 0, 0, cv2.BORDER_CONSTANT, value=value)
    if left:
        image = cv2.copyMakeBorder(image, 0, 0, 200, 0, cv2.BORDER_CONSTANT, value=value)
    if right:
        image = cv2.copyMakeBorder(image, 0, 0, 0, 200, cv2.BORDER_CONSTANT, value=value)
    if bottom:
        image = cv2.copyMakeBorder(image, 0, 200, 0, 0, cv2.BORDER_CONSTANT, value=value)
    return image