Forums  

Go Back   Forums > Talk > General FPP Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2007, 04:24 AM
Spoon Spoon is offline
Junior Member
 
Join Date: Nov 2007
Posts: 2
Downloads: 0
Uploads: 0
Question Hotspot relative to pixel position on input image

I've created an app in which you can dynamically place hotspots. I'm currently using this in conjunction with a Java Virtual Tour Viewer, and looking to migrate.

My only major issue at this stage is placing hotspots. Say, for example, the input image is 1200x600 pixels. I place the hotspot on the input image at 600 pixels from the left, and 150 from the top.

Now with a little basic maths I can get that the pan is 0 degrees (to be halfway round), and that seems correct.

The problem is, the tilt isn't as simple. If it's 150 pixels from the top, that's a quarter, so straight conversion to degrees gives you a -90 degree tilt. The problem is, that because of the distortion of the image, this is way too high.

What's the maths I need to convert a position in pixels into a tilt in degress? Alternatively, can I place a hotspot using the pixel positions relative to the input image?

Thanks
Reply With Quote
  #2  
Old 11-08-2007, 07:00 AM
zleifr's Avatar
zleifr zleifr is offline
Senior Member
 
Join Date: May 2007
Posts: 609
Downloads: 0
Uploads: 0
Default

It sounds like you are using an equirectangular image. And if my understanding of the mathematics of an equirectangular image are correct, then you use the arcsin like this:

figure distances up and down from the horizon of the image
tilt angle = arcsin of (distance to desired hotspot location / distance from horizon to zenith)

or in your example:
distance of horizon to desired hotspot location = 150 px
distance of horizon to zenith = 300 px
tilt angle = arcsin of ( 150px / 300px )
tilt angle = arcsin of 0.5
tilt angle = 30 degrees

Online arcsin calculator:
http://www.analyzemath.com/Calculato...alculator.html

I think that should work.
If not, I'd just use the editor plugin and fiddle with it.
Reply With Quote
  #3  
Old 11-08-2007, 10:16 PM
Spoon Spoon is offline
Junior Member
 
Join Date: Nov 2007
Posts: 2
Downloads: 0
Uploads: 0
Default

That worked fine, thanks!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 02:03 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.