IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.55k stars 4.81k forks source link

Is there a way to obtain the position change of the d435i camera #12784

Closed zxc0210 closed 5 months ago

zxc0210 commented 6 months ago

Required Info
Camera Model { D435i }
Operating System & Version Win 10
Platform PC
SDK Version 2
Language {C++}

Issue Description

I am using a d435i camera,and I want to do point cloud register. However, when I moved the camera, I found that the point cloud I obtained would overlap in cloudcompare. I want to know if there is a way to obtain the position change of the camera,so that I can restore the position of the point cloud in the world coordinate system.

MartyG-RealSense commented 6 months ago

Hi @zxc0210 RealSense 400 Series cameras are unable to track changes in the camera's position, unfortunately.

A possible solution might be to use the RealSense SDK's rs-kinfu C++ pointcloud tool. As the camera is moved, the pointcloud adds detail to the cloud using 'frame fusion'. So this may minimize the disruption to the pointcloud that you experience during camera motion. Once you are satisfied with the pointcloud then rs-kinfu can export the data to a .ply pointcloud data file, which you could then import into CloudCompare.

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv/kinfu

zxc0210 commented 6 months ago

Thanks a lot for your swify reply, I 'll try rs-kinfu later. And I have another question. I tried to integrate the accelerometer data of imu to obtain the movement, but I got wrong result. I found when the camera is stationary, the value of the accelerometer is not zero. Or do you know any method to eliminate the impact of gravity?

MartyG-RealSense commented 6 months ago

This is because the IMU component of RealSense cameras does not have internal hardware calibration. The non-zero Y-accel value when the camera is stationary can be corrected by using an instruction called RS2_OPTION_ENABLE_MOTION_CORRECTION that can perform correction on inaccurate raw IMU data to produce better "final" IMU values. An example of implementing this instruction in C++ is at https://github.com/IntelRealSense/librealsense/issues/5176

That script sets RS2_OPTION_ENABLE_MOTION_CORRECTION to '0' (correction disabled), so change '0' to '1' in the script to enable correction.

MartyG-RealSense commented 6 months ago

Hi @zxc0210 Do you require further assistance with this case, please? Thanks!

MartyG-RealSense commented 5 months ago

Case closed due to no further comments received.