parent
5e61f8c36b
commit
306a4c1e78
@ -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)
|
||||
Loading…
Reference in new issue