-
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
D455 camera calibration and captures feature points #12689
Comments
Hi @junmoxiao11 Does your depth image improve if you reset the camera to its factory-new default calibration in the RealSense Viewer using the instructions at #10182 (comment) please? |
If you expand open the Post Processing section of the Viewer's side-panel and enable the Hole Filling filter (which is turned off by default) then it should fill in the holes. |
I am not sure I know what you mean. And what do yo mean fill in the hole? Dose that mean filling in the black depth noise? |
You could try resetting the camera in the Viewer to its factory-new default calibration to see whether your depth image improves. Instructions for doing so can be found at #10182 (comment) |
After I tried it the way you said, all the black noise on the image was gone! Thank you! But want I turned the realsense-viewer back on, the Settings were gone again and I had to readjust them. Is there a way to save my Settings for the camera? So that everytime I open the realsense-viewer, I don't have to keep adjusting it. |
Some settings, including post-processing filters, are not preserved when the Viewer is closed and reset to their default status when the Viewer is re-opened. There is not a way to permanently set these options in the Viewer unfortunately. RealSense 400 Series cameras can perform excellently in sunlight, except when directly facing the sun. When the camera faces the sun its infrared sensors can become saturated with light, negatively affecting the depth and infrared images. If auto-exposure is enabled then the camera should auto-correct when the camera is no longer directly facing the sun. Using a RealSense camera equipped with a light-blocking filter such as the D455f can result in an improved depth image. https://www.intelrealsense.com/depth-camera-d455f/ The filter, the CLAREX NIR-75N, can also be purchased separately and attached externally on the outside of a RealSense camera that is not equipped with the filter such as the D455. |
So in your third step : Find the filter called Hole Filling and click on the red icon beside it (which means Off) to turn it blue (On). The small black holes should then be automatically filled in. The setting in this step cannot be saved, right? |
No, the setting cannot be saved. An alternative method that you could try for reducing holes is to set the Laser Power option under 'Stereo Module > Controls' to its maximum value of '360'. The Laser Power value remains at its previous setting when the Viewer is opened and closed, so once set to 360 then it should still be 360 when the Viewer is next launched. |
And I found that if I pointed the camera at a light source , like an electric lamp, the part of the lamp that was captured would appear black. Is the camera not aligned with the light source when shooting? |
If the light source that the camera is pointed at is very strong then the camera may be unable to read depth information from the area where the light is concentrated, causing that area to appear as black (no depth) on the depth image. RealSense camera models equipped with a light-blocking filter, such as D455f, will be better able to handle light. The filter can also be purchased separately as the CLAREX NIR-75N product and attached over the camera lenses on the outside of a non-filtered camera model such as D455. |
Thank you for your answer. Now I want to shoot a video with the D455 camera and save it. Then use the code to capture the objects in this video that have changed positions. Dose this idea of mine work? |
If you want to analyze the data then you would likely have to record a bag file, which is like a video recording of camera data. When a script reads a bag file then it can use the data stored in the bag as though it is accessing a live camera. |
As you said, I will try to use the code to capture the dispalcement change of the moving object in the video. |
From the video description and the date of the video, it sounds as though it is using the Unreal Engine 5 VR Template and the RealSense Unreal Engine 5 plugin. VR template RealSense UE5 plugin |
So how to post-process the raw camera data in this bag file. To remove the effect of black noise. |
A script that uses bag file data is almost the same as a script that uses a live camera except that it contains a rs.config.enable_device_from_file instruction to tell the script to use the bag as its data source. This principle is demonstrated in the SDK's Python example read_bag_example.py. So you would use a Python post-processing script and add the enable_device_from_file line to it to post-process bag data. |
First import libraryimport pyrealsense2 as rs Import Numpy for easy array manipulationimport numpy as np Import OpenCV for easy image renderingimport cv2 Import argparse for command-line optionsimport argparse Import os.path for file path manipulationimport os.path Create object for parsing command-line optionsparser = argparse.ArgumentParser(description="Read recorded bag file and display depth stream in jet colormap. Add argument which takes path to a bag file as an inputparser.add_argument("-i", "--input", type=str, default="20240301_101433.bag", help="Path to the bag file, default is '20240301_101433.bag'") Parse the command line arguments to an objectargs = parser.parse_args() try:
finally: This is the code I changed based on the example you gave me, but I got the following error when I ran the ubuntu20.04 terminal. Do you know why that is? |
Is the bag file placed in the same folder as your Python script? Is the bag file able to be played back if you drag and drop it into the center panel of the RealSense Viewer? If it does not play back then it could indicate that the bag file is incomplete or corrupted. |
The package file plays normally in the realsense-viewer. The package file dose not appear to be in the same folder as the python script. I'll try again with your advice. |
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/read_bag_example.py#L42C5-L42C38 |
Can you confirm what you mean when you say 'displacement' please? |
I mean I want to find the object in the video that has changed position. In short, I want to find the moving object and record its depth information. |
2024-09-10.112327.mp4This is a video I recorded with a wall in the background. Was the video shot well? Why do I feel like the video keeps shaking? That is, the depth at the same point is always changing and there's some noise. Is this all normal? |
It does appear as though you have quite a lot of fluctuation in depth values in the same area. Plain walls can be difficult for the camera to read because they lack texture detail. If you are using the RealSense Viewer then increasing the Laser Power setting to its maximum value of '360' may help. This is because it will make the invisible dot-pattern projection cast onto the wall by the camera more visible to the camera and so increase its ability to extract depth information from the surface. You could also go to the Post-Processing section of the Viewer's options side-panel and expand open the settings for the Temporal filter. Changing the Temporal filter's 'Filter Smooth Alpha' option from its default value of '0.4' to the lower '0.1' can significantly reduce depth value fluctuation. |
Thanks, after modifying the Settings according to you tips, the video picture has been improved. |
1 similar comment
Thanks, after modifying the Settings according to you tips, the video picture has been improved. |
Untitled.video.Clipchamp.mp4As you can see in this video. I can capture the red dot in the video and output its coordinates and depth. Now I want to transform this coordinate information from the image coordinate system to the world coordinate system. That is to calculate the true motion of the red dot. |
The instruction rs2_deproject_pixel_to_point would be best in this situation for converting a 2D image pixel to a 3D world point. There is an example of a Python script for doing so at #9749 The script was for the L515 camera model, so you will need to change this line:
to this:
|
In the '2D' mode of the RealSense Viewer, the depth and RGB images are not aligned. Their views will therefore not exactly match each other as the depth sensors and the RGB sensors are in different physical locations on the front of the camera (meaning the RGB image is horizontally offset from the depth image). On the D455 camera model you can obtain an RGB image that is precisely aligned to the depth image. Instead of enabling the RGB stream, you can select the Infrared stream in the Stereo Module section and set its format to RGB8 instead of the default Y8 format. This is 'RGB from left infrared sensor' mode. It is also worth bearing in mind that by default the Viewer has a Decimation filter enabled in the Post-Processing section of the options side-panel that 'downsamples' the selected resolution by half, so 848x480 is downsampled to 424x240 resolution. You can disable this filter to show the depth image in the full 848x480 resolution by left-clicking on the blue icon beside 'Decimation Filter' to turn the icon from blue to black, indicating that it is disabled. |
Is there any way to align the image obtained by enabling RGB streams with the depth image? Instead of select the infrared stream in the Stereo Moudule section and set its format to RGB8. |
How does the image look if you try the SDK's Python example program align_depth2color.py to align the depth and RGB streams? |
Are there any books or websites that can help me further understand OpenCV and realsense camera? |
The two links below are the main official RealSense OpenCV resources. https://dev.intelrealsense.com/docs/opencv-wrapper There are not OpenCV programming books for RealSense available, unfortunately. |
depth_intrin = rs.video_stream_profile(depth_frame.profile).get_intrinsics() |
The conversion of 2D pixel coordinates to 3D world coordinates is described as deprojection. Deprojection takes a 2D pixel location on a stream's images, as well as a depth, specified in meters, and maps it to a 3D point location within the stream's associated 3D coordinate space. It is provided by the RealSense SDK function rs2_deproject_pixel_to_point() |
I would like to know the principle of the function rs2_deproject_pixel_to_point() and whether there is a corresponding formula or specification. Let me understand how it computes and transforms |
Documentation for the rs2_deproject_pixel_to_point() function can be found here: The source code in the RealSense SDK that performs the computation for the function is here:
Here are some examples of its use in pyrealsense2 scripts. https://snyk.io/advisor/python/pyrealsense2/functions/pyrealsense2.rs2_deproject_pixel_to_point |
Hi @junmoxiao11 Do you require further assistance with this case, please? Thanks! |
Yes, I still have a lot of questions to ask. Please do not close this case. |
Okay, it's no problem at all to keep the case open. Thanks very much for letting me know. |
Can I crop a video shot with realsense camera? |
The easiest way to reduce the height and width of a viewpoint is to use a lower resolution. If you would prefer not to reduce the resolution and are going to be using OpenCV then you could try cropping the image with OpenCV code. |
It seems you misunderstood what I said about cropping. |
The video length here refers to the length of time. |
Thanks very much for the clarification. The RealSense Viewer does not have a video cropping feature for the setting of a custom start point. |
Is there any software that can do this? Can process the video shot by the Realsense camera. |
That kind of start-end cropping is usually only found in rosbag file editing tools for ROS, like the one at the link below. |
Hi @junmoxiao11 Do you require further assistance with this case, please? Thanks! |
Case closed due to no further comments received. |
Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):
All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)
Issue Description
When I was shooting with the D455 camera, I noticed a lot of black depth noise on the image. Is there any way to calibrate the camera for noise reduction? I found the code to capture the feature points, but there's a lot of depth noise on the image. This severely affected the use of the algorithm. So I needed to calibrate the camera. See if the results can be a little more accurate.Is there any way I can learn how to use the D455 camera more?
The text was updated successfully, but these errors were encountered: