3D 空间中的激光投影仪校准

2024-04-23

我正在研究一种在现实世界中校准激光投影仪的解决方案。该项目有几个目标。

1. Take in a minimum of four points measured in the real world in 3d space that represent the projection surface. 
2. Take in coordinates from the laser that are equivalent to the points received in part 1
3. Determine if the calibration file matches the real world captured points and show a deviation between the coordinate spaces
4. Using the data from the previous steps, take coordinates in 3d real world space and translate them to laser coordinates.

Example:

长方形平板桌子的每个角都有一个目标。目标的一个角通过垫片在空中升高 50 毫米(约 2 英寸)。只是因为目标升高了 50mm,我不希望我的投影表面倾斜。我想考虑高度并仍然将最终产品投影在 Z = 0 平面上。这些目标在现实空间中的坐标如下所示(值均以毫米为单位):

激光坐标范围从-32000到32000,他们使用光电传感器捕获现实世界中的目标,并在捕获时返回激光坐标系中的值。捕获的坐标如下所示。 (值范围从 -32000 到 32000,它们的单位我不知道)。

Goal:

确定捕获的激光坐标是否正确代表所提供的现实世界坐标(如果不是,则确定与这些坐标的偏差),然后提供变换矩阵或其他一些方法,将 3D 现实世界空间中的点准确地变换为 2D 激光空间。

我尝试过的:

我尝试过实施几种不同的透视校正解决方案。一份来自 OpenCvSharp3,一份来自代码项目线程。这两种方法同样有效,但都有问题。

1. I cannot determine a deviation from the real world. The points are perfectly mapped to the perspective representation so I cannot determine if they are misaligned from the real world expectation
2. I cannot represent source points in a 3d space. Targets may be placed arbitrarily in the Z-direction, and with perspective mapping I cannot seem to account for that Z Direction.

如果有人以前尝试/解决/遇到过这个问题并且能够提供任何见解,我们将不胜感激。

先感谢您!


这里有一个示例代码,显示了所需的正确计算。想象一下真实的表格 X,Y 是 X 与图片水平,Y 向上。为了方便和更容易遵循样本,原点为 0,0,0。然后第二张图像将正确的 X,Y 想象为左上角,其中 X 轴向下,Y 向右(-90 度旋转)。不用担心稍后可以轻松调整。下面的快速示例中的注释解释了每一行的作用及其原因。

// compute from the points the table height and width
var realTableDimX = 902d;
var realTableDimY = 597d;

// the real table matrix is 0,0,0 on bottom corner
// so matrix is identity (our source)
var realTableMatrix = new Matrix3D();

// the laser is rotated 90 degree and position at the top left based compared to the realTablematrix
var laserMatrix = new Matrix3D();

// rotate and translate the laser matrix into position
// 90 degree doesnt account for the little skew (see comment outside code for explaination on how to fix that)
laserMatrix.Rotate(new Quaternion(new Vector3D(0, 0, 1), -90d)); 
laserMatrix.Translate(new Vector3D(0, realTableDimY, 0d));

// compute the laser dimensions (i used your points you found out)
var laserDimX = 20392d - (-16300d);
var laserDimY = 12746 - (-11409d);

// calculate the ratio to factor in to displace the point to the real value onto the laser matrix
var laserXRatio = laserDimX / realTableDimX;
var laserYRatio = laserDimY / realTableDimY;

// since matrix are 1 to 1 when you compute if you have an equal ratio of 40 in X and 40 in Y then the point at 10,10,0 on
// the real table is correcponding to the point 400,400,0 on the laser matrix. But since it's rotated 90 degree you
// will need to apply the Y ration to the X point after the transform and the X ratio to the Y point to get the actual point.

// sample point on table. Logic can be flipped with laser matrix to do it the other way
var sampleRealTablePoint = new Point3D(450, 300, 0); // roughly centered

// transform the point from one UCS to another is simply multiplying by it's current UCS (matrix it's in)
// to transform it to world UCS then multiply by the inverse of other UCS we want it in (the other matrix)
var sampleRealTablePointWorld = realTableMatrix.Transform(sampleRealTablePoint);

// convert that point into the laser matrix but first create and inverted matrix of the laser matrix
// we copy a matrix to not modify the current one when inverting it
var laserInvertedMatrix = new Matrix3D() * laserMatrix;
laserInvertedMatrix.Invert();

// get the sample point in the world of the laser matrix
var sampleRealTablePointToLaserMatrix = laserInvertedMatrix.Transform(sampleRealTablePointWorld);

// not adjust the X and Y like said earlier
var finalAdjustedPoint = new Point3D(sampleRealTablePointToLaserMatrix.X * laserXRatio, sampleRealTablePointToLaserMatrix.Y * laserYRatio, 0d);

 // this is if you want the point in the world of the laser matrix and not it's offset from the 0,0,0
 // the vector here is the top left corner of your laser matrix (x, y, z)
 var laserWorldFinalPoint = finalAdjustedPoint + new Vector3D(-11409d, -16155d, 0d);

所以这里你有它。真实桌子上的样本中心点转换为{12203,5947,0}使用这个代码几乎是激光矩阵的死点。

现在来说说倾斜部分。这也很简单。这一行:

laserMatrix.Rotate(new Quaternion(new Vector3D(0, 0, 1), -90d));

这就是你需要改变的一切。你想要的是始终认为左上角是原点,所以你想要做的就是想象一条向右延伸的直线(在你的激光图像上),并且你想弄清楚这个完美的 X 轴之间的角度是多少( vector(1,0,0)) 和左下点的向量,在本例中略大于 90 度(可能在 -91 到 -95 度之间)。您需要计算出 Z 轴的角度才能实现这一目标。您使用的公式是否返回 +270 度而不是 -90 度并不重要,因为它是一个矩阵,它会给出相同的结果。

这里是一种基于给定旋转轴计算两个向量之间角度的方法

public double AngleToInDegree(Vector3D v, Vector3D vector, Vector3D normal)
{
    var dotNormal = Vector3D.DotProduct(normal, Vector3D.CrossProduct(v, vector));

    var dotVector = Vector3D.DotProduct(v, vector);

    var angle = Math.Atan2(dotNormal, dotVector);

    return angle * 180d / Math.PI;
}

可用的示例是:

var angle = AngleToInDegree(new Vector3D(1,0,0), new Vector3D(0,1,0), new Vector3D(0,0,1));

这会检查完美 X 向量和完美 Y 向量相对于完美 Z 向量之间的角度,这将为您提供 90 度。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

3D 空间中的激光投影仪校准 的相关文章

随机推荐

  • 如何控制图库图像的重叠?

    我正在从 URL 下载图像并将它们放入图库中 下载图像后 它们会正确加载 一旦从缓存加载图像 图像就会相互重叠 我该如何解决这个问题 Use the android spacing图库视图的属性
  • 如何捕获预期(和预期)的 302 Ajax 响应?

    所以 如果你回头看看我的上一个问题 https stackoverflow com questions 2764444 getting autodiscover url from exchange email address关于 Excha
  • 如何通过单击 MainFrame 内的按钮来更改 MFC 视图

    我想通过单击窗口内的按钮来更改呈现的视图像这样 https i stack imgur com 3IA2o png 我的项目设置 我制作了一个没有文档 视图支持的 MFC 项目 SDI 我在设计器中又创建了两个视图并向它们添加了类 新的视图
  • 使用 MultiIndex 列过滤行

    当创建具有 MultiIndex 列的 DataFrame 时 似乎无法使用类似语法来选择 过滤行df df AA gt 0 0 例如 import pandas as pd import numpy as np dates np asar
  • 如何让 Icecast 在端口 80 上运行 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我在尝试让 Icecast 在端口 80 上工作时遇到问题 它在默认情况下工作 但当我尝试将其设置为端口 80 时 一切都中断了 我已确保
  • 错误例如:“求解环境:初始冻结求解失败。使用“灵活解决”和“单元测试”选项卡重试

    我正在使用spyder python 我想测试我的代码 我已遵循pip install spyder unittest and pip install pytest 我已经重新启动了内核并重新启动了我的 MAC 然而 单元测试选项卡不会出现
  • 如何使用 jquery 旋转悬停图像?

    我试图在悬停时将 返回顶部 按钮旋转 360 度 而在鼠标离开时不取消旋转 我已经尝试了多种 jQuery 代码变体 但我似乎仍然无法让它工作 这是迄今为止我所得到的真实示例 CSS 悬停在图像之间 我尝试将 jQuery 更改为mouse
  • Rails 3:更改现有 mysql 数据库的字符集和排序规则

    是否可以使用 Rails 迁移或其他选项更改现有 Mysql 数据库的字符集和排序规则 初始配置数据库字符集和排序规则的最佳方法是什么 本机查询可以在 Rails 迁移中执行 def self up execute ALTER DATABA
  • 如何使用linq动态过滤子集合

    我正在尝试过滤用户请求的结果 例如你有orders and order details and products是子集合 当用户想要按产品过滤时 我收到错误 因为No property or field PRODUCTS exists in
  • 如何在 FastAPI 中访问端点视图函数内的 APP 属性?

    这是我的项目结构 gitignore README md requirements txt start py app main py apis v1 init py routes evaluation essentials py train
  • python pandas 选择头部和尾部

    对于 Pandas 中的 DataFrame 如何同时选择前 5 个值和后 5 个值 例如 In 11 df Out 11 A B C 2012 11 29 0 0 0 2012 11 30 1 1 1 2012 12 01 2 2 2 2
  • 无法将“obj\Debug\{project}.dll”复制到“bin\{project}.dll”

    最近 当我尝试运行我的项目时 Web 版 Visual Studio Express 2013 经常抛出此错误 我找到的唯一解决方案是退出并重新启动 Visual Studio 或 有时 完全重新启动 Windows 什么会导致这样的事情
  • 加载时css3过渡动画?

    是否可以在页面加载时使用 CSS3 过渡动画而不使用 Javascript 这就是我想要的 但是在页面加载时 图像滑块 html https web archive org web 20141021062316 http rilwis go
  • Spring Boot x509 测试 - pcf

    In 云铸造厂我已对其进行配置 以便将客户端证书转发到我的 Spring Boot 应用程序 该证书被放置在x forwarded client certheader 中 spring boot 应用程序读取 this 并检查 CN 是否已
  • 如何在access中查看宏代码?

    我有一个 Microsoft Access 数据库 里面有一个宏 如何查看宏的代码 打开Access数据库 您将看到表 查询 报告 模块和宏 其中包含可用于按顺序调用常见 MS Access 操作的宏 对于自定义 VBA 宏 请按 ALT
  • Safari 在 div 中使用 Google 地图打破边框半径

    对我来说关于 Stack 的第一个问题 我已经完成了我的作业并发现了类似这个主题的内容 在 webkit 浏览器中 v3 谷歌地图不尊重容器的边框半径 有人有解决方法吗 https stackoverflow com questions 1
  • 查找API端点的方法

    API探索 尽管有几个问题涉及该主题 但我找不到解决我想要理解的核心概念的问题 如果知道 API 的根结构 我们可以想象一下http stackoverflow com api service 我们可以成功地从已知端点检索结果 比方说htt
  • 如何安全地销毁 QThread?

    我想正确地销毁一个QThread在 Qt 5 3 中 到目前为止我已经得到 MyClass MyClass QObject parent QObject parent mThread new QThread this QObject con
  • 获取 3 个列表之间的差异

    我正在研究列表的差异 gt gt a 1 2 3 gt gt b 2 4 5 gt gt c 3 2 6 两组之间的对称差异可以使用以下方法完成 gt gt z set a symmetric difference set b gt gt
  • 3D 空间中的激光投影仪校准

    我正在研究一种在现实世界中校准激光投影仪的解决方案 该项目有几个目标 1 Take in a minimum of four points measured in the real world in 3d space that repres