-
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
Understanding calibration tools in RealSense Viewer for correcting distortion #11596
Comments
Hi @WRWA On-Chip calibration improves depth image quality, whilst focal length calibration provides a solution for cases of focal length imbalance. The tare type of calibration improves depth measurement accuracy. Of these three types of calibration, typically On-Chip will be the type that is most commonly used. A key difference between Dynamic Calibration and On-Chip is that Dynamic Calibration can calibrate both depth and RGB, whilst On-Chip only calibrates depth. So using On-Chip to try to improve the RGB image would not have an effect. The set of Self Calibration tools (On-Chip, Tare, Focal Length) do not require the installation of a separate software package as they are built into the camera firmware driver. On-Chip can also provide a quick and easy snapshot of calibration health by returning a health check score. In regard to removing the distortion model in OpenCV, a RealSense user who tried it reported that it made minimal difference to the image. If you are seeking to correct the color image then the Dynamic Calibration tool would be the appropriate one to use. This tool also provides a robust calibration of the sensors. |
Thank you for your quick response. I have an additional question: what format are the values in for the intrinsic parameters that I can find in the RealSense viewer? I guess they use a different format than the matrix below. can you tell me exactly what each value is? |
The user guide for the Dynamic Calibration tool provides the following information. Intrinsic Focal length - specified as [fx; fy] in pixels for left, right, and RGB cameras Principal point - specified as [px; py] in pixels for left, right, and RGB cameras Distortion - specified as Brown's distortion model [k1; k2; p1; p2; k3] for left, right, and RGB Extrinsic RotationLeftRight - rotation from right camera coordinate system to left camera coordinate system, TranslationLeftRight - translation from right camera coordinate system to left camera coordinate RotationLeftRGB - rotation from RGB camera coordinate system to left camera coordinate system, TranslationLeftRGB - translation from RGB camera coordinate system to left camera coordinate For a D415 the five distortion coefficients will all be set to zero for reasons given at #1430 |
Hi @WRWA Do you require further assistance with this case, please? Thanks! |
Yes, I just want to know what value each element of the 3 by 3 matrix that I can see in the RealSense viewer corresponds to. Intrinsic Focal length - specified as [fx; fy] in pixels for left, right, and RGB cameras |
You can see the values of Focal Length and Principal Point in the Viewer's camera calibration pop-up window by scrolling down using the slider at the side of the pop-up, as they are hidden from view when the window first opens. Focal Length and Principal Point in the pop-up will be equivalent to the same-named settings in the Dynamic Calibration tool. The pop-up does not list the five distortion coefficients but as mentioned above, they will all have a value of zero on a D415. More information about this subject can be found in the RealSense SDK's Projection documentation at the link below. https://dev.intelrealsense.com/docs/projection-in-intel-realsense-sdk-20 The documentation advises that the principal point is the center-point of the camera's projection. The center of projection is not necessarily the center of the image. The focal length is a multiple of pixel width and height, described by fx and fy. The fx and fy fields are allowed to be different (though they are commonly close). |
Thank you for your help, I found the Focal length and Principal Point in the viewer. I still have some questions; I guess my question wasn't clear enough, I wanted to know which elements of the 3by3 matrix of left intrinsics and right intrinsics correspond to which values respectively. As far as I know, the intrinsic matrix is As I mentioned before, I'm trying to correct distortion of the color frame. I used the opencv library to get the undistorted image and compared it to the original color frame and didn't see much difference visually, but I need to see what the difference is in the camera-robot calibration.
So I used the above code to get the new intrinsic matrix and distortion coefficient, and I also got the undistorted image by using
This is the value I got from the camera calibration, is there any way to modify and apply this directly within the RealSense viewer? |
If you have a set of calibration values that you wish to use in the Viewer's Calibration Data window then you can edit them and write them to the camera hardware with the following procedure. This information only relates to depth though and not color.
An alternative approach in Python is to define custom calibration values that are stored in the computer's memory instead of being written to the camera hardware. #4061 provides an example of Python scripting for doing so. A third possibility may be to export a calibration containing depth and RGB information from the 'CustomRW' program that is packaged with the RealSense Dynamic Calibration tool (which calibrates both depth and RGB), edit the XML file's values and then import it back into the calibration tool into CustomRW and write the custom calibration to the camera hardware. The Dynamic Calibration tool can be installed on Linux using instructions on page 14 onwards of the tool's user guide. |
I'll look into it. Thank you for your help! |
hi @MartyG-RealSense m "Hi , can you help me, please? I have a D435 camera and a robot arm. I want to fix the camera in a certain place, not on the robot arm, and then calibrate the camera and robot arm. I'm not sure how to do it. Can you please help me? Thank you! |
Hi @Tranthanhbao198 The calibration tools mentioned above are not related to robot arms. They are used to improve the quality or the accuracy of the camera's images. If you want to calibrate the camera away from the robot arm then it is fine to use these tools. When the camera is mounted on a robot arm, a different type of calibration called hand-eye calibration is typically used. The link below provides some examples of such tools. https://support.intelrealsense.com/hc/en-us/community/posts/360051325334/comments/360013640454 |
hi @MartyG-RealSense ma |
If you will need to calibrate both the depth and RGB then you should use the Dynamic Calibration tool. If you only need to calibrate depth then either Dynamic Calibration or On-Chip will be fine. You may find that On-Chip is easier as it can be done from within the RealSense Viewer tool, so you do not need to install a separate calibration software package because the On-Chip calibration is built into the camera's firmware driver. |
but, I still don't understand. i think, "When the camera detects an object, it captures data about the object, specifically its position matrix in the camera's coordinate system. Calibrating the camera with the robot involves determining the camera's position matrix in the robot's coordinate system. This allows for the multiplication of the two matrices, resulting in the object's position matrix in the robot's coordinate system. Therefore, I'm wondering if the calibration tools for realsense that you mentioned earlier have any impact on these two calibration steps?". please give me and advice. thank you |
Calibration with the Dynamic Calibration or On-Chip tools does not involve robot arms or detecting an object. You print off a target image onto paper and stick it on a wall, or display a digital target image on the screen of an Android mobile device, and point the camera at the target image. |
After going through multiple resources and forums, I had some doubts regarding calibrating the d435 realsense camera.
So my questions are (do correct me if anything I mentioned is incorrect):
|
Hi @jasmeet0915 Thanks very much for your questions.
Your understanding of the above points is correct. On-Chip and Dynamic Calibration have different approaches to calibration and use different target images, but the outcome of the calibration process is similar. As you highlighted, a key difference of the Dynamic Calibration tool is that it can calibrate RGB as well as depth, whilst On-Chip only calibrates depth. Key differences with the On-Chip system are that (1) it provides a health check score that helps you to decide whether to write a calibration to the camera or re-run the calibration process to try to achieve a better score; and (2) On-Chip is built into the camera's firmware driver and so has the advantage of not needing to be installed as a separate program. The On-Chip calibration tool used to offer the choice of calibrating intrinsics or extrinsics up until version 2.49.0 of the RealSense SDK. From 2.50.0 onwards the interface of the On-Chip calibration system was streamlined to make it easier to understand and that choice of intrinsics or extrinsics was removed. So you would need to use SDK or Viewer 2.49.0 and have the appropriate firmware installed in the camera to make use of that feature. There is a special OEM version of the Dynamic Calibration tool that calibrates both intrinsics and extrinsics but it is only available as part of Intel's $1500 USD Calibration Target Board product which is aimed at engineering departments and manufacturing facilities. For most RealSense users, only calibrating the extrinsics is fine for achieving a good calibration as it is the extrinsics that have the most impact on calibration. https://store.intelrealsense.com/buy-intel-realsense-d400-cameras-calibration-target.html When talking about RGB calibration, I am referring to the 'Targeted Rectification Phase' on page 42-47 of the user guide of the Dynamic Calibration tool. The guide does not specify what the precise benefits of RGB calibration are. |
Hi @MartyG-RealSense Thanks for your elaborate answer. |
On D435 the coefficients are all zero, yes. They are zeroed artificially for reasons given at the discussion that you linked to at #1430 (comment) The camera's depth and RGB would have been calibrated in the factory though. However, sensors can become miscalibrated if the camera receives a physical shock such as a hard knock, drop on the floor or severe vibration. A very high temperature surge could also miscalibrate. It can be corrected by performing a recalibration or by resetting the camera to its factory-new default calibration. RealSense calibration tools (On-Chip calibration in the RealSense Viewer or the Dynamic Calibration software package) will calibrate extrinsics, as these have the most impact on the depth image. So resetting to factory-new calibration using the instructions at #10182 (comment) may be the best option if you want to reset the intrinsics. |
Issue Description
I am working on camera-robot calibration for bin picking. I want to correct the distortion of the camera color frame. I know that there are several calibration tools in the RealSense Viewer and Dynamic Calibration tool, but I'm not sure what each one does. I read the documentation, but I still don't understand why there is an on-chip calibration and a focal length calibration. Can you tell me what results the on-chip calibration and the focal length calibration give? Also I tried the on-chip calibration, but the distortion is not corrected enough, so I want to do calibration on my own. Is there a way to perform distortion correction without using the provided calibration tools? I know there are functions in the opencv library for this, but I'm not sure how to do it since it's a stereo camera.
The text was updated successfully, but these errors were encountered: