Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解析.bag包获得深度图和rgb图,根据内外参对齐深度图到rgb图得到某一像素点对应的深度值。这个方法与直接在Intel.RealSense.Viewer上使用鼠标停留在深度图上显示的深度值有出入,感觉Intel.RealSense.Viewer上显示的深度值更加准确 #13629

Open
weishiguan opened this issue Dec 25, 2024 · 3 comments
Labels

Comments

@weishiguan
Copy link

通过什么方式可以通过解析.bag包得到更准确的 每帧rgb图上某像素点对应的深度值呢?Intel.RealSense.Viewer是如何做到的,我能否使用同样的方法实现我的目的?
image
image

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Dec 25, 2024

Hello @weishiguan Have you written your own program script to read the depth from the bag file please? If you have then a difference between the RealSense Viewer and a program script is that the Viewer applies a range of filters to the depth information by default, but a script applies no filters unless you deliberately put the filters into the script. An absence of filters in a program script could cause the depth values to be different from those provided in the Viewer.

If you are performing depth to color alignment then it is important to use the color intrinsics or aligned intrinsics, and not the depth intrinsics. This is because when depth to color alignment is performed, the origin of depth changes from the center line of the left infrared sensor to the center line of the RGB sensor.

Also, looking at the '3204' distance value that you provided, I wonder if this is the raw pixel depth value. To get the real world distance in meters, you would multiply the raw depth value by the depth scale value of the camera. For most RealSense 400 Series camera models this value will be '0.001'. For example, 3204 (raw pixel depth value) x 0.001 (camera depth scale) = 3.204 (real-world meters)


您好 @weishiguan 您是否编写了自己的程序脚本来从包文件中读取深度?如果您编写了,那么 RealSense Viewer 和程序脚本之间的区别在于,Viewer 默认将一系列过滤器应用于深度信息,但脚本不应用任何过滤器,除非您故意将过滤器放入脚本中。程序脚本中缺少过滤器可能会导致深度值与 Viewer 中提供的值不同。

如果您正在执行深度到颜色对齐,那么使用颜色内在函数或对齐内在函数而不是深度内在函数非常重要。这是因为当执行深度到颜色对齐时,深度的原点从左红外传感器的中心线变为 RGB 传感器的中心线。

此外,查看您提供的“3204”距离值,我想知道这是否是原始像素深度值。要获得以米为单位的真实世界距离,您需要将原始深度值乘以相机的深度比例值。对于大多数 RealSense 400 系列相机型号,此值为“0.001”。例如,3204(原始像素深度值)x 0.001(相机深度比例)= 3.204(真实世界米)

@weishiguan
Copy link
Author

很高心收到您的回复。如你所说,我确实编写了自己的程序脚本从深度图(解析后的.bag)中读取深度,我能否在我的代码中引入与Viewer相同的过滤器,相关的代码可否提供帮助。

此外,对于深度对齐到rgb,我使用了rgb内参和外参进行对齐,这和您所提示的一致;对于距离值,我提供的单位为mm(毫米),感谢您的提示。

此外,我将提供我的代码作为对齐参考,如果有问题非常感谢您的指导。
coordinate.txt

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Dec 26, 2024

The RealSense Viewer applies multiple filters including Decimation, Spatial, Disparity and Temporal. Each filter would have to be individually programmed into the script.

There is a Python example of post-processing and alignment code at #11246


RealSense Viewer 应用了多个过滤器,包括抽取、空间、视差和时间。每个过滤器都必须单独编程到脚本中。

#11246 上有一个后处理和对齐代码的 Python 示例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants