If you are looking at the horizon (equator), then vertical pixels account for latitude, and horizontal pixels account for longitude. The photo will be a rectangular shape on this sphere (from perspective of the camera). Then we can consider a sphere of any radius (for the math, it is highly recommended to use a radius of 1). If photos are taken from a fixed point, and the camera can only rotate its yaw and pitch around that point. Blue shows the difference in transformation, but this depends on the horizontal/vertical angle. So, I have Red, and I need to transform it into Green. The figure below illustrates the problem. The problem is that a given photo Red cannot be placed into the equirectangular projection without a transformation. These results did not help me with answering my question.ĮDIT: I figured that maybe a figure will help explaining it better :) Either I do not fully understand it, or search engines are not helping me, because most results are about converting between already given projections or use advanced applications to stitch photos intelligently together. The transformation that is applied to the image to correct this is straightforward. And this can be done using imagemagick's Barrel Distortion, in which you only need to fill in three parameters: a, b, and c. I have this data, and I guess the first step is to do lens correction so that all lines that should be straight are in fact straight. Lens correction a, b, c parameters (see below).Vertical angle of physical camera (e.g.Horizontal angle of physical camera (e.g.The data that I think is required to do this, is probably something like this: It is safe to assume that the camera will stay at a fixed location, and can rotate in any direction from there. I just don't know how to do the step from an actual photo to such a projection. Whichever projection is easiest to do is good enough, because there are plenty of resources on how to convert between different projections. ![]() ContextĮdit: The original question title was: How to transform a photo at a given angle to become a part of a panorama photo?Ĭan anybody help me with which steps I should take if I want to transform a photo taken at any given angle in such a way that I can place the resulting (distorted/transformed) image at the corresponding specific location on an equirectangular projection, cube map, or any panorama photo projection? φ is phi, the vertical angle in degrees, a vector from (0,0,0) to a point on the surface of a sphere.īelow you find the original question, back when I did not understand the problem well, but I think that it is still good for showing what is a practical application of this solution.θ is theta, the horizontal angle in degrees, a vector from (0,0,0) to a point on the surface of a sphere.y is latitude, the vertical position, from -90 to 90 degrees.x is longitude, the horizontal position, from -180 to 180 degrees.How do you convert a spherical coordinate (θ, φ) into a position (x, y) on an equirectangular projection (also called 'geographic projection')?
0 Comments
Leave a Reply. |