def transform_desire(image,curveIntensity):
'''
will convert image to arc form.
im1 : image.
curveIntensity : How much curved text you desired.
'''
im1 = image
ratio = 0.0001*curveIntensity
## calculate the desired width of the image.
height,width,channel = im1.shape
x = np.linspace(0,width,width).astype(int)
y = (ratio * ((x-(width/2))**2)).astype(int)
## corrosponding to an x every point will get shifted by y amount.
## time to shift.
## create canvas for new image.
adder = 0
if ratio >= 0:
adder = max(y)
else:
adder = (-1)*min(y)
retImage = (np.ones((height+adder,width, channel))*0).astype(np.uint8)
if ratio >= 0:
adder = 0
for xs in range(width):
ys = y[xs]
for t in range(height):
retImage[t+ys+adder,xs,:] = im1[t,xs,:]
return retImage
Это сработало для меня.Пожалуйста, помогите себе, если вам это нужно.