You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
544 B
17 lines
544 B
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)
|