本文介绍了在Android的相机preVIEW测绘GPS位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Guyz,
我需要显示在相机preVIEW的位置(如餐馆,剧院,银行等),当我移动相机在我身边。我知道如何(从四角或谷歌地图前)的位置,我也知道如何打开摄像头preVIEW。我只是不知道如何将这两个联系起来。我GOOGLE了它,但没有得到一个有用的职位,也许是因为我的英语不是很好。


所以,球员,我需要你的帮助,如果你知道关于这个问题的任何职位,请还跟评论吧。

Guyz,I need to show the locations(ex restaurants, theaters, banks etc) on the camera preview when I move the camera around me. I know how to get the locations (ex from foursquare or Google maps) and I also know how to open the camera preview. I just don't know how to link these two. I googled it, but did not get a helpful post maybe because my english is not good.

So guys I need your help, if you know any post regarding this issue please be kind enough to comment it.

先谢谢了。

编辑:实时摄像头preVIEW


     -------------------------------------------------- ----------------------------

|                                                     剧院                             |
|                                                                                                |

|   银行                                                                                   |

|                                                                     餐厅         |

|                                                                                                |

|                                                                                                |

|                                                                                                |

|                                                                                                |

|                                                                                                |

---------------------------------------------- --------------------------------




请原谅我,我不到10声誉,所以不能上传图片。


希望这将有助于了解我的问题。

Real Time Camera Preview

------------------------------------------------------------------------------
|                                                      Theater                              |
|                                                                                                |
|    Bank                                                                                    |
|                                                                      Restaurant         |
|                                                                                                |
|                                                                                                |
|                                                                                                |
|                                                                                                |
|                                                                                                |
------------------------------------------------------------------------------


Pardon me I am less than 10 reputations, so can not upload images.
Hope this will help to understand my question.

推荐答案

我没有在Android类似的事情了。让我们假设你要打印preVIEW所谓的目标。

I did a similar thing on Android, too. Let's assume that what you want to print on preview is called target.

您一定知道什么是这些目标包括经纬度和海拔高度的坐标。假定这些坐标是TX,TY和TZ,分别与所述设备的当前位置是X,Y和z

You definitely know what's the coordinate of those targets including latitude longitude and altitude. Assuming those coordinates are tx, ty and tz, respectively, and the current location of the device is x, y and z.

,屏幕上的目标坐标(SX,SY)是:

Based on colinearity equations in photogrammetry, the screen coordinates of the target (sx, sy) are:

SX = F * {[M11(X-TX)+ M12(γ-TY)+ M13(Z-TZ)] / [M31(X-TX)+ M32(γ-TY)+ M33(Z- TZ)]}

sx = f*{[m11(x-tx)+m12(y-ty)+m13(z-tz)]/[m31(x-tx)+m32(y-ty)+m33(z-tz)]}

SY = F * {[M21(X-TX)+ M22(γ-TY)+ M23(Z-TZ)] / [M31(X-TX)+ M32(γ-TY)+ M33(Z- TZ)]}

sy = f*{[m21(x-tx)+m22(y-ty)+m23(z-tz)]/[m31(x-tx)+m32(y-ty)+m33(z-tz)]}

其中f是焦距,M11〜M33是基于设备取向的旋转矩阵的值。屏幕坐标必须以仿射变换使他们成为屏幕列和行打印用途适用。

where f is focal length, and m11 ~ m33 are values in rotation matrix based on device orientation. Screen coordinates must be applied with an affine transformation to turn them into screen column and rows for printing usages.

这是我所试图做的,但我发现,应用自动对焦后从未改变焦距。所以,我这样做是另一种方式。

This is what I was trying to do, but I found out that focal length never changed after autofocus is applied. So I do it in an alternative way.


  1. 让您的设备的屏幕大小(或preVIEW大小)和摄像头的水平和垂直角度。

  2. 计算设备与目标之间的方位角和倾角。

  3. 插值屏幕坐标基于这些角度和屏幕尺寸。

  4. 在屏幕上打印的目标。我建立了一套imageviews和textviews做同样的事情。

有关这些目标的实时更新,请尝试onSensorChanged对其进行更新()

For real time updates of these targets, try to update them in onSensorChanged()

希望这些帮助。 :)

这篇关于在Android的相机preVIEW测绘GPS位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 01:00