镜头校正投影

发布于 2024-07-14 03:44:19 字数 90 浏览 6 评论 0原文

消除使用鱼眼镜头或广角镜头拍摄的照片变形的最简单方法是什么? 我正在寻找一个参数很少的像素投影公式。 相机和镜头参数是未知的,因此用户必须直观地更改参数。 谢谢

What is the simplest way to un-warp a photo made using fisheye or wide-angle lens? I'm looking a pixel projection formula that has few parameters. Camera and lens parameters will not be known, so user has to change the parameters visually. Thanks

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

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

发布评论

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

评论(4

冷了相思 2024-07-21 03:44:20

ImageMagick 进行了精彩的讨论。 他们给出了他们使用的方程。

请注意,这不会以与 Photoshop CS6 相同的方式校正失真(即,您不能从 Adob​​e 镜头配置文件中获取系数并简单地将它们放入)。

Kamil 指出的论文 看起来是一篇出色的深入研究。

There is an excellent discussion from ImageMagick. They give the equation that they use.

Note that this does not correct distortion in the same way as Photoshop CS6 (i.e. you cannot take coefficients from the Adobe lens profiles and simply chuck them in).

The paper that Kamil points to seems like an excellent in-depth look.

醉生梦死 2024-07-21 03:44:20

我假设你可以使用透镜方程来做到这一点。

1/f = 1/object_distance + 1/image_distance

其中 f 是焦距(用户输入)。 使用放大方程,可以使用图像距离和物距的比率来适当调整图像的大小。 为了得到你真正想要的东西,你需要重构方程:

1/object_distance = 1/f - 1/image_distance

然后利用放大方程利用物体高度来调整大小:

-图像距离/对象距离=图像高度/对象高度

您可能已经注意到,问题是您需要知道每个像素距相机的距离。 否则,它根本不起作用。 您可以向用户询问该信息,但这似乎不太可能,而且很痛苦。 我不知道还有什么其他方法可以做到这一点——镜头畸变是一种 3D 效果,而您获得的是 2D 信息。 您最多可以尝试以二维方式对其进行校正,但这会很困难,并且无法正常工作。

I would assume you could use the lens equation to do it.

1/f = 1/object_distance + 1/image_distance

Where f is the focal length (the user input). The ratio of image distance and object distance could be used to resize the image appropriately, using the magnification equation. To get what you really want, then, you need to restructure the equation:

1/object_distance = 1/f - 1/image_distance

And then use the magnification equation to use the object height to resize:

-image_distance/object_distance = image_height/object_height

The catch, as you may have noticed, is that you need to know the distance each pixel is away from the camera. Otherwise, it simply doesn't work. You could ask the user for that information, but that seems unlikely, and painful. I don't know of any other way to do it-- lens distortion is a 3D effect, and you're given 2D information. At best you can attempt to correct it two-dimensionally, but this will be difficult, and won't work properly.

静赏你的温柔 2024-07-21 03:44:20

如果可能的话,您应该要求用户使用同一台相机拍摄参考图像(例如棋盘)的照片,然后使用该信息来分析镜头特性。 然后,该信息可用于消除同一相机拍摄的其他照片的变形。

为了实现,您可以使用神经网络/遗传算法。

If its possible you should ask the user to take a photograph of a reference image (a chess board for example) using the same camera and then use this information to analyze the lens characteristics. This information can then be used to un-warp the other photographs taken by the same camera.

For implementation you could use neural networks/genetic algorithms.

这里有一篇很好的论文,它提供了一些看起来不错的镜头畸变数学模型。 至少是这样。 我认为 SDX2000 的网格走上了正确的轨道。 我认为解决该问题的最常见方法是将图像映射到网格,然后允许应用扭曲参数来产生枕形和桶形失真。 请参阅 Lightroom 或 Photoshop 中的镜头畸变滤镜作为示例。

There is a good paper here that provides some decent looking mathematical models for lens distortion. It's at least. SDX2000 was kind of on the right track with the grid I think. I think the most common way to approach the problem is to map the image to a grid and then allow warping parameters to be applied to produce pincushion and barrel distortion. See the lens distortion filters in Lightroom or Photoshop as an example.

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