Spherizing

# Spherize

## How do you spherize an image?

To spherize an image, you must map it onto the surface of a sphere. Like the wave effect, this requires a fair amount of calculations using trigonometry.
 Spherized text

First, it is necessary to agree on what 100 percent spherized means. One hundred percent in our opinion means that the image is mapped onto exactly half of a sphere, as if it were sliced down the middle. Fifty percent, by this definition, would be the portion of the half-sphere cut at a height half way between the base and the top. We will call the distance y. Using fundamental trigonometry, we can derive the following equation for the length of a central cross-section (a portion of a circle):

length = radius * pi * ( 180-2*arcsin( (100-percent)/100 ) ) / 180

The equation assumes that you are using degrees. Finding the length of the circle segment is the hardest part, so you can breathe a sigh of relief :)

## How does a circle help me?

It helps you to know how much longer the segment is than the height and width of the square area that you are spherizing. Then, it is a matter of simply stepping through each pixel index in the horizontal and vertical directions of your original image. Find the distance from the center of the image using the distance formula; distance = sqrt( (x1-xcenter)2 + (y1-ycenter)2 ). If the pixel distance is more than the radius, it is not affected. Otherwise, you can map it from its original coordinates to an appropriate distance from the center and angle. The calculations from this point on are comparatively simple.