Is there any algorithm for projecting images onto a non-flat surface?
Is there any algorithm for projecting images onto a non-flat (deformed) surface?
It is not deformed too much. It is a really glassy surface covered with high-quality, durable tracing paper. I have a 3-dimensional model of it. How can I texturise it with a p开发者_开发知识库rojector?
I want to write a program in C\C++\C# for Windows, which would be able to texturise any surface given by a 3-dimensional model using a projector.
I need an algorithm or open source libraries containing algorithms.
Yes, there's an algorithm. Unless you really want to implement it on your own, it's probably easier to let an existing 3D graphics implementation do the job for you -- both OpenGL and DirectX will let you apply a texture to the surface of a 3D model. The NeHe tutorials include an example of the basic idea using OpenGL.
It's not at all clear what algorithm a standard texturing library would use, and it's probably not a true projection, so if accuracy is important, you many need to do this yourself (or do some research into what specific algorithms are being used for a given library).
The basic algorithm is simple. Basically you just need to find where line emanating from your projection point intersect your surface. In more detail:
- Decide on your projection point
- Decide on a bunch of lines emanating from your projection point that will give you resolution you need on your warped surface
- Determine where these lines intersect your surface (the exact method will depend on your surface representation)
- Assume that your flat image is placed somewhere between your projection point and warped surface and find the intersection of the line with the flat surface and assign this value to the location on the warped surface.
On the other hand, if your surface is described mathematically, there may be a simple equation for this, as would be the case, for example, if you were mapping a plane to a sphere.
It's called image distortion correction.
精彩评论