File size: 919 Bytes
55654c5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# This file is part of OpenCV Zoo project.
# It is subject to the license terms in the LICENSE file found in the same directory.
#
# Copyright (C) 2021, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved.
# Third party copyrights are property of their respective owners.
import numpy as numpy
import cv2 as cv
class Compose:
def __init__(self, transforms=[]):
self.transforms = transforms
def __call__(self, img):
for t in self.transforms:
img = t(img)
return img
class Resize:
def __init__(self, size, interpolation=cv.INTER_LINEAR):
self.size = size
self.interpolation = interpolation
def __call__(self, img):
return cv.resize(img, self.size)
class ColorConvert:
def __init__(self, ctype):
self.ctype = ctype
def __call__(self, img):
return cv.cvtColor(img, self.ctype) |