三点法线向量 [英] Normal Vector of Three Points

查看:117
本文介绍了三点法线向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,数学极客,我遇到了一个困扰我一段时间的问题.这是一个个人项目.

Hey math geeks, I've got a problem that's been stumping me for a while now. It's for a personal project.

我有三个点:红色,绿色和蓝色.它们被放置在纸板上,红点在左下角(0,0),蓝点在右下角(1,0),绿点在左上角.想象一下退后一步,从一个角度拍摄卡的照片.如果要在图片中找到每个点的中心(假设单位是像素),您将如何找到图片中卡面的法向矢量(相对于相机)?

I've got three dots: red, green, and blue. They're positioned on a cardboard slip such that the red dot is in the lower left (0,0), the blue dot is in the lower right (1,0), and the green dot is in the upper left. Imagine stepping back and taking a picture of the card from an angle. If you were to find the center of each dot in the picture (let's say the units are pixels), how would you find the normal vector of the card's face in the picture (relative to the camera)?

关于这个问题,我现在有了一些认识:

Now a few things I've picked up about this problem:

  1. 点(在现实生活"中)始终成直角.在图片中,只有当照相机沿轴"(红轴和蓝点或红点和绿点创建的线)围绕红点旋转时,它们才成直角.
  2. 卡的仅一侧上有点.因此,您知道您永远不会回头.
  3. 卡与相机的距离无关紧要.如果我知道每个点的深度,这会容易得多(只是一个简单的叉积,不是吗?).
  4. 卡的旋转与我要寻找的无关.在我试图弄清楚这一点的修修补补中,最后可以借助法向矢量找到旋转.我不知道旋转是否是找到法向矢量的一部分(或结果的一部分).

希望那里有人做到这一点,或者是数学天才.我有两个朋友在这里帮助我,到目前为止,我们一直没有成功.

Hope there's someone out there that's either done this or is a math genius. I've got two of my friends here helping me on it and we've--so far--been unsuccessful.

推荐答案

我在旧版本的MathCAD中进行了研究:

i worked it out in my old version of MathCAD:

MathCAD的屏幕截图中的措辞错误:已知: g b 彼此垂直"

Wording wrong in screenshot of MathCAD: "Known: g and b are perpendicular to each other"

在MathCAD中,我忘了做叉积的最后一步,我将从以前的答案中复制粘贴到这里:

In MathCAD i forgot the final step of doing the cross-product, which i'll copy-paste here from my earlier answer:

现在,我们已经解决了 翻译的g和b点,您的 原来的问题想要正常的 飞机.

Now we've solved for the X-Y-Z of the translated g and b points, your original question wanted the normal of the plane.

如果交叉 g x b ,我们将获得 两者均正交的向量:

If cross g x b, we'll get the vector normal to both:

        | u1  u2  u3 |
g x b = | g1  g2  g3 |
        | b1  b2  b3 |  

      = (g2b3 - b2g3)u1 + (b1g3 - b3g1)u2 + (g1b2 - b1g2)u3

所有值都是已知的,将其插入 (我不会用g3写出版本 和b3代替,因为它只是 太长和丑陋而无济于事.

All the values are known, plug them in (i won't write out the version with g3 and b3 substituted in, since it's just too long and ugly to be helpful.

但是实际上,我认为您必须从数字上解决它,调整 g z b z ,以便最适合以下条件:

But in practical terms, i think you'll have to solve it numerically, adjusting gz and bz so as to best fit the conditions:

g · b = 0

| g | = | b |

|g| = |b|

由于像素不是代数完美的.

Since the pixels are not algebraically perfect.

使用阿波罗13号宇航员的照片操纵命令模块的方形氢氧化锂罐中的一个在LEM中工作,我找到了角落:

Using a picture of the Apollo 13 astronauts rigging one of the command module's square Lithium Hydroxide cannister to work in the LEM, i located the corners:

使用它们作为X-Y平面的基础:

Using them as my basis for an X-Y plane:

i使用Photoshop记录了像素位置,其中正X朝右,正Y向下(以保持Z的右手规则"进入"图片):

i recorded the pixel locations using Photoshop, with positive X to the right, and positive Y down (to keep the right-hand rule of Z going "into" the picture):

g =(79.5,-48.5,g z )

g = (79.5, -48.5, gz)

b =(-110.8,-62.8,b z )

b = (-110.8, -62.8, bz)

将两个起始公式插入Excel,并使用分析工具包通过调整 g z 来"最小化"错误> b z ,它带有两个Z值:

Punching the two starting formulas into Excel, and using the analysis toolpack to "minimize" the error by adjusting gz and bz, it came up with two Z values:

g =(79.5,-48.5,102.5)

g = (79.5, -48.5, 102.5)

b =(-110.8,-62.8,56.2)

b = (-110.8, -62.8, 56.2)

然后让我计算其他有趣的值.

Which then lets me calcuate other interesting values.

g b 的长度(以像素为单位):

The length of g and b in pixels:

| g | = 138.5

|g| = 138.5

| b | = 139.2

|b| = 139.2

法线向量:

g x b =(3710,-15827,-10366)

g x b = (3710, -15827, -10366)

正常单位(长度1):

u N =(0.1925,-0.8209,-0.5377)

uN = (0.1925, -0.8209, -0.5377)

按比例缩放到与 g b (138.9)相同的长度(以像素为单位):

Scaling normal to same length (in pixels) as g and b (138.9):

Normal =(26.7,-114.0,-74.7)

Normal = (26.7, -114.0, -74.7)

现在,我具有与 g b 相同长度的法线,我将它们绘制在同一张图片上:

Now that i have the normal that is the same length as g and b, i plotted them on the same picture:

我认为您会遇到一个新问题:相机镜头造成的失真.这三个点不能完美地投影到二维照相平面上.球形变形使直线不再笔直,相等的长度不再相等,并使法线稍微偏离法线.

i think you're going to have a new problem: distortion introduced by the camera lens. The three dots are not perfectly projected onto the 2-dimensional photographic plane. There's a spherical distortion that makes straight lines no longer straight, makes equal lengths no longer equal, and makes the normals slightly off of normal.

Microsoft研究有一种算法可以弄清楚如何校正相机的畸变:

Microsoft research has an algorithm to figure out how to correct for the camera's distortion:

相机校准的灵活新技术

但这超出了我

我们提出了一种灵活的新技术来 轻松校准相机.很好 适合不需专门使用 3D几何或计算机知识 想象.该技术只需要 相机观察平面图案 显示为几个(至少两个) 不同的方向.要么 相机或平面图案可以是 自由移动.议案不必 众所周知.子午透镜畸变为 模仿.拟议程序 由封闭形式的解决方案组成, 然后进行非线性细化 根据最大可能性 标准.既计算机模拟 和真实数据已用于测试 建议的技术,非常好 结果已经获得.比较的 用古典技术 昂贵的设备,例如两个或两个 三个正交平面,建议 该技术易于使用且灵活. 它推动了3D计算机视觉的发展 从实验室环境到 现实世界中的使用.

We propose a flexible new technique to easily calibrate a camera. It is well suited for use without specialized knowledge of 3D geometry or computer vision. The technique only requires the camera to observe a planar pattern shown at a few (at least two) different orientations. Either the camera or the planar pattern can be freely moved. The motion need not be known. Radial lens distortion is modeled. The proposed procedure consists of a closed-form solution, followed by a nonlinear refinement based on the maximum likelihood criterion. Both computer simulation and real data have been used to test the proposed technique, and very good results have been obtained. Compared with classical techniques which use expensive equipments such as two or three orthogonal planes, the proposed technique is easy to use and flexible. It advances 3D computer vision one step from laboratory environments to real world use.

他们有一个样本图像,您可以在其中看到变形:

They have a sample image, where you can see the distortion:


(来源: microsoft.com )


(source: microsoft.com)

注意

  • 您不知道看到的是纸板的顶部"还是底部",因此法线可以垂直镜像(即z = -z)

Guy在派生的代数公式中发现了一个错误.修复它会导致我不认为公式具有简单的封闭形式.这还算不错,因为无论如何也无法完全解决.但在数字上.

Guy found an error in the derived algebraic formulas. Fixing it leads to formulas that i, don't think, have a simple closed form. This isn't too bad, since it can't be solved exactly anyway; but numerically.

这是Excel的屏幕截图,其中我以两个已知规则开头:

Here's a screenshot from Excel where i start with the two knowns rules:

g · b = 0

| g | = | b |

|g| = |b|

将第二个数字写为差(错误"数量),然后可以将两个数字相加并使用该值作为数字,以使excel的求解器最小化:

Writing the 2nd one as a difference (an "error" amount), you can then add both up and use that value as a number to have excel's solver minimize:

这意味着您必须编写自己的数字迭代求解器.我盯着大学的《工程师数字方法》教科书;我知道它包含用于求解递归方程的算法,而没有简单的闭合形式.

This means you'll have to write your own numeric iterative solver. i'm staring over at my Numerical Methods for Engineers textbook from university; i know it contains algorithms to solve recursive equations with no simple closed form.

这篇关于三点法线向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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