Projection of a plane onto a cylinder

泄露秘密 提交于 2019-11-30 02:27:31

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/7981815/projection-of-a-plane-onto-a-cylinder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!