Skip to content

Instantly share code, notes, and snippets.

@ThomasParistech
Last active July 20, 2022 09:39
Show Gist options
  • Save ThomasParistech/332d464859bde965f7bcd528c53692d1 to your computer and use it in GitHub Desktop.
Save ThomasParistech/332d464859bde965f7bcd528c53692d1 to your computer and use it in GitHub Desktop.
# /usr/bin/python3
"""Profile Image rotation"""
import cv2
import numpy as np
from profiler import export_profiling_events
from profiler import profile
@profile
def rot_cv2(img: np.ndarray):
return cv2.rotate(img, cv2.ROTATE_90_COUNTERCLOCKWISE)
@profile
def rot_np(img: np.ndarray):
return np.rot90(img)
@profile
def rot_np_copy(img: np.ndarray):
return np.copy(np.rot90(img))
if __name__ == "__main__":
img = cv2.imread("data/lena.png")
img1 = rot_cv2(img)
img2 = rot_np(img)
img3 = rot_np_copy(img)
export_profiling_events("./profiling.json")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment