in pytouch/handlers/video.py [0:0]
def resize(self, resize=None, reset=False):
if not self.video_cap.isOpened():
raise AssertionError("VideoHandler must be initialized before resizing")
if isinstance(resize, (tuple, list)) and (len(resize) == 2):
width, height = tuple(map(int, resize))
self.is_resized = True
elif isinstance(resize, float):
width, height, _ = self.video_cap.shape
width = width / resize
height = height / resize
self.is_resized = True
elif reset:
width, height = self.width, self.height
self.is_resized = False
else:
raise NotImplementedError(
"Video resizing must specify a tuple, list or float for scaling factor."
)
self.resized_width = width
self.resized_height = height