8

I have a regular panorama image. How do I convert it into an equirectangular picture (normal → equirectangular)?

Most results I find on Google are a conversion in the opposite direction (equirectangular → normal).

This is the image I want to convert (HR link)

enter image description here

  • Are you starting with a 360 spherical photo or are you manually taking pictures? – AndrewH Feb 7 '17 at 20:36
  • I've created a 3d picture. You could compare it with a regular photo. I would like to convert it into an equirectangular image. – Bob van Luijt Feb 7 '17 at 20:37
  • I am not sure how to do it from a 3D scene but for stitching photos together you can use PTGui or Hugin. – AndrewH Feb 7 '17 at 20:48
  • Does it have to be mathematically accurate? You could wrap the image around a cylinder and save an image in ortho perspective? – Wolff Feb 7 '17 at 20:57
  • No it doesn't, I'm really struggling, Hugin seems to create incorrect images. – Bob van Luijt Feb 7 '17 at 21:10
8

You can not do that on your image as you have it.

1) You want a cylindrical projection on a sphere. First your canvas needs to be at one exact proportion. 3.1416:1 (Use any pixel sized canvas you want, for example 3141x1000px)

enter image description here

2) And you (normally) need the horizon to be at the center of the canvas.

enter image description here

On a cylindrical projection (from a sphere) you have a specific deformation on the projection due the vertical projected dimension versus the real height of that segment, so you need to compensate that when you draw your cartoon at a flat canvas.

An easy way to do this is using the Spherize filter in Photoshop. (On the arcaic version I have right now on this computer is on Filter >Distort > Spherize)

But you ONLY need to distort that on the vertical axis.

enter image description here

But besides that you need to define what portion of a 360 panorama you have. Imagine another chicken taking a photo. What would be the angle of the lens used?

I feel that it is a wide angle lens, lets thing you are taking like 120° angular field. This means you need to complete your image to the stuff you have behind the chicken photographer.

enter image description here


The Google VR aplication you want to use says that need a cylindrical projection, but asks for a proportion of 2:1 on your image. A 2:1 projection normally is a spherical one that has a diferent deformation, but it is harder to achive in a video for example.

For practical reasons they are in fact asking for cylindrical projections, so you simply resample your original 3.1416:1 to 2:1 as a final step.

enter image description here

Simply resample the final image. If your canvas was 3141x1000 px simply resample it to 2000x1000px. Do not crop it. The chicken will look slimmer but will go faty again on the VR aplication.


For your initial canvas: On your specific image it is hard to tell the angle of view, but let us see 3 scenarios.

(A) Your field of view is arround 120° so you can acomodate 3 photos of the cute pets as your posted image is 2048 the canvas needs to be 2048x3=6144px and now divide that with pi = 1955px

6144x1955px

(B) But if you do not want the pets to be too small let us asume the photo covers 180° = 2048x2=4096 / pi=1303

4096x1303px

(C) Or play with the numbers.

enter image description here

  • Ooooohhhh.... Wait. The link of google VR you are providing does not use cylindrical projections, they use spherical ones. I'll complement my answer. – Rafael Feb 8 '17 at 16:19
  • Thanks. Quick question, not sure how to get the 3.1416:1 to 2:1 – Bob van Luijt Feb 8 '17 at 16:24
  • Simply resample the final image. If your canvas was 3141x1000 px simply resample it to 2000x1000px. Do not crop it. The chicken will look slimmer but will go faty again on the VR aplication. – Rafael Feb 8 '17 at 16:27
  • Aha, thanks, almost there. What would be the correct settings in the image -> image-size settings in Photoshop? – Bob van Luijt Feb 8 '17 at 16:33
  • One aditional note. The clouds, the coser you are to the top and bottom, needs to be reshaped to mantain the aparent size of the original image. – Rafael Feb 8 '17 at 16:52
3

Equirectangular image presents a sphere, it's distorted so that meridians and parallels on the sphere are shown as straight vertical and horizontal lines. An example from Wikipedia:

enter image description here

In the left there's a spherical map and in the right there's the equivalent plane map, the equirectangular projection from sphere to a rectangle.

There's no stretching on the equator, but the the image is stretched horizontally elsewhere. The more stretching the further the point is from the equator. Top and bottom edges contain actually only single points - the poles.

The rectangle has proportions W/H=2:1. That reflects the fact the distance between the poles along the sphere is exactly half of the full round trip along the equator.

You wanted to convert your image to equirectangular. Seemingly the proportions are 2:1, so it is equirectangular already if the corresponding sphere is this:

enter image description here

Half of the image is hidden behind the sphere, but there it is. As you see, top and bottom edges of your image are pinched to points, the poles.

I think you see this as an useless piece of math sophistry, you expected something else. I guess you want

1) an equirectangular image which presents a sphere with your image as a part of the surface, no need to cover full sphere with it

2) when one watches it sitting in the middle of the sphere, he can see your image on the sphere without distortion and in so big size that the image covers a substatial part of the field of vision, say a sector 90 degrees wide and 45 degrees high.

If you accept some distortion, You simply increase the canvas size to 400%

enter image description here

On a sphere seen from outside it is this:

enter image description here

(sorry for the glosses, my freeware CAD program doesn't allow editing the lights)

Affinity Photo has Layer > Live Projection > Equirectangular which can show the wiew inside the sphere like the image were painted onto the inside surface of the sphere and the observer is in the midpoint. It shows this:

enter image description here

Curved fence and horizon obviously are unwanted, but the sun is still quite round. That's because it's much smaller and it's near the equator line. Horizon and fence are curved, because they are actually on horizontal circles (=parallels of the spherical map), one watches them a little downwards and sees them as ellipse arcs.

One can straighten the original image area with compensating distortion ie. by warping or more exactly with math distortion equations (Affinity P supports them, too).

Affinity Photo allows image edits in live projection mode. The edits are applied to underlying equirectangular image, but one watches the projection on the sphere. Here's a coarse warping attempt:

enter image description here

As well one can paste the original image and merge it to bare background layer, which is under Live projection:

enter image description here

But this is not a general fix. As soon as the watcher turns his head a little he sees in a new way distorted scene (=a flat card seen from a little aside)

enter image description here

There is no general fix, because you haven't a 3D scene, only a flat image on a 3D sphere.

My opinion is that mapping the environment as a single image onto a sphere and watching it from the midpoint can be plausible virtual reality only if the mapped scene is so far away that it cannot have any perspective. Even in that case one needs some clever viewport wide distortion to make the apparent distance infinite, not = the radius of the sphere. The distortion should live as the watching direction changes.

This answer was totally rewritten after checking this much later case: How can I paint equirectangular (360 degree) images?

1

enter image description here

Your image have realy litle information and is too small. Also dont have a equirectangular geometry. But you can do it in Blender, its free. Just render it in "Panorama"> "equirectangular"> "Render. To see HDRI images in 360 you can use this site: http://panoramaviewer.1bestlink.net/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.