none
Problem with hdmake output for HDView with partial spherical images

    Question

  • I have been using Hugin to do my panorama stitching, and the output from it is a partial spherical (equirectangular projection) image (see http://bugblatter.co.uk/hdviewtest/7089.jpg).  This 4098x1680 image covers longitudes 131-249 (where 180 is the centre) and lattitudes 78-126 (where 0 is the South pole and 90 is the horizon).  I was expecting to be able to use hdmake with "-xmlsphere filename.xml panmin panmax tiltmin tiltmax" to convert this to a tiled format suitable for use with HDView.

    However, when I tried this, I got a distorted result.  The command line I used was:

        hdmake -src 7089.jpg -xmlsphere 7089.xml 131 249 78 126 -nozip -viewer 2 -html

    You can see the output of this at http://bugblatter.co.uk/hdviewtest/7089.htm.

    If I expand the canvas of the image to a full 360x180 sphere 12518x6259 (see http://bugblatter.co.uk/hdviewtest/7089_full.jpg), then it overcomes the distortion, but leaves me with the problem that users can get lost by panning and tilting into blank space.  The command line I used was:

        hdmake -src 7089_full.jpg -xmlsphere 7089_full.xml 0 360 0 180 -nozip -viewer 2 -html

    I can then restrict users to the useful part of the image by manually editing the .htm file to use the HDView subRect parameters:

        subRect="4560 1878 8658 3558"

    You can see the output of this at http://bugblatter.co.uk/hdviewtest/7089_full.htm.  This works very nicely from the user's point of view, but is somewhat tedious for me to do and is wasteful of diskspace on the server.  By the way, I found the HDView documentation somewhat unspecific over the subRect parameters and had to use trial and error to determine that the values were original image pixels indexed from the top left corner.

    Further experimentation demonstrates that the distortion only occurs if my partial image is off-centre.  For example, if I position my image within a half size canvas of 90-270 x 45-135 (see http://bugblatter.co.uk/hdviewtest/7089_half.jpg), then I still get a good result with the following command:

        hdmake -src 7089_half.jpg -xmlsphere 7089_half.xml 90 270 45 135 -nozip -viewer 2 -html

    You can see the output of this at http://bugblatter.co.uk/hdviewtest/7089_half.htm.

    As a simple but extreme example, if I just take the North East quadrant of my fully expanded canvas, i.e. 180-360 x 90-180 (see http://bugblatter.co.uk/hdviewtest/7089_ne_quadrant.jpg), then I get a very distorted result with the following command:

        hdmake -src 7089_ne_quadrant.jpg" -xmlsphere 7089_ne_quadrant.xml 180 360 90 180 -nozip -viewer 2 -html

    You can see the output of this at http://bugblatter.co.uk/hdviewtest/7089_ne_quadrant.htm.

    So, to conclude, I think that it is a bug in hdmake, that it doesn't work nicely for off-centre partial spheres.  Unless there's something that I haven't understood properly?

    Thanks,

    James.
    Wednesday, October 26, 2011 9:10 PM

All replies

  • Hi James,

    For hdmake 0 is the north pole, 180 the south.  So if I try your panorama with:

    hdmake -src 7089.jpg -xmlsphere 7089.xml 131 249 54 102 -nozip -viewer 2 -html

    instead of:

    hdmake -src 7089.jpg -xmlsphere 7089.xml 131 249 78 126 -nozip -viewer 2 -html

    it looks fine.

    Sorry if that wasn't clear from the documentation (or point it out to us if we say the opposite :-)

    --Howard

     

    Monday, October 31, 2011 4:52 PM
  • Howard,

    Yes, thanks very much, that fixes it perfectly.  You can see the fixed output at http://bugblatter.co.uk/hdviewtest/7089_fixed.htm.

    What HDMake does matches your documentation - e.g. it says:

    tiltmin is the angle(degrees) for the top row of the image

    The problem is that I skimmed over the documentation too quickly - sorry.  If the quoted example had been vertically off-centre then that might have saved me, but who knows?

    Thanks,

    James.

    Thursday, November 03, 2011 9:32 PM