Get pixelwidth/pixelheight properties of panoramic image via script

  • Hello, Klaus. It's difficult to explain what size I am looking for, but maybe it's would be better if I try to explain the main cause why I do that.
    So, the main issue is to calculate hotspot position at panoramic image on the fly(when panorama is loaded). I have two hotspots: image hotspot and polygonal hotspot. Polygonal hotspot should be placed over image hotspot to cover proper part of it. User can set-up what part of the image should be covered by polygon, similar to image area map selector (http://iakob.com/canvas-area-draw/demo.html). So, I have only flat polygon with coordinates relative to the image which will be loaded into panorama as hotspot. When panorama is loaded then image hotspot (distorted) is placed to ath=0,atv=0 coordinates and after that I need to calculate coordinates of polygonal hotspot points according to krpano's coordinate system. I have created thread on this issue
    Trying to convert flat polygon points coordinates to polygonal hotspot ,
    but unfortunately there are no answers, because the question is too
    complicated and difficult for understanding I guess.
    I saw what krpano's coordinate system is (http://www.krpano.com/docu/panoformats/) and think that if I will have width/height of the image, then maybe I will be able to calculate hotspot position, but not sure how to do that properly.

  • Hi,

    I'm not fully sure what you mean, but...

    ...converting pixel-coordinates from the spherical source image to the krpano ath/atv values, can be done this way:

    ath = (x / imagewidth - 0.5) * 360
    atv = (y / imageheight - 0.5) * 180

    where:

    x = is the pixel-position from the left in the spherical source image
    y = is the pixel-position from the top in the spherical source image
    imagewidth = is the width in pixels from spherical source image
    imageheight = is the height in pixels from spherical source image

    Best regards,
    Klaus

  • Thanks a lot, Klaus. Now I have completed piece of puzzle. But, how I can convert pixel-coordinates from the other types of source images(cube, cylinder, cubestrip, qtvr) to the krpano ath/atv values?

Participate now!

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