Skip to main content

Hi,

I’ve tried a few times to do this over the years but I haven’t been successful. What I want to do is convert a set of cubemap images into on equirectangular panorama. Kind of like this:

I know there are a lot of free python solutions of Github, but I haven’t been able to get any of them to successfully work. I’m not particularly good a python and I don’t want to install any script packages. I’d prefer to do this entirely within FME as I am already loading in the images.

Would anyone know a solution?

Hi @james_c_452,

The PROJReprojector transformer has a projection definition for the Cubemap - Quadrilateralized Spherical Cube (QSC). This makes it possible to reproject from the Cubemap to Equilateral Rectangle (basically lat/long in world space).

I am attaching an annotated workspace illustrating how to tile the CubeMap image into individual face images, then reproject those to lat/long and mosaic back into a into a single image.


Hi @james_c_452,

The PROJReprojector transformer has a projection definition for the Cubemap - Quadrilateralized Spherical Cube (QSC). This makes it possible to reproject from the Cubemap to Equilateral Rectangle (basically lat/long in world space).

I am attaching an annotated workspace illustrating how to tile the CubeMap image into individual face images, then reproject those to lat/long and mosaic back into a into a single image.

I probably would never guess PROJ can do it. Dave shared his workspace with me, and I would suggest one extra option to add. Transform the image to a point cloud just before AttributeFilter (PointCloudCombiner with Group By _tile). After PROJReprojectors, simply use ImageRasterizer with 0.15 spacing (lower values make produce some empty pixels, higher values decrease resolution). The advantage of this method is that it does not create any box edge artifacts - compare the pure image method (left) vs point cloud as an intermediate data type:
 

 


Hi @daveatsafe ,

I never thought of using the proj reprojector. I have tried to go via a point cloud and some maths before, but I could never get it right. Did you attach the workspace? I only see an xml which has almost no data in it
God tip @dmitribagh 


Hi @daveatsafe / @dmitribagh ,

I have had a look at your workspaces, thanks. I am finding that I am getting a weird distortion though.

My output also does not have as many pixel rows (in ratio to the number of pixel columns) compared to a different way to make a panorama. I.e. its not as ‘tall’. See these images

Output using your method
 


Output from my slow method

 

The cause of the rotation misalignment between the 6 images has probably something to do with the original source (I have 6 images already and do not need to tile, I probably just need to just change the order). I’m more worried about the distortion of features that should be straight

Is this something I’m doing wrong? If so do you have any ideas what would cause the distortion? Or is it expected behavior?


According to the PROJ projection page (https://proj.org/en/stable/operations/projections/qsc.html), the QSC projection is equal-area, and so will distort shapes. For map data, this is not usually a big deal, but for imagery with straight lines, it is quite noticeable. My test data was an outside scene, so the distortion wasn’t obvious.

In light of this, I think you may be happier with the your Python method. It may be slower, but the output is a lot better. The Python can also be run within an FME workspace using a PythonCaller transformer. To install custom packages into FME’s Python, pease follow the steps listed at https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Form/Workbench/Installing-Python-Packages.htm

 


Thanks @daveatsafe ,

Thats unfortunate, I thought we were onto a winner!

I’ll have another look at python in future, but every time I’ve tried I’ve failed. I hadn’t looked up installing custom packages though and had been trying other code, perhaps this will help. I currently use Pano2QTVR.exe, but that has been unsupported for the better part of a decade


Reply