测量图像中像素之间的欧几里得距离的算法

发布于 2024-09-14 18:31:29 字数 409 浏览 9 评论 0 原文

我有许多图像,其中我知道焦距、像素数、尺寸和位置(来自 GPS)。它们都是采用高倾斜方式,用市售相机在地面上拍摄的。

替代文本 http://desmond.yfrog.com/Himg411/scaled.php?tn=0&server=411&filename=mjbm.jpg&xsize=640&ysize=640

计算图像中某些像素之间的欧几里德距离的最佳方法是什么?如果确实可以的话。

I have a number of images where I know the focal length, pixel count, dimensions and position (from GPS). They are all in a high oblique manner, taken on the ground with commercially available cameras.

alt text http://desmond.yfrog.com/Himg411/scaled.php?tn=0&server=411&filename=mjbm.jpg&xsize=640&ysize=640

What would be the best method for calculating the euclidean distances between certain pixels within an image? If it is indeed possible.

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

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

发布评论

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

评论(1

箹锭⒈辈孓 2024-09-21 18:31:29

假设您不是在寻找完整的景观建模,而是在寻找简单的近似模型,那么这应该不会太难。基本上,图像的第一个近似值简化为具有已知焦距的相机沿平面观察。因此,我们可以非常轻松地创建系统的 3D 模型 - 这与传统观察者观看棋盘演示的情况相差不远。

通常我们的图形问题是将 3D 模型投影为 2D,以便我们可以渲染图像。尽管现在大多数程序都使用 API(例如 OpenGL)来执行此操作,但方程式并不是特别复杂或难以理解。我使用 3D Graphics In Pascal 中的示例编写了第一个代码,这是一个不错的清晰论文,但还会有很多其他类似的来源(尽管现在可能较少,因为总是使用硬件 API)。

这样做的有用之处在于投影方程是可交换的,因为如果您在图像和模型上有一个点,您可以通过投影运行数据以检索原始 3D 坐标 - 这就是您想要做的。

因此,建议采用以下几种方法:要么直接自己编写代码来执行上述操作,或者可能更简单地使用 OpenGL(我推荐 GLUT 工具包 用于此)。如果你的数学很好并且操作矩阵不会给你带来任何问题,那么我会推荐前者,因为解决方案会更严格并且很有趣 - 否则采用 OpenGL 方法。您可能也想尽早将相机/平面近似转换为相机/球体。

如果这不足以满足您的需求,那么理论上进行实际景观建模是可行的。 SRTM 数据是免费提供的(尽管不是最友好的形式),因此与您的GPS 定位应该可以创建一个网格模型,您可以在其中应用与上述相同的算法。

Assuming you're not looking for full landscape modelling but a simple approximation then this shouldn't be too hard. Basically a first approximation of your image reduces to a camera with know focal length looking along a plane. So we can create a model of the system in 3D very easily - it's not too far from the classic observer looking over a checkerboard demo.

Normally our graphics problem would be to project the 3D model into 2D so we could render the image. Although most programs nowadays use an API (such as OpenGL) to do this the equations are not particularly complex or difficult to understand. I wrote my first code using the examples from 3D Graphics In Pascal which is a nice clear treatise, but there will be lots of other similar source (although probably less nowadays as a hardware API is invariably used).

What's useful about this is that the projection equations are commutative, in that if you have a point on the image and the model you can run the data back though the projection to retrieve the original 3D coordinates - which is what you wish to do.

So a couple of approaches suggest: either write the code to do the above yourself directly, or probably more simply use OpenGL (I'd recommend the GLUT toolkit for this). If your math is good and manipulating matrices causes you no issue then I'd recommend the former as the solution will be tighter and it's interesting stuff - otherwise take the OpenGL approach. You'd probably want to turn the camera/plane approximation into camera/sphere fairly early too.

If this isn't sufficient for your needs then in theory going to actual landscape modelling would be feasible. The SRTM data is freely available (albeit not in the friendliest of forms) so combined with your GPS position it should be possible to create a mesh model in with which you apply the same algorithms as above.

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