-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Misalignment Between Depth and RGB Streams on Intel RealSense D435 #13308
Comments
Hi @tangyipeng100 The RealSense Viewer does not have alignment in its 2D mode. Depth and RGB can be mapped together if you click the '3D' option in the top corner of the Viewer window to enter 3D pointcloud mode and then enable depth first and RGB second. Without alignment, there will be differences between the depth and RGB images because the position of the RGB sensor on the front of the camera is horizontally offset from the left infrared sensor (which is the origin of depth). Also on the D435 model, depth has a larger field of view size than the RGB field of view size. So when depth is aligned to color, the outer edges of the aligned image will be cut off. Furthermore, by default the Viewer has a post-processing filter called the Decimation filter enabled that 'downsamples' the depth resolution by a factor of 2. For example, a 640x480 depth image will be reduced to 320x240 resolution. To turn this filter off and display depth at the resolution that you selected, go to Stereo Module > Post Processing, expand open the list of filters and left-click on the blue icon beside Decimation Filter to turn the icon black (Off). |
thx. I am using the Intel RealSense SDK to stream and align depth and color frames. After aligning the frames using align.process(frames), I noticed that the depth frame (depth_frame.get_data()) contains only zeros, rendering the depth stream unusable. How to solve it?
|
Hi @tangyipeng100 If you are getting zeroes like the case at #3631 then a suggestion for correcting this is to convert the numpy array to a list because of how numpy summarizes when printing large arrays. The link below descibes how such a conversion might be performed. https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tolist.html |
thx, I have used np.unique() to observe the value, and it equals to 0. Besides, if I comment 'frames = align.process(frames) ', then I can get the depth stream correctly. |
The common way to program alignment, as demonstrated by the librealsense SDK's official Python depth-color alignment program align_depth2color.py, is to give the aligned frames their own individual variable name such as 'aligned_frames' instead of using 'frames'. That way, you are not overwriting the contents of the original 'frames' variable at
|
thx, In fact, I am using opencv_viewer_example, and I try to follow your strategy, and it works as before, like the image shows: when I run align-depth2color.py, I get: |
Does the alignment work if you use a modified version of the align_depth2color.py script at #11329 |
I've tried running the alignment script on Ubuntu 18.04, but it's still not working. I searched for similar issues, but couldn't find anything that matches my problem. Could this be related to a hardware issue? If I manage to obtain the alignment parameters, would it be possible to manually align the depth and color images? |
This is an unusual problem, though is unlikely to be a hardware issue if |
If resolving this issue proves too challenging, could I instead use the intrinsic and extrinsic parameters to achieve the alignment? |
You could try resetting your camera to its factory-new default calibration in the RealSense Viewer using the instructions at #10182 (comment) to see whether that makes a difference. In regard to using intrinsic and extrinsic parameters, #1274 (comment) has some suggestions for methods of alignment other than using align.process. |
@tangyipeng100 I have faced same issue for Realsense D435i camera.
|
@ozgur-kurt |
@ozgur-kurt # Convert images to numpy arrays
depth_image = np.asanyarray(depth_frame.get_data())
color_image = np.asanyarray(color_frame.get_data())
# Align depth frame to color frame
align = rs.align(rs.stream.depth)
aligned_frames = align.process(frames)
aligned_depth_frame = aligned_frames.get_depth_frame()
aligned_depth_image = np.asanyarray(aligned_depth_frame.get_data()) In this snippet, the depth frame is aligned, but the RGB frame isn't, which leads to misalignment between the depth and RGB streams, as shown in the image I’ve provided. Could you provide guidance on how to ensure both frames are properly synchronized? |
Hi @tangyipeng100 Do you have an update about this case that you can provide, please? Thanks! |
@MartyG-RealSense Thank you for your response. I've been a bit busy recently, but I plan to use the intrinsic parameters to align the depth and RGB streams next. I’ll share any updates as soon as I have them. |
Thanks very much, @tangyipeng100 - I look forward to your next report. Good luck! |
@MartyG-RealSense Hi, I am trying to manually acquire the depth-to-RGB extrinsic parameters to align the depth and RGB streams using the following code: import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
profile = pipeline.start(config)
depth_to_color_extrinsics = profile.get_stream(rs.stream.depth).as_video_stream_profile().get_extrinsics_to(
profile.get_stream(rs.stream.color))
print("Rotation:", depth_to_color_extrinsics.rotation)
print("Translation:", depth_to_color_extrinsics.translation)
pipeline.stop() However, I am getting the following results:
It seems like there might be an issue with the extrinsic parameters for my device. Could this be causing the Thanks! |
This particular question is outside of my programming knowledge, unfortunately. I do apologize. However, #10180 (comment) has a Python demonstration of getting depth to color extrinsics.
|
@MartyG-RealSense I've been following the provided code but I continue to get extrinsics parameters as all zeros, as shown in the image below: I'm wondering if it's possible to obtain the correct extrinsics parameters using the official software "Intel RealSense Dynamic Calibrator"? Unfortunately, when I tried using the Dynamic Calibrator, I encountered the following error: Any guidance on how to resolve this issue or alternative methods to correctly retrieve extrinsics parameters would be greatly appreciated. Thanks in advance! |
The error indicates that the Dynamic Calibration tool is having problems with the 'calibration table' inside the camera which stores the camera's calibration parameters. When the Dynamic Calibrator tool is installed, it also installs a text-based program called CustomRW that can be used to perform a 'gold reset' of the camera to create a new calibration table inside the camera to replace one that is possibly corrupted. On Windows you can activate the gold reset to reset the camera to its factory-new default calibration by inputting the text command below into the Windows Command Prompt text interface to launch CustomRW in gold reset mode.
|
I attempted to run the following commands, but encountered an issue:
I also tried installing a previous firmware version, but the error persists. It seems like I'm encountering a similar issue to this one. Is this a known issue with the D435? If so, are there any recommended solutions or workarounds for this error? |
As you observed, this issue about calibration tables not being supported has occurred a small number of times in the past. There is not a known fix for it though, unfortunately. The error messages suggests "If you are already using the latest software, please re-calibrate the device with the latest OEM Calibration tools and try again". That OEM version of the Dynamic Calibration software is only available though to purchasers of Intel's $1500 USD calibration target board product, so this may not be an option for you. https://store.intelrealsense.com/buy-intel-realsense-d400-cameras-calibration-target.html An alternative that may be worth exploring is to try installing the Dynamic Calibration software on Ubuntu using the instructions on page 14 onwards of the tool's user guide. Those instructions install the earlier 2.11.0.0 version of the tool. |
@MartyG-RealSense I am now trying to calibrate the depth and RGB manually and have obtained initial results. Recently, I have been quite busy, but I will update you with my findings after this period. Thanks! |
You are very welcome. Thanks very much for the update! |
Hi @tangyipeng100 Do you have an update about this case that you can provide, please? Thanks! |
HI @tangyipeng100 Do you require further assistance with this case, please? Thanks! |
I apologize for my delayed response. I've been busy with my paper and interview preparations recently. I have tried manually calibrating the RGB and depth streams but haven’t yet evaluated additional cases to confirm if my manual extrinsic parameters are accurate. Once I’ve completed my current tasks, I’ll continue with this project and update you on the results. Thank you for your patience. |
You are very welcome. It's no problem at all. I look forward to your next report. Good luck! |
Case closed due to no further comments received. |
I'm encountering a misalignment between the depth and RGB streams when using the Intel RealSense D435 camera. The two streams do not align accurately in both absolute and relative positions, as shown in the attached image.
Has anyone experienced a similar issue or knows how to fix this? Any advice would be appreciated.**
The text was updated successfully, but these errors were encountered: