Skip to content

Instantly share code, notes, and snippets.

View osama-ammar's full-sized avatar

Osama Ammar osama-ammar

View GitHub Profile
@i-namekawa
i-namekawa / paddedzoom.py
Last active April 10, 2024 22:56
zoom in/out an image (numpy array) while keeping the original shape.
import cv2
def paddedzoom(img, zoomfactor=0.8):
'''
Zoom in/out an image while keeping the input image shape.
i.e., zero pad when factor<1, clip out when factor>1.
there is another version below (paddedzoom2)
'''