Skip to content

Instantly share code, notes, and snippets.

@White-Green
Created May 22, 2020 07:15
Show Gist options
  • Save White-Green/406faac016453af11f6a838b4566bbb1 to your computer and use it in GitHub Desktop.
Save White-Green/406faac016453af11f6a838b4566bbb1 to your computer and use it in GitHub Desktop.
import cv2
from math import cos,pi
import numpy as np
img=cv2.imread("taberungo.png")
img=cv2.resize(img,None,fx=.5,fy=.5)
while True:
for i in range(360):
width=cos(i/(pi*2))*img.shape[1]
resized=cv2.resize(img,(int(max(abs(width),1)),img.shape[0]))
if width<0:
resized=cv2.flip(resized,1)
width=-width
base=np.full_like(img,255)
base[:,int(base.shape[1]//2-width//2):int(base.shape[1]//2-width//2+width)]=resized
cv2.imshow("taberungo",base)
cv2.waitKey(15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment