import cv2
import math

ring = cv2.imread('../circular.png')

size = ring.shape[0]
outer_radius = size // 2
inner_radius = 0

unwrapped = cv2.warpPolar(
    ring,
    (size, int(size * math.pi)),
    (outer_radius, outer_radius),
    outer_radius,
    flags = 0
)

unwrapped = cv2.rotate(unwrapped, cv2.ROTATE_90_COUNTERCLOCKWISE)

unwrapped = unwrapped[inner_radius:, :]

cv2.imshow("original", ring)
cv2.imshow("Unwrapped", unwrapped)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imwrite("output.png", unwrapped)