Cylindrical Distortion (bottle label)

I have a photo of a label glued on a bottle.  The label is glued on the curved wall of the bottle and the bottle is cylindrical where the label is attached.

The photo is taken pretty much head on the bottle, and the middle of the label  is in correct proportions but the edges are compresses more and more near the ends.

How can I "flatten" the image of this label in Photoshop to get rid of the cylindrical distortion ?
Who is Participating?
David BruggeConnect With a Mentor Commented:
If the label wraps fully around the side of the bottle so that it disappears from view, there is no getting that information back

If, however, there is just a minor distortion, it can be compensated somewhat with the warp filter.

Remember that as you stretch the compressed areas of the image, they will not ever appear as sharp as the uncompressed areas because you are filling in between pixels with Photoshop's guess as to what those pixels should be.

That being said, enlarge your canvas to the size that the label would be if it were laid out flat.

Now, select the label area and go to Edit>Transform>Warp.

Your label will now have a grid over it with control points.

Start with the upper right control point and drag it to the right.

Now grab the lower right control point and drag it the same amount.

Now select the Bezier control for the upper right control point and move it to the right so that it is straight up and down

Do the same with the lower Bezier control point.

You should now have an image that is stretched out evenly from the center to the right.

Now grab the middle right control point at the top of the image and drag it to the left.

This is what restores the center part of your image and compensates for the original distortion. The relationship to the outer and inner control points is something that you have to play with in order to get the right amount of curve compensation.

After adjusting the top points to your satisfaction, drag the middle and bottom points so that thy line up under the top ones. (the middle points are where the grid lines cross)

The warp filter does not do a perfect job, because it tends to fall off at the outside edges. You may need to apply the filter several times to get the effect that you want.

Have fun, and best of luck.
verpiesAuthor Commented:
The label wraps a little under 1/2 around the bottle.

I tried the warp filter but it does not do a perfect job, indeed.
I do not think the bezier curves can approximate the proper compresion of the label edges.

Ideally I would like to input the magnification factor as some kind of an approximation of the function 1/SQRT(1-(x^2/r^2)) which says that the center of the label gets no magnification (x=0) and the edges get an infinite magnification (x=-r or x=+r).  Eyeballing of the compression factors in 3 linear zones is really not what I was looking for.

Also, I do not have symmetrical reference points on my label to be sure that I am eyeballing it well, even if it was possible.

Is there any kind of a plugin  that does a cylindrical distortion ?

David BruggeCommented:
I am not aware of any plugins that do this.

Here's another technique that we used to use before the days of the warp fillter.

Isolate the label onto a separate layer.

Switch to QuickMask mode and draw a Reflected Gradient from the center of your label to the outside edge.

The idea here being that the red area will protect the center (non compressed) area from being selected and the rest of the selection will continue with an even gradation from the center to the outside edge.

Switch back to standard mode.

Choose Edit>Transform and holding down the shift key, stretch the image to the new shape.

Here's what is happening. The stretch function is applied to each pixel on a logarithmic scale, applying the greatest amount of stretch on the outside edges and decreasing and it moves inward.

This method causes the image to become thin because it was being stretched into a blank space. To overcome this, duplicate the layer a dozen times or so (cmd+J) and selecting all of the layers merge them back into one (cmd+E)

This should give you more even and predictable results.

again, best of luck.
verpiesAuthor Commented:
I am awarding points to this solution because nobody posted a better one, despite that I could not use it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.