Project img on X-Y surface to a cylinder placed in center....

In summary, the conversation discusses a problem involving placing an image on the X-Y plane and reflecting it in a mirror cylinder to create a deformed image. The person has written code in Matlab, but it only wraps the image around the cylinder horizontally. They need help understanding the equation to properly deform the image from different viewing angles. The problem involves ray-tracing and using parametric coordinates to intersect the reflected ray with the image plane. A pixel-by-pixel approach is suggested for determining the color of each pixel based on the reflected ray's intersection with the plane.
  • #1
Amirps
2
0
Hi ,
I came across a problem ,I've search a lot but couldn't exactly find the solution.
here is my problem:
suppose there is an image ( I call it IMG_A),place IMG_A in the X-Y plane , put a mirror cylinder at the center of IMG_A. what we see in the cylinder mirror is a deform image (I call it IMG_B) . what I try to achieve by this program is IMG_B.
I've already write a piece of code in Matlab using this equation

for i=1:IMG_A_Width
for j=1:IMG_A_Height
cy(i,j,1)=cyradius*cos(i*(2*pi/IMG_A_Width)) ;%cylinder X
cy(i,j,2)=cyradius*(sin(i*(2*pi/IMG_A_Width)));%cylinder Y
cy(i,j,3)=j*(cyHeight/IMG_A_Height) ;%cylinder Z
cy(i,j,4)=IMG_A(i,j);%cylinder image
end
end
but this is not exactly what I want ,this program just wrap the IMG_A around the cylinder. in other words the warping is in the horizontal direction.would you please be kind enough helping me to understand the equation I need to write this program?
 
Physics news on Phys.org
  • #2
Before you start writing code: how do you look into the mirror? That will influence the picture you see.
Try to solve the problem for some random viewing direction, by working against the direction of the light: where does your viewing direction hit the mirror? Where is the reflected viewing direction, and where does it hit the xy plane?
 
  • #3
Fou
mfb said:
Before you start writing code: how do you look into the mirror? That will influence the picture you see.
Try to solve the problem for some random viewing direction, by working against the direction of the light: where does your viewing direction hit the mirror? Where is the reflected viewing direction, and where does it hit the xy plane?
fortunately the viewing angel is constant and it is 30 degrees.
[the light will travel at the angel of 30 degrees from XY plane and hit the mirror ]
 
  • #4
That sounds like a ray-tracing problem in computer graphics.

You want to think in terms of eye-rays and parametric coordinates with planes (your image) and cylinders (the deformed image)
You have the starting point (Vs) for each ray (where the eye is) and the direction (unit vector Vd) where that ray goes.
The first place that rays hits anything gives a parametric coordinate u. Each point and vector is three components (x,y,z)

R = Vs + u.Vd

A plane is defined as P = A.x + B.y + C.z + D = 0

A cylinder is defined as C = A.x^2 + B.y^2

You want to intersect your ray R with the cylinder, calculate the reflection vector of that ray, and where the reflected vector hits the plane.

Here's some reference material:
http://www.cl.cam.ac.uk/teaching/1999/AGraphHCI/SMAG/node2.html
 
  • Like
Likes Amirps and mfb
  • #5
I would just add to #4 that a natural way to do this is pixel by pixel. For each pixel, you want to know how to color it. Calculating where the ray from the eye through the center of the pixel, after being reflected by the cylinder, hits the plane — if it hits the plane at all — will determine what color the pixel should be. For more realism you might want to decrease the intensity of that color in proportion to the squared length of the entire light ray (i.e., from the eye to the cylinder to the plane).
 
  • Like
Likes Amirps

1. How do you project an image onto a cylinder?

To project an image onto a cylinder, you will need to use a specialized software or program such as Blender or Maya. These programs have tools that allow you to map an image onto a 3D object, including a cylinder. You will need to follow the specific instructions for the program you are using to properly project the image onto the cylinder.

2. What is the purpose of projecting an image onto a cylinder?

The purpose of projecting an image onto a cylinder is to create a 3D representation of the image. This can be useful in various fields such as animation, graphic design, or virtual reality. It allows for a more realistic and immersive experience by adding depth and dimension to the image.

3. How do you ensure the image is accurately projected onto the cylinder?

To ensure the image is accurately projected onto the cylinder, you will need to carefully align the image with the cylinder's surface. This can be done by adjusting the mapping settings in the software, such as the rotation, scaling, and positioning. It is also important to use a high-quality image to avoid distortion or blurriness in the projection.

4. Can you project an image onto a cylinder placed at an angle?

Yes, it is possible to project an image onto a cylinder placed at an angle. However, this will require additional adjustments and settings in the software to properly map the image onto the curved surface. It may also be helpful to use reference images or a 3D model to ensure the image is accurately projected onto the angled cylinder.

5. Are there any limitations to projecting an image onto a cylinder?

There are some limitations to projecting an image onto a cylinder. One limitation is that the image may appear distorted or stretched when projected onto a cylinder with a large curvature. This can be minimized by using a high-quality image and adjusting the mapping settings. Additionally, the image may also appear distorted when viewed from certain angles, so it is important to consider the viewing perspective when projecting onto a cylinder.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
1K
Replies
13
Views
891
  • Introductory Physics Homework Help
Replies
4
Views
2K
  • Differential Geometry
Replies
3
Views
2K
  • Programming and Computer Science
Replies
4
Views
607
  • Introductory Physics Homework Help
Replies
2
Views
836
Replies
1
Views
585
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
Back
Top