MTO-TCP / src /utils /pixel_adder.py
ishworrsubedii's picture
Updated the latest changes
36cd99b
raw
history blame contribute delete
644 Bytes
"""
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