用于测量图像中像素之间的欧氏距离的算法 [英] Algorithm for measuring the Euclidean distance between pixels in an image

查看:848
本文介绍了用于测量图像中像素之间的欧氏距离的算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多图像,我知道焦距,像素数,尺寸和位置(来自GPS)。它们都是高倾斜的,用商用相机拍摄。

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.

推荐答案

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

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.

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

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).

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

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.

所以有两种方法建议:要么自己编写代码直接执行上述操作,要么可能更简单地使用OpenGL(我建议 GLUT工具包。如果你的数学很好并且操纵矩阵会导致你没有问题,那么我会推荐前者,因为解决方案会更紧凑而且它是有趣的东西 - 否则采用OpenGL方法。你可能也想早点将相机/平面近似变成相机/球体。

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.

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

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.

这篇关于用于测量图像中像素之间的欧氏距离的算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆