24.01.2021

# Equirectangular projection algorithm

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. It only takes a minute to sign up. I am trying to calculate distortion so I can distort overlaying text and forms to precisely match an image of an equirectangular projection.

So, how does one calculate the distortion at a given latitude on an equirectangular projectionsay, pixels wide x pixels high? I've been trying to figure out this post and its links to no avail: How to create an accurate Tissot Indicatrix? The data is mapped using equirectangular x, y's and the maps I want to use as backdrops are all this projection, so I'm assuming I want to "match" this distortion e.

Using the programming language I can precisely distort both the text and the circles. I think all I need are the equations to do it correctly. For reference, here's the same question asked differently on the Processing forum. If I understand you correctly I'm not sure I want to reproject to an orthographic projection. I want my 2D data map to wrap to a 3D sphere model that can be interacted with i. When wrapped it appears undistorted from all hemispheres not just one hemisphere, as an orthographic projection would be?

The modeling program is doing the orthographic projection for me as I rotate the object, I suppose. Therefore, I think that if I distort my 2D data map in a similar way it too will appear undistorted on the 3D sphere. Here's a shot I took with an equation that approximates equirectangular distortion. You'll notice the egg shaped ellipses from the 2D image look like a circle when wrapped to the 3D sphere. Similarly, the Tissot ellipses also appear as circles on the 3D sphere.

This is why I was looking at the Tissot equations Perhaps you're right that I should use a GIS program. I just downloaded Cartographica and will see if I can figure it out. Any Mac software suggestions for a newbie undertaking this task? Most GISes do a routinely. To illustrate bhere is a set of images derived from the "flat" map in the question taken from a viewpoint orbiting the texture-mapped sphere:.

If you look closely at the rightmost image you can see a prominent meridian through the Pacific Ocean: this is the "seam" formed by wrapping the left and right sides of the map together. This reduces the original problem of drawing "data maps" on a sphere to generating a map that shows circles correctly. The best projection for this is the Stereographic, because it projects all circles on the sphere--no matter what their size--to circles on the map.

Thus one procedure to draw large circles correctly in an Equirectangular projection, as shown in the question, is to create them in a Stereographic projection and then unproject them to geographical coordinates lat, lon. Using lon, lat as x,y Cartesian coordinates to make the map is tantamount to the Equirectangular projection and so is suitable for texture-mapping onto the sphere or for applying an Orthographic projection.

Note that Tissot indicatrices are not suitable as a solution: they only represent local distortions of infinitesimal circles. Circles large enough to see at a global scale will no longer even appear circular in most projections: witness their blobby appearance in the map in the question.

Germagic thyme disinfectant spray

That's why playing games with projections, as shown here, is essential to a good solution. I can't figure out how to add a comment so I will put this in the solution and let the moderators scramble to figure out why I can't comment. My first impression when reading your question was "Why are you not designing your circles in a conformal projection like Mercator".

You could project this map into a Mercator projection and see your circle and text distortion, fix everything to look nice and when you project it to your globe, the shapes should stay correct that is the definition of a conformal projection.

See, your first 2D map does not have geographic features drawn. Add them to this map say Africa contourand apply the distortion that you are thinking of to everything at once. The geography would become also modified, and when you put it on the sphere, it would be wrong.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here.

Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I finally found an alternative code that works, the outpout image looks like this :. Learn more. Asked 9 months ago. Active 9 months ago. Viewed times. Thanks for any help. Stack Danny 4, 11 11 silver badges 41 41 bronze badges. KenZone51 KenZone51 71 4 4 bronze badges.

Good idea is to use debugger to see where the problem is. I don't know if I'm using the right way to access to the pixels and to map them. Active Oldest Votes. Is this final image more or less realistic to what the real distances and sized where the picture was taken? K Jul 11 '19 at Sign up or log in Sign up using Google.

Honeywell india

## Converting a fisheye image into a panoramic, spherical or perspective projection

Featured on Meta. Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow. Question Close Updates: Phase 1.The source code implementing the projections below is only available on request for a small fee. It includes a demo application and an invitation to convert an image of your choice to verify the code does what you seek.

For more information please contact the author. Instructions for measuring fisheye center and radius, required if the fisheye is from a real camera sensor Applying correction to convert a real fisheye to an idealised fisheye The following documents various transformations from fisheye into other projection types, specifically standard perspective as per a pinhole camera, panorama and spherical projections.

Fisheye images capture a wide field of view, traditionally one thinks of degrees but the mathematical definition extends past that and indeed there are many physical fisheye lenses that extend past degrees. The general options for the software include the dimensions of the output image as well as the field of view of the output panoramic or perspective frustum.

Some other requirements arise from imperfect fisheye capture such as the fisheye not being centered on the input image, the fisheye not be aligned with the intended axis, and the fisheye being of any angle. Another characteristic of real fisheye images is their lack of linearity with radius on the image, while this is not addressed here as it requires a lens calibration, it is a straightforward correction to make.

The usual approach for such image transformations is to perform the inverse mapping. That is, one needs to consider each pixel in the output image and map backwards to find the closest pixel in the input image fisheye.

In this way every pixel in the output image is found compared to a forward mappingit also means that the performance is governed by the resolution of the output image and supersampling irrespective of the size of the input image.

A key aspect of these mappings is also to perform some sort of antialiasing, the solutions here use a simple supersampling approach.

This is not meant to be a final application but rather something you integrate into your code base. They all operate on a RGB buffer fisheye image in memory.

For each test utility the usage message is provided. The source images for the examples provided are provided along with the command line that generated them. A fisheye like other projections is one of many ways of mapping a 3D world onto a 2D plane, it is no more or less "distorted" than other projections including a rectangular perspective projection A critical consideration is antialiasing, required when sampling any discrete signal.

The karo tribe beliefs

The approach here is a simple supersampling antialiasing, that is, each pixel in the output image is subdivided into a 2x2, 3x The final value for the output pixel is the weighted average of the inverse mapped subsamples. There is a sense in which the image plane is considered to be a continuous function.This is a type of projection for mapping a portion of the surface of a sphere to a flat image.

It is also called the "non-projection", or plate carresince the horizontal coordinate is simply longitude, and the vertical coordinate is simply latitude, with no transformation or scaling applied. The equirectangular projection was used in map creation since it was invented around A. See Mathworld's page for more detailed information on the mathematics of this projection.

In an equirectangular panoramic image all verticals remain vertical, and the horizon becomes a straight line across the middle of the image. Coordinates in the image relate linearly to pan and tilt angles in the real world.

The poles ZenithNadir are located at the top and bottom edge and are stretched to the entire width of the image. Areas near the poles get stretched horizontally. Look at the pixel values -- a file with x pixels lacks one pixel at the short side thus confusing some applications. The other possibility is the Cubic Projection.

### Equirectangular projection

The polar regions of an equirectangular image are extremely distorted, making retouching of these areas very difficult. There are related problems with automatically blending seams near the poles. None of the tools that perform blending such as PTStitcherEnblend or SmartBlend feather equirectangular images differently to any other projection type.

So if you find that seams are running very close to the zenith or nadir, you may need to stitch the entire scene in a different orientation to get good results. There are more related problems with local tone mapping operators which produce strange results near the poles. The solution is to either use global tone mapping or retouch the zenith and nadir manually.

Equirectangular images have a very large amount of data redundancy near the poles because they are stretched in the 'latitude' direction.

Equirectangular Projection From PanoTools.See also: sphere2fish to convert a equirectangular projection to a fisheye The source code implementing the projections below is only available on request for a small fee. It includes a demo application and an invitation to convert an image of your choice to verify the code does what you seek. For more information please contact the author. The following describes a tool for extracting an ideal, pinhole camera style perspective projection from an equirectangular also called spherical projection.

The real-time way to do this might be to map the equirectangular image onto a sphere and using a real-time API eg: Opengl view the result with a virtual camera located in the center of the sphere.

The computational method here has some advantages, for example: it can result in higher quality conversions and it can handle unlimited image sizes both input and output. The usual approach for such image transformations is to perform the inverse mapping. That is, one needs to consider each pixel in the output image perspective and map backwards to find the best estimate pixel in the input image spherical.

In this way every pixel in the output image is found compared to a forward mappingit also means that the performance is governed by the resolution of the output image and supersampling irrespective of the size of the input image. A key aspect of these mappings is also to perform some sort of antialiasing, the solutions here use a simple supersampling approach. The default usage creates an image with a degree horizontal field of view, the vertical field of view is calculated based upon the image dimensions, the default being x This is not meant to be a final application but rather something you integrate into your code base.

They all operate on a RGB buffer fisheye image in memory. That is the x axis is to the right, the z axis is up and the y axis is forward. The following pans the camera 90 degrees and tilts up 40 degrees. If the mapping is performed correctly, and the original equirectangular image is correct, all lines in the scene that should be straight will be straight, unlike the curvature in the equirectangular image.

Any perspective field of view can be chosen, smaller fields of view result in zooming in, larger are equivalent to zooming out. While perspective views are defined up to, but not including degrees, for practical purposes perspective projections become increasingly inefficient after degrees. The following is a degree perspective view.

Assuming a correct equirectangular, there should be no distortion looking straight down or straight up. Converting an equirectangular image to a perspective projection Written by Paul Bourke November See also: sphere2fish to convert a equirectangular projection to a fisheye The source code implementing the projections below is only available on request for a small fee. The following image will be used for the examples illustrated on this page.Representing a spherical view of the world on a flat computer monitor or print requires some manner of mapping from the 3D spherical scene in which the camera and viewer are embedded to the 2D medium on which they are rendered.

The techniques used for mapping are of exactly the same type long used by map makers to project the entire globe, or portions of it, onto two dimensional maps. There is no single, unique projection for representing sections of the sphere on the globe. Instead, all projections have various attributes and limitations. There are many classes of projections used for various purposes e. Mathworld's Projection Pagebut only a few are traditionally used for panoramic imaging.

First - a word of warning: If you are looking for a single projection, that will map a spherical even partial panorama on a flat surface without bending lines: This won't work! Cylindrical projections resemble classic rectangular world maps.

Clark shoes price in sri lanka

The horizontal Field of View is anything up to degrees, horizontal distance is proportional to pan or yaw angle, vertical distance is related to the angle above or below the horizon. It can be envisioned by imagining wrapping a flat piece of paper around the sphere tangent to the equator, and projecting a light out from the center of the sphere.

A full range of longitude, up to degrees, can be represented with a cylindrical projection, but near the poles, the images become very distorted, so a full range of latitude cannot be used. See Cylindrical Projection for more. This shows less pronounced distortion than either cylindrical or Equirectangular Projection which otherwise look very similar. See mathworld's page for details. Miller is similar to Mercator projection but with slightly more compression at the top and bottom of the image, this distortion is less pronounced than Equirectangular Projection making it a good format for printing.

Also called the "non-projection", this is a representation of the sphere which maps longitude directly to the horizontal coordinate, and latitude to the vertical coordinate.

## Converting an equirectangular image to a perspective projection

See definition for Equirectangular Projection for more. This projection is 'equal area', making it very compact and suitable for purposes where distortion isn't important, similar to Sinusoidal projection.

Azimuthal projections have rotational symmetry around the centre of the image, these are the kind of images that are produced by the various kinds of camera lens. This is a fundamental projection which can be envisioned by imagining placing a flat piece of paper tangent to a sphere and projecting a light out from its center. Obviously, only less than degrees of longitude can be represented with this projection exactly degrees would require an image of infinite widthand in practice, far less.The projection is neither equal area nor conformal.

Because of the distortions introduced by this projection, it has little use in navigation or cadastral mapping and finds its main use in thematic mapping. The forward projection transforms spherical coordinates into planar coordinates. The reverse projection transforms from the plane back onto the sphere. The formulae presume a spherical model and use these definitions:. While a projection with equally spaced parallels is possible for an ellipsoidal model, it would no longer be equidistant because the distance between parallels on an ellipsoid is not constant.

Snyder,pp. Map projection. History List Portal. By surface. Albers Equidistant Lambert conformal. Bonne Bottomley Polyconic American Werner. Gnomonic Orthographic Stereographic.

Equidistant Lambert equal-area. Aitoff Hammer Wiechel Winkel tripel. By metric. Sinusoidal Werner. Collignon Mollweide.

Conic Equirectangular Sinusoidal Two-point Werner. Loximuthal Mercator. Craig Hammer Littrow. By construction. Central cylindrical.