[Solved] - Issue with krpano Tools spheretocube -rotate and image.prealign

  • I have some highly misaligned panoramic images, and I want to convert them into perfectly aligned cube faces.

    Here’s my process:

    1. I obtain the image.prealign (x|y|z) values using krpano Tools → Edit pano-type → Set North and Level the Pano.
    2. I invert the values: positive becomes negative, and negative becomes positive.
    3. I run krpanotools spheretocube CUBE pano.tif cube.tif -rotate=XYZ,x,y,z

    In some cases, the cube faces are generated perfectly aligned. But not always.

    When I change -rotate=XYZ,x,y,z to -rotate=ZYX,x,y,z, the cube faces that were previously misaligned become perfectly aligned. However, those that were already aligned now become misaligned.

    I have two examples:

    • prealign="-2.547|-41.74|1.762" → with -rotate=XYZ,2.547,41.74,-1.762, the cube faces are perfect.
    • prealign="-0.416|75.013|-2.556" → with -rotate=ZYX,0.416,-75.013,2.556, the cube faces are perfect.

    Here’s my question: how do I determine when to use XYZ and when to use ZYX?
    Is there a formula or a method to figure this out?

    Thanks!


    Translated by ChatGPT.

  • Hi Klaus, thanks for the feedback.

    I did some more tests and got really confused. 😵

    Example:

    - I take 6 perfect faces and generate a perfect panorama.
    - With this panorama, I generate 6 faces with -rotate=XYZ,-1.5,20,3.5
    - With these 6 faces I generate a misaligned panorama.
    - To return the 6 perfect faces I used -rotate=ZYX,1.5,-20,-3.5
    - If I use -rotate=XYZ,-3.5,-20,1.5 it doesn't give the same result.

    In the viewer, the panorama is not aligned with any of these values in image.prealign. I got a satisfactory alignment with "-1.4|20.1|3". 🤯 And with these values in -rotate I don't get the aligned faces.

    I'm attaching the aligned faces that I used in the tests.

    Thank you very much.

    • New
    • Official Post

    Hi,

    - To return the 6 perfect faces I used -rotate=ZYX,1.5,-20,-3.5
    - If I use -rotate=XYZ,-3.5,-20,1.5 it doesn't give the same result.

    That's normal, rotations are accumulated. A different rotation order means different values to achieve the same result.

    This here should work to map the image.prealign rotations to the spheretocube -rotate setting:

    • use order XZY
    • and change the sign of all prealign x,y,z values

    E.g.

    Code
    <image ... prealign="87.845109|20.117014|-28.101291">

    would become:

    Code
    -rotate=XZY,-87.845109,-20.117014,28.101291

    Best regards,
    Klaus

  • sexta March 8, 2025 at 3:44 PM

    Changed the title of the thread from “Issue with krpano Tools spheretocube -rotate and image.prealign” to “[Solved] - Issue with krpano Tools spheretocube -rotate and image.prealign”.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!