You are not logged in.

1

Friday, October 25th 2013, 5:22pm

Get pixelwidth/pixelheight properties of panoramic image via script

Is krpano can get pixelwidth and pixelheight properties of panoramic image via script? I tried to call get(image.pixelwidth), but it return null value.

2

Friday, October 25th 2013, 5:51pm

Hi,

there is no 'image.pixelwidth'.

What kind of size are you trying to get?

For all available variables please also see the documentation:
http://krpano.com/docu/xml/#top
http://krpano.com/docu/actions/#top
http://krpano.com/docu/quickref/#top

Best regards,
Klaus

3

Monday, October 28th 2013, 4:29pm

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.

4

Monday, November 4th 2013, 8:29am

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

5

Wednesday, November 6th 2013, 11:09am

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?