Transform a ring to straight

I’m trying to transform an half ring (img1) to horizontal (like img2).

i tried with poor results to copy every circles pixels from r1 to r2 (img1) and flat these pixel at same row ordered by column from left to right, then overlapping these lines. My very bad result in img3:

img1, img2, img3:

thanks for any helps, i’m new in OCV and CV.

warpPolar might do the trick

1 Like

It works!

  img1 = cv2.imread('img1.jpg', 1)
  polar_image = cv2.warpPolar(img1,dsize=(500,1570),center=(244, 248),maxRadius=250, flags=cv2.WARP_POLAR_LINEAR)
  polar_image = cv2.rotate(polar_image, cv2.ROTATE_90_COUNTERCLOCKWISE)

ɥǝɥǝ’ Ɩ80 ʍɐs ɐlɹǝɐpʎ sʍɐddǝp ᴉu ʇɥǝ oɹᴉƃᴉuɐl

1 Like