![]() In the cartesian coordinate system we can easily rotate around any axis using rotation matrices that are multiplied with the coordinate vector to get the rotated coordinate back. The math for the cartesian coordinate system is much simpler. We have to realize that it is difficult to do any calculations between the two spheres using just spherical coordinates. You know the spherical coordinate of a point on the photo-sphere, and you want to know where this point is on the geo-sphere with the different camera-angle. The geo-sphere (equirectangular projection sphere), with longitude/latitude coordinates.The photo-sphere with the camera in the center.The important idea that solved the problem for me is this: you basically have two spheres: So how do we transform a pixel from the picture at (x, y) to a (longitude, latitude) coordinate given a vertical/horizontal angle at which the photo was taken (va,ha)? Solution Latitude = photo_height_deg * (y - photo_height_px/2) / photo_height_px + vaīut this approximation does not work at all when we move the camera much more vertically: Longitude = photo_width_deg * (x - photo_width_px/2) / photo_width_px + ha If we don't care about a slight distortion, then the formula to calculate the (longitude,latitude) from any pixel (x,y) from the photo would be easy: photo_width_deg = 70 Then this is pretty straightforward, because if we know that the photo is 70 degrees wide and 40 degrees high, then we also know that the longitude range will be approximately 70 degrees and latitude range 40 degrees. Here we look at roughly the horizon of our world. For a simple panorama photo of the horizon there is not much of a problem: 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?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |