I have a plain bitmap and I want to do a projection on a cylinder.
That means, I want to transform the image in a way so that if I print it and wrap around a columnar cylinder and photograph it from a certain position, the resulting image looks like the original.
Still I'm quite lost in all the projection algorithms (that are often related to earth projections).
So I'd be thankful for hints what the correct algorithm could be and which tools I could use to apply it to my image.
projected area of the cylinder is the area formed by the points of tangency l 0 on the z 0 plane. This area is enclosed inside 1 and 2 2 1 when Eqs. 8 and 9 are equated to zero and hence is given by see Fig. 2 2aL sin a 2 cos 4a 2 cos ...
A plane is tangent to the cylinder if it meets the cylinder in a single element. The right sections are circles and all other planes intersect the cylindrical surface in an ellipse.
We suspect that that the intersection of a plane and a cylinder (not parallel to its axis) is an ellipse.
Let say you have a rectangle image of lenght: L and height: H .
and a cylinder of radius : R and height H'
Let A (x,z) be a point in the picture,
Then A' (x',y',z') = ( R*cos(x*(2Pi/L)) , R*sin(x*(2Pi/L)) , z*(H'/H)) will be the projection of your point A on your cylinder.
Proof :
1. z' = z*(H'/H)
I first fit the cylinder to the image size , that's why I multiply by : (H'/H), and I keep the same z axis. (if you draw it you will see it immediatly)
2. x' and y ' ?
I project each line of my image into a circle . the parametric equation of a circle is (Rcos(t), Rsin(t)) for t in [0,2PI], the parametric equation map a segment (t in [0,2PI]) to a circle . That's exactly what we are trying to do.
then if x describes a line of lenght L, x*(2pi)/L describres a line of length 2pi and I can use the parametric equation to map each point of this line to a circle.
Hope it helps
The previous function gave the function to "press" a plane against a cylinder.
This is a bijection, so from a given point in the cylinder you can easily get the original image.
A(x,y,z) from the cylinder
A'(x',z') in the image :
z' = z*(H/H')
and x' = L/(2Pi)* { arccos(x/R) *(sign(y)) (mod(2Pi)) }
(it's a pretty ugly formula but that's it :D and you need to express the modulo as a positive value)
If you can apply that to your cylindrical image you get how to uncoil your picture.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With