KinectFusion

news2024/9/23 3:18:36

1.KinectFusion

笔记来源:
论文地址:KinectFusion: Real-time 3D Reconstruction and Interaction Using a Moving Depth Camera*
项目地址:github/KinectFusion
[1] 截断符号距离 | TSDF, Truncated Signed Distance Function

本篇对KinectFusion处理流程进行简要了解
KinectFusion功能:使用深度图进行实时三维重建


大致流程:
创建体素网格,第一帧相机在世界坐标系,根据第一帧的

1.1 Depth Map Conversion


从深度图中计算3D坐标点


从深度图中计算法向量


为什么偏导就是点的法向量?
这个问题在笔者之前的博客中有介绍,为什么曲面函数的偏导数可以表示其曲面的法向量?

通过内参矩阵的逆将相机像素平面二维点转到相机空间三维点
pixel: u = ( x , y )   depth: D i ( u )   3D vertex in camera’s coordinate space: v i ( u ) = D i ( u ) K − 1 [ u , 1 ] ,This results in a single vertex map V i \text{pixel:}\bold{u}=(x,y)\\ ~\\ \text{depth:}D_i(\bold{u})\\ ~\\ \text{3D vertex in camera's coordinate space:} \text{v}_i(\bold{u})=D_i(\bold{u})K^{-1}[\bold{u},1],\text{This results in a single vertex map} \text{V}_i\\ pixelu=x,y depthDi(u) 3D vertex in camera’s coordinate spacevi(u)=Di(u)K1[u,1]This results in a single vertex mapVi
相机空间中每个顶点的法向量
  normal vectors for each vertex: n i ( u ) = ( v i ( x + 1 , y ) − v i ( x , y ) ) × ( v i ( x , y + 1 ) − v i ( x , y ) ) ,This results in a single vertex map N i ~\\ \text{normal vectors for each vertex:}\bold{n}_i(\bold{u})=( \text{v}_i(x+1,y)-\text{v}_i(x,y))×(\text{v}_i(x,y+1)-\text{v}_i(x,y)),\text{This results in a single vertex map} \text{N}_i\\  normal vectors for each vertexni(u)=(vi(x+1,y)vi(x,y))×(vi(x,y+1)vi(x,y))This results in a single vertex mapNi
通过外参矩阵或旋转矩阵将相机空间中的顶点和每个顶点的法向量转到世界坐标系下
camera pose at time  i : T i = [ R i ∣ t i ]   vertex and normal can be converted into global coordinates: v i g ( u ) = T i v i ( u ) 、 n i g ( u ) = R i n i ( u ) \text{camera pose at time}\ i:\bold{T}_i=[\bold{R}_i|\bold{t}_i]\\ ~\\ \text{vertex and normal can be converted into global coordinates:}\bold{v}_i^g(\bold{u})=\bold{T}_i\bold{v}_i(\bold{u})、\bold{n}_i^g(\bold{u})=\bold{R}_i\bold{n}_i(\bold{u}) camera pose at time iTi=[Riti] vertex and normal can be converted into global coordinatesvig(u)=Tivi(u)nig(u)=Rini(u)

1.2 Camera Tracking


该步骤生成的3D点用作ICP求解位姿R,t

第一帧时相机坐标系在世界坐标系的原点,相机平面像素点由内参矩阵得到一组3D点,第二帧也由内参矩阵得到一组3D点,这两组3D点进行ICP得到第二帧到世界坐标系的旋转矩阵 R 1 R_1 R1和平移向量 t 1 t_1 t1,后续帧重复这个操作(第n帧包含了前n-1帧的所有点,依次累积)最终世界坐标系中就会有融合各个帧得到的一组点云


两组点云ICP的第一步需要找到两组点云之间的匹配点(或者说是重合的部分)
两组点云依靠这个重合部分进行融合

两组点云依靠重合部分进行融合

文章中用于点云匹配的算法
将前一帧的点(包含前面所有点)投影到当前帧的目的是寻找前一帧和当前帧的匹配点,通过匹配点ICP得以求解获得位姿





1.3 Volumetric Integration

通过ICP得到位姿后,我们把每一帧对应的相机坐标系内的体素都转换到了世界坐标系中,每次转换都会对世界坐标系内体素进行更新


论文中提到使用SDF的变体将全局 3D 顶点集成到体素中,指定与实际表面的相对距离。这些值在表面前为正,在表面后为负,表面界面由zero-crossing定义,值在此改变符号

下图来自: 截断符号距离 | TSDF, Truncated Signed Distance Function
SDF计算方式:camera 到 每个 voxel 的距离减去voxel对应的深度

将volume slice (xy plane) 中的每个体素转换到3D位置,而后将这些转换到当前帧(相机坐标系下)用于raycasting后并显示


1.4 Raycasting



Listing 3 Raycasting to extract the implicit surface, composite virtual 3D graphics, and perform lighting operations.

1: for each pixel u ∈ output image in parallel do
   # For each pixel in the output image, a ray will be cast from the camera's origin through the pixel, 
   # in parallel, meaning each pixel is processed simultaneously.

2: raystart ← back project [u, 0]; convert to grid pos
   # Compute the starting position of the ray by back-projecting the pixel's coordinates (u, 0) from image space
   # to the 3D grid (volume) space. This represents the position on the near clipping plane.

3: raynext ← back project [u, 1]; convert to grid pos
   # Compute a second point on the ray by back-projecting the pixel's coordinates (u, 1) from image space
   # to 3D grid space. This represents a position further along the viewing direction (typically on the far clipping plane).

4: raydir ← normalize (raynext − raystart)
   # Calculate the direction of the ray by subtracting the starting point from the next point 
   # and normalizing the resulting vector.

5: raylen ← 0
   # Initialize the ray length, which will be used to keep track of how far along the ray we have traveled in the 3D grid.

6: g ← first voxel along raydir
   # Determine the first voxel in the 3D grid that the ray intersects. This will be the starting voxel for ray traversal.

7: m ← convert global vertex to grid pos
   # Convert the closest global vertex (from the known surface) to the grid position. This is used to determine
   # if we need to continue ray traversal or stop and shade the pixel.

8: mdist ← ||raystart − m||
   # Calculate the distance from the starting point of the ray to the nearest vertex.
   # This distance is used to decide if the ray has reached the surface.

9: while voxel g within volume bounds do
   # While the ray is within the boundaries of the volume (i.e., inside the 3D grid):
   # This loop traverses the grid along the ray direction.

10: raylen ← raylen + 1
    # Increment the ray length as the ray moves from one voxel to the next.

11: gprev ← g
    # Store the current voxel position before moving to the next one.
    # This is necessary for detecting zero crossings (surface intersections).

12: g ← traverse next voxel along raydir
    # Move to the next voxel along the ray's direction.

13: if zero crossing from g to gprev then
    # Check if there is a zero crossing between the TSDF values of the current voxel and the previous voxel.
    # A zero crossing indicates that the ray has intersected with the surface.

14: p ← extract trilinear interpolated grid position
    # Extract the exact intersection point within the grid by performing trilinear interpolation.
    # This provides a more accurate position of the surface intersection.

15: v ← convert p from grid to global 3D position
    # Convert the interpolated grid position to a global 3D position.
    # This gives the exact 3D coordinates of the surface point in the world space.

16: n ← extract surface gradient as ∇tsdf(p)
    # Compute the surface normal at the intersection point by calculating the gradient of the TSDF (∇tsdf).
    # The gradient points in the direction of the steepest increase in the TSDF value, representing the surface normal.

17: shade pixel for oriented point (v, n) or
    # Shade the pixel using the 3D position (v) and the surface normal (n).
    # This involves computing the pixel's color based on lighting, material properties, and viewing direction.

18: follow secondary ray (shadows, reflections, etc)
    # Optionally, trace secondary rays to account for shadows, reflections, refractions, etc.
    # This step can enhance the realism of the rendered image by simulating advanced lighting effects.

19: if raylen > mdist then
    # If the ray length exceeds the distance to the nearest vertex (mdist),
    # this implies that the ray has traveled past the expected surface point without finding a zero crossing.

20: shade pixel using inputted maps or
    # If no zero crossing was detected, use pre-computed maps (e.g., depth maps or normal maps) to shade the pixel.
    # This fallback ensures that the pixel still gets shaded even if the ray doesn't directly hit the surface.

21: follow secondary ray (shadows, reflections, etc)
    # Optionally, continue with secondary ray tracing for additional effects like shadows and reflections, as in step 18.

1.4 总结一下上述过程

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2097135.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

零跑C11 S01 T03 路特斯EMEYA繁花ELETRE启辰D60EVPLUS维修手册电路图资料更新

经过整理,零跑C11 S01 T03 路特斯EMEYA繁花ELETRE启辰D60EVPLUS已经更新至汽修帮手资料库内,覆盖市面上99%车型,包括维修手册、电路图、新车特征、车身钣金维修数据、全车拆装、扭力、发动机大修、发动机正时、保养、电路图、针脚定义、模块传…

tomcat redis minio nginx windows开机自启

tomcat 开机自启 命令 service.bat install 控制台输入 service.bat install 再到服务中去查看有没有注册成功,minio,redis,nginx 也是一样在服务里查看注册成功没 redis 开机自启 命令 redis-server.exe --service-install redis.windows.conf --loglevel ve…

CT转化MR图像的算法及模型解决

将CT(Computed Tomography)图像转化为MR(Magnetic Resonance)图像是一个复杂的图像处理任务,因为CT和MR图像是基于完全不同的物理原理获取的。CT图像主要反映组织的密度差异,而MR图像则反映组织的质子密度、…

python 遍历文件夹中的文件

上代码: import os# 设置要遍历的文件夹路径 folder_path utils# 遍历文件夹 for dirname, subdirs, files in os.walk(folder_path):print(fFound directory: {dirname})for file in files:print(f{os.path.join(dirname, file)} is a file)# 如果需要遍历子文件…

探索存储世界:TF卡与SD卡的奥秘

在这个数字化时代,数据存储变得至关重要。TF卡(TransFlash卡)和SD卡(Secure Digital卡)作为两种常见的存储介质,它们在我们的日常生活中扮演着重要角色。MK米客方德将带您深入了解TF卡的基本概念&#xff0…

netcore高级知识点,内存对齐,原理与示例

最近几年一直从事物联网开发,与硬件打交道越来越多,发现越接近底层开发对性能的追求越高,毕竟硬件资源相对上层应用来实在是太缺乏了。今天想和大家一起分享关于C#中的内存对齐,希望通过理解和优化内存对齐,可以帮助大…

深度学习模型量化方法

深度学习模型量化方法 (qq.com)

【hot100篇-python刷题记录】【回文链表】

R7-链表篇 思路: 转回文数组法 链表转数组,再使用双指针判断是不是回文数组即可。 wkao?!根本不用双指针判断是否回文数组,只需要倒序判断布尔值即可。(牛啊牛啊) # Definition for singly-linked list. # class…

LIN总线CAPL函数—— 更新特定报文数据(linUpdateResponse)

🍅 我是蚂蚁小兵,专注于车载诊断领域,尤其擅长于对CANoe工具的使用🍅 寻找组织 ,答疑解惑,摸鱼聊天,博客源码,点击加入👉【相亲相爱一家人】🍅 玩转CANoe&…

激光测距模组光轴调试怎么调

激光测距模组作为精密的测量工具,其光轴调试是确保测量精度的重要环节。正确调试光轴不仅能够提升测量的准确性,还能延长设备的使用寿命。以下将由鑫优威给大家详细介绍激光测距模组光轴调试的步骤及注意事项。 一、准备工作 在进行光轴调试前&#xff0…

[米联客-XILINX-H3_CZ08_7100] FPGA程序设计基础实验连载-24 TPG图像测试数据发生器设计

软件版本:VIVADO2021.1 操作系统:WIN10 64bit 硬件平台:适用 XILINX A7/K7/Z7/ZU/KU 系列 FPGA 实验平台:米联客-MLK-H3-CZ08-7100开发板 板卡获取平台:https://milianke.tmall.com/ 登录“米联客”FPGA社区 http…

非标机械设计项目“规范”笔记

2.自动化设备开发特点与技术文件输出 2.1自动化设备 自动化设备 工业自动化设备类型:标准自动化、非标自动化 载具和治具 焊接治具---汽车行业用的多 压装、压合治具---3C行业 治具种类: 电木:测试治具箱体&#xf…

Mac系统App打包成dmg文件总结

使用软件:BetterZip 操作步骤如下: 打开BetterZip 将想要打包的App拖入当前界面 选中文件点击文件-另存为 修改保存位置和压缩格式,点击存储即可 保存完成后修改文件名即可

关联模块的查询列表勾选数据,新建带出勾选数据

在模块找到页面拓展,新建按钮,代码在链接目标地址中写 获取当前勾选数据的id,将ID拼接到弹窗地址上 var CheckedCheckboxId _xtable_CheckedCheckboxId();//勾选中的checkid var result CheckedCheckboxId.replace(/^,|,$/g, ""); window.ope…

哪种类型的耳机不伤耳朵?五款口碑绝佳机型安利!

​要说最不伤耳朵的耳机,那肯定得是开放式耳机了!开放式耳机现在超火,因为它们戴起来舒服,音质又棒,让喜欢音乐和运动的朋友们超爱。特别是那些边运动边听歌的人,开放式耳机简直是完美。它们戴着稳&#xf…

网站注册流程是怎样的

网站注册流程是一项关键的操作,对于用户来说,这是接触和利用公司服务的第一步。一个简单、清晰的注册流程能够提高用户体验,增强用户对公司的信任感。下面是一个通用的公司网站注册流程,以及一些设计原则,以确保注册过…

NB6L295M MCU 设计参考

NB6L295M 2.5V / 3.3V 双通道可编程时钟 / 数据差分 CML 的延迟输出多电平输入,带内部终端;NB6L295M 是一款双通道可编程延迟芯片主要用于 Clock 或 Data 去偏斜和定时调整。NB6L295M 在那两个单独的可变延迟通道 PD0 和 PD1 可以在以下之一中配置两种操…

基于PiAlert的网络扫描器NetAlertX

什么是 NetAlertX ? NetAlertX 是💻🔍 WIFI/LAN 入侵检测器。能扫描连接到您的网络的设备,并在发现新设备或未知设备时向您发出警报。能够在一个地方可视化您的所有网络,获得实时警报,并与您的智能家居无缝…

探秘微信传奇:背后的产品观重塑社交江湖

在当今互联网的浩瀚星空中,微信无疑是那颗最为璀璨的明星。它如同一座无形的桥梁,连接着全球数十亿人的生活、情感与梦想。那么,微信究竟是如何铸就这般传奇的呢?让我们一同深入探寻微信背后的产品观,揭开它神秘的面纱…

C练手题--Exclusive “or“ (xor) Logical Operator 【8 kyu】

一、原题 链接:Training on Exclusive "or" (xor) Logical Operator | Codewars Exclusive "or" (xor) Logical Operator Overview In some scripting languages like PHP, there exists a logical operator (e.g. &&, ||, and, or, e…