使用用户当前的纬度、经度和查看对象的方向查找一组纬度和经度

发布于 2025-01-03 03:35:11 字数 457 浏览 1 评论 0原文

我正在构建一个基于增强现实的 Android 应用程序。主要思想是,当用户打开我的应用程序时,默认情况下设备的相机会在预览模式下启动。根据用户当前的 GPS 位置和用户/相机面向的方向,我想计算范围内的纬度和经度集是哪些?

下图很好地解释了我的情况。我有完整的纬度和经度,如图中绘制的所有黑点。现在假设用户位于圆的中心。还考虑到他正在朝北方向观看。如果我们考虑朝北方向呈 45 度角。我想要获取此 45 度可视区域中的纬度和经度集。

在此处输入图像描述

我能够获取用户相机所面向的方向。我还能够找到用户当前的 GPS 位置。我的 SQLite 数据库中存储了完整的纬度和经度集。现在我想计算的是用户设备相机所面向的纬度和经度集。

我希望我在这里已经解释得很好了。如果有人能帮忙解决这个问题,那就有点紧急了。

提前致谢。

I am building an Android application based on Augmented Reality. The main idea is when user opens up my application, by default device's camera starts in preview mode. Based on user's current GPS location and the direction in which user/camera is facing I want to calculate which are the set of latitudes and longitudes in the range?

Following image explains my scenario very well. I have full set of latitudes and longitudes as drawn all black spots in the figure. Now suppose user is at the center of the circle. Also considering that he is viewing in North direction. If we consider an angle of 45 degree towards North direction. I want to get set of latitudes and longitudes which are coming in this 45 degree viewable area.

enter image description here

I am able to get the direction in which user's camera is facing. I am also able to find user's current GPS location. I have full set of latitudes and longitudes stored in my SQLite database. Now I want to calculate is the set of latitudes and longitudes in which user's device camera is facing.

I hope I have explained pretty well here. Its bit urgent if anyone can help on this.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

二货你真萌 2025-01-10 03:35:11

要获取视角,您可以使用 Camera.Parameters getHorizo​​ntalViewAngle() 方法。我们称之为阿尔法。您还可以从设备到磁北的角度了解设备的方位,我们称之为 beta。

从那里,在给定的半径内,迭代一组数据库位置,计算从您的位置到其位置的方位,并检查它是否在区间 [beta-alpha/2, beta+alpha/2] 内,

如果不在区间内真的很着急,我建议看看 Mixare,它是一个开源框架,可以处理具有位置和 AR。

To obtain the viewing angle, you can use as an approximation the Camera.Parameters getHorizontalViewAngle() method. Let's call it alpha. You also know the bearing of your device from its point of view to magnetic North, let's call it beta.

From there, within a given radius, iterate through set of database locations, compute the bearing from your position to its, and check if it is inside the interval [beta-alpha/2, beta+alpha/2]

If you're not really on a rush into this, I would suggest to take a look into Mixare, its an open source framework which deals with location and AR.

梦里°也失望 2025-01-10 03:35:11

您可以查看 mixare 的代码,这是一个在 GPLv3 下发布的增强现实浏览器。该存储库位于: http://github.com/mixare/mixare

有很多详细信息你必须注意,从 Android 版本 2.3 (IIRC) 开始,相机的视野只能通过编程实现。您可以在兼容性类中找到这些以及许多其他内容。

哈特哈,
Daniele - mixare 团队

you can check the code of mixare, an augmented reality browser released under the GPLv3. The repository is available at: http://github.com/mixare/mixare

There are a lot of details you have to take care of, starting from the fact that the Field of View of the camera is only programatically available since version 2.3 (IIRC) of android. You find these and lots of others in the compatibility class.

HTH,
Daniele - mixare team

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文