简体   繁体   English

将度数映射到 360 度图像上的 (x,y) 像素

[英]Mapping Degrees to (x,y) pixels on a 360 Image

I am looking to plot out points on a 2d spherical image from a GoPro Max given an Altitude° and an Azimuth°.我希望在给定高度°和方位角的情况下从 GoPro Max 绘制二维球面图像上的点。

Here's what you can assume:以下是您可以假设的内容:

  1. The center of the image is always facing south图像的中心总是朝南
  2. the image is always level looking straight at the equator.图像始终水平直视赤道。

Here's what I know:这是我所知道的:

  1. The image size is 5760x2880 which means the equator is at 1440px vertically.图像大小为 5760x2880,这意味着赤道垂直为 1440 像素。
  2. I have found an image online and labeled it with the Azimuth° going left to right and the Altitude° going up and down.我在网上找到了一张图片,并用从左到右的方位角和上下的高度°标记了它。 You can find that image here你可以在这里找到那张图片

I hope that this will give you a better idea of what I'm trying to do here.我希望这能让你更好地了解我在这里要做的事情。

Put simply, I'm imagining a method something like:简而言之,我正在想象一种类似的方法:

ConvertCoords(Azimuth°, Altitude°){
     ...
     return (x,y)
}

Is this possible?这可能吗? I will probably implement this using Python but I'm open to suggestions.我可能会使用 Python 来实现这一点,但我愿意接受建议。 Any sort of information to point me in the right direction is greatly appreciated!非常感谢任何可以为我指明正确方向的信息!

Edit: I should mention that from my research I believe the GoPro Max uses an equirectangular projection.编辑:我应该提到,根据我的研究,我相信 GoPro Max 使用等距柱状投影。 I was able to overlay that image I attached on one of the 360 photos and plot out some data manually which seemed to come out correct.我能够将我附加在其中一张 360 度全景照片上的图像叠加起来,并手动绘制出一些似乎正确的数据。

With an equirectangular projection, the mapping is direct and linear.对于等距柱状投影,映射是直接和线性的。

def convertCoords( azimuth, altitude ):
    # Assumptions:
    # - Both values are in radians
    # - South is an azimuth of 0, negative to the left, range -pi to +pi
    # - Altitude range is -pi/2 to +pi/2, negative down
    x = 2880 + (azimuth * 2880 / math.pi)
    y = 1440 - (altitude * 2880 / math.pi)
    return x,y

If you'd rather use degrees, change "math.pi" to "180".如果您更愿意使用度数,请将“math.pi”更改为“180”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM