diff --git a/simplepreprocessor.py b/simplepreprocessor.py new file mode 100644 index 0000000..e089fb4 --- /dev/null +++ b/simplepreprocessor.py @@ -0,0 +1,16 @@ +import cv2 +class SimplePreprocessor: + def __init__(self, width, height, inter=cv2.INTER_AREA): + self.width = width + self.height = height + self.inter = inter + + def preprocess(self, image): + return cv2.resize(image, (self.width, self.height), interpolation=self.inter) + +if __name__ == '__main__': + s = SimplePreprocessor(32, 32) + img = cv2.imread('D:/python/LearningMaterial/PetImages/Cat/9759.jpg') + cv2.imshow('src', img) + cv2.imshow("resize", s.preprocess(img)) + cv2.waitKey(0)