How can I calibrate D415 or D435 ?
| Required Info | |
|---|---|
| Camera Model | { D400 } |
| Firmware Version | Latest |
| Operating System & Version | {Win (8.1/10) / Linux (Ubuntu 14/16/17) / MacOS |
| Kernel Version (Linux Only) | 4.9.8 |
| Platform | PC/Raspberry Pi/ NVIDIA Jetson / etc.. |
| SDK Version | } |
| Language | {C/C#/labview/nodejs/opencv/pcl/python/unity } |
| Segment | {Robot} |
Issue Description
How are D400 cameras calibrated in factory ? Are they all well taken cared ? I have bought both D415 and D435, but the default calibration seems not as accurate as I want. I decided to calibrate the cameras by myself.
I have read the custom calibration white paper (https://www.intel.com/content/www/us/en/support/articles/000026725/emerging-technologies/intel-realsense-technology.html), It's obviously outdated since I could not find the tool and pattern image it mentioned.
I also downloaded and installed the calibration tools (https://downloadcenter.intel.com/download/27955/Intel-RealSense-D400-Series-Calibration-Tools-and-API), inside it, there's a manual to tell the process. It uses a pretty small calibration pattern that user could use a iphone to display it and use as the calibration board. I really doubt if it could provide good accuracy for the calibration. Or I misunderstood something.
If anybody could point me a right direction to do the custom calibration, It will be hugely appreciated. Thanks!
RealSense cameras are usually well calibrated when purchased. Circumstances in which the camera may need calibrating after purchase include whether the camera experiences a fall to the ground or hard knock during use.
If you want to use the default calibration tool, and do not need to write your own custom calibration app, you should download the file 'CalibrationTool-2.6.4.0-Setup.exe' on the tools download page that you linked to. It is the lower of the two links in the side-panel.
The calibration checker board image was changed around June 2018. You should now use the one that is linked to from the downloads page.
https://www.intel.com/content/dam/support/us/en/documents/emerging-technologies/intel-realsense-technology/print-target-fixed-width.pdf
Intel's professional OEM calibration tool in its online Click store provides insights about how RealSense cameras can be factory-calibrated.
https://click.intel.com/realsense-d400-camera-oem-calibration.html
Thanks!
OEM Calibration tool library/code should be made public. Intel does not have service centers. For these type of problems we need ship it back to distributors. Even after buying product if we cannot calibrate the intrinsic values then there is not point of continuing with this product. Intel cannot except us to spend another $1500 to buy it.
In 99% of cases it is not likely to be necessary to calibrate the intrinsics, as it is the extrinsics that have the most effect on the output image quality.
If calibration does not correct a problem with output image then using the 'gold reset' function of the dynamic calibration API's CustomRW program to reset the camera to factory defaults may help. To activate the Gold Reset, please run this text command in the CustomRW interface:
Intel.Realsense.CustomRW.exe -g
I have previously submitted a suggestion of making the OEM calibrator the standard free version (the source code would not be released) but the decision is not up to me.
Hi thanks everybody,
Can I just confirm @MartyG-RealSense that the "gold reset" will restore the device to the factory calibration settings? Can the "gold reset" be done in the intel realsense viewer?
Can I also confirm that if the camera has taken a bump then the factory settings would not work anymore? (potentially)
Thanks!
Hi @d3-worgan Yes, a "gold reset" should reset the camera to its factory settings. It cannot currently be done in the RealSense Viewer though.
Instead, calibration software called the Dynamic Calibrator should be installed. It contains a program called CustomRW. Launching this program with the command below initiates a Gold Reset of the camera:
Intel.Realsense.CustomRW - g
The Windows version of the Dynamic Calibrator tool can be downloaded from here:
https://downloadcenter.intel.com/download/29618/Intel-RealSense-D400-Series-Dynamic-Calibration-Tool
Instructions for installing the Linux version of the tool are on page 14 onward of the user guide for the tool.
https://www.intel.com/content/www/us/en/support/articles/000026723/emerging-technologies/intel-realsense-technology.html
A bump will not affect the factory calibration data stored in the camera.
Hello everybody ! I am a newby here and thanks for give me the opportunity to ask some questions. I am using a Realsense D435 and I need in priority to calibrate my camera. I already used the Dynamic calibrator tool and the on-chip calibrator (respectively to get extrinsics and intrinsics) with the document at this link : https://www.intel.com/content/www/us/en/download/645988/intel-realsense-d400-series-dynamic-calibration-tool.html
I also have done some calibrations using tutorials for openCV : https://docs.opencv.org/3.4/dc/dbb/tutorial_py_calibration.html However I need to use the CustomCalibration available in this document : https://dev.intelrealsense.com/docs/d400-series-custom-calibration-white-paper. As far as know it is not necessery to use it if I already installed Dynamic calibrator and the on-chip calibrator but I really need it.
I have the Custom Calibration folder inside calibrationtoolAPI according to 7.2 part API Package structure in the firt link. I compiled the example provided for the dynamicCalibrator but I dont know how to compile it and use it to have the same setup for the CustomCalibration here : https://www.intel.com/content/www/us/en/support/articles/000026725/emerging-technologies/intel-realsense-technology.html Another proble is that when I compile, there is not this library : #include "DSDynamicCalibration.h"
I apologize if I make english mistakes, I am from France
Thanks in advance for all the help you could bring me :)
Hi @PierreLouisT Are you using the Windows Custom Calibration API compressed file DynamicCalibrationAPI.zip and have extracted the folder inside the zip file?
If you are and you have been able to extract the DynamicCalibrationAPI folder, is the file 'DSDynamicCalibration.h' located in the Includes sub-directory?

In regard to your other question, could you provide more information please about the 'same setup' that you want to achieve with your compiled custom API example?
Hi @PierreLouisT Are you using the Windows Custom Calibration API compressed file DynamicCalibrationAPI.zip and have extracted the folder inside the zip file?
If you are and you have been able to extract the DynamicCalibrationAPI folder, is the file 'DSDynamicCalibration.h' located in the Includes sub-directory?
In regard to your other question, could you provide more information please about the 'same setup' that you want to achieve with your compiled custom API example?
I want to calibrate my camera using custom calibration and have that :

but I am using linux and not windows so I think it is a good idea to compile the customcalibrator inside the DynamicCalibration tool but I got this error :
I got some library problems as missing library, I saved all of them inside the common folder in examples and it worked.
The only thing I need to know is how to avoid that error.
I checked and all of your documents.h are available inside the dynamicCalibrationAPI.
I hope it is more clear for you, thanks a lot for your help :-)
Page 19 of the custom calibration white paper states that OpenCV 3.3.1 needs to be installed in order to use the calibration example. Have you got this OpenCV version installed, please?

I use 2 D435 camera. They have the same y and z value. They are separate 25 cm, no rotation, like in the second image. But when I build poitcloud it is not good. I have check again the camera parameters, they are at the same of manufacturer values.
I don't know where to ask, so i post here.
Hi @huonggiangdhtn When you have multiple 400 Series cameras generating a pointcloud, their clouds are not automatically stitched together and so if you are aiming for a single large cloud then you have to combine the clouds together.
If you are not stitching the clouds together already, one way to do so is to perform an affine transform to set all of the individual point clouds to the same position and rotation in 3D space. A RealSense SDK instruction that can do this is rs2_transform_point_to_point(). It uses a 3x3 rotation matrix and a 3-component translation vector.
Alternatively, Intel provide a guide for stitching multiple RealSense point clouds together in ROS
https://github.com/IntelRealSense/realsense-ros/wiki/Showcase-of-using-2-cameras
Thank you so much for your reply. I have read and follow the second example. I have write a program like I add below. When I rotate second camera 45 , and I try to adjust the parameter to stick the close object, the far object is separate, and if try to stick far object the close ojbect is separate like in the image.
Please help me what I'm wrong here

`Eigen::Matrix<double,3,3> eulerAnglesToRotationMatrix(double x, double y, double z) { // Calculate rotation about x axis Eigen::Matrix<double,3,3> Rx; Rx << 1, 0, 0, 0, cos(x), -sin(x), 0, sin(x), cos(x) ;
// Calculate rotation about y axis
Eigen::Matrix<double,3,3> Ry;
Ry <<
cos(y), 0, sin(y),
0, 1, 0,
-sin(y), 0, cos(y)
;
// Calculate rotation about z axis
Eigen::Matrix<double,3,3> Rz;
Rz <<
cos(z), -sin(z), 0,
sin(z), cos(z), 0,
0, 0, 1;
// Combined rotation matrix
// Mat Rc = R_z * R_y * R_x; Eigen::Matrix<double,3,3> R; R = Rz * Ry * Rx; return R;
}
int main(int argc, char **argv) { double x = -0.14 , y = 0.0 , z= -0.09; double a = -0.05 , b = 0.29, c= 0.06;
Eigen::Matrix<double,3,3> R3 = eulerAnglesToRotationMatrix(a,b ,c ); Isometry3d T = Isometry3d::Identity(); Eigen::Matrix<double,3,1> t2(x ,y , z); Quaterniond q2 = Quaterniond(R3); Eigen::Isometry3d T2(q2); T2.pretranslate(t2);
cout << "Transform matrix = \n" << T.matrix() << endl;
cout << "Transform matrix = \n" << T2.matrix() << endl;
cv::Mat color1 = cv::imread("/home/giang/slambook/pointcloudtwoimage/rgb/left1649327084528.png",cv::IMREAD_UNCHANGED);
cv::Mat color2 = cv::imread("/home/giang/slambook/pointcloudtwoimage/rgb/right1649327084528.png",cv::IMREAD_UNCHANGED);
cv::Mat depth1 = cv::imread("/home/giang/slambook/pointcloudtwoimage/depth/left1649327084528.png",cv::IMREAD_UNCHANGED);
cv::Mat depth2 = cv::imread("/home/giang/slambook/pointcloudtwoimage/depth/right1649327084528.png",cv::IMREAD_UNCHANGED);
double cx[2];
double cy[2];
double fx[2];
double fy[2];
cx[0] = 318.60302734375;
cy[0] = 239.071395874023;
fx[0] = 385.441162109375;
fy[0] = 385.441162109375;
cx[1] = 322.952789306641;
cy[1] = 238.483856201172;
fx[1] = 386.620269775391;
fy[1] = 386.620269775391;
double depthScale = 1000;
vector<cv::Mat> colorImgs, depthImgs;
vector<Eigen::Isometry3d> poses;
colorImgs.push_back(color1);
colorImgs.push_back(color2);
depthImgs.push_back(depth1);
depthImgs.push_back(depth2);
poses.push_back(T);
poses.push_back(T2);
typedef pcl::PointXYZRGB PointT;
typedef pcl::PointCloud
pcl::visualization::CloudViewer viewer("viewer");
while (1)
{
PointCloud::Ptr pointCloud(new PointCloud);
for (int i = 0; i < 2; i++)
{
PointCloud::Ptr current(new PointCloud);
cv::Mat color = colorImgs[i];
cv::Mat depth = depthImgs[i];
// Eigen::Isometry3d T = poses[i];
for (int v = 0; v < color.rows; v++)
for (int u = 0; u < color.cols; u++)
{
unsigned int d = depth.ptr<unsigned short>(v)[u];
Eigen::Vector3d point;
point[2] = double(d) / depthScale;
if (point[2]== 0 || point[2] >2) continue;
point[0] = (u - cx[i]) * point[2] / fx[i];
point[1] = (v - cy[i]) * point[2] / fy[i];
Eigen::Vector3d pointWorld ;
pointWorld = poses[i] * point;
PointT p;
p.x = pointWorld[0];
p.y = pointWorld[1];
p.z = pointWorld[2];
p.b = color.data[v * color.step + u * color.channels()];
p.g = color.data[v * color.step + u * color.channels() + 1];
p.r = color.data[v * color.step + u * color.channels() + 2];
current->points.push_back(p);
}
// depth filter and statistical removal
PointCloud::Ptr tmp(new PointCloud);
pcl::StatisticalOutlierRemoval<PointT> statistical_filter;
// statistical_filter.setMeanK(50);
// statistical_filter.setStddevMulThresh(1.0);
// statistical_filter.setInputCloud(current);
// statistical_filter.filter(*tmp);
(*pointCloud) += *current;
}
pointCloud->is_dense = false;
// voxel filter
pcl::VoxelGrid<PointT> voxel_filter;
double resolution = 0.005;
voxel_filter.setLeafSize(resolution, resolution, resolution); // resolution
PointCloud::Ptr tmp(new PointCloud);
voxel_filter.setInputCloud(pointCloud);
voxel_filter.filter(*tmp);
tmp->swap(*pointCloud);
viewer.showCloud( tmp );
char key = cv::waitKey(0);
if(key =='s')
pcl::io::savePCDFileBinary("map2.pcd", *pointCloud);
if( key == 'a') //cong a
a = a + 0.01;
if( key == 'q') // tru xa
a = a - 0.01;
if( key == 'b') // cong b
b = b + 0.01;
if( key == 'w') //ttru b
b-= 0.01;
if( key == 'c') //cong c
c+= 0.01;
if( key == 'e') //tru c
c-= 0.01;
if( key == 'x') // cong x
x+= 0.01;
if( key == 'f') // tru x
x-= 0.01;
if( key == 'y') //cong y
y+= 0.01;
if( key == 't') //tru y
y-= 0.01;
if( key == 'z') // cong z
z+= 0.01;
if( key == 'd') // tru z
z-= 0.01;
if( key == 'o')
break;
cout <<"x,y,z: " <<x << " , " << y <<" , " << z <<"\n";
cout <<"a,b,c: " << a <<" , "<< b <<" , "<< c <<"\n";
R3 = eulerAnglesToRotationMatrix(a,b ,c );
t2 = Eigen::Matrix<double,3,1> (x ,y , z);
q2 = Quaterniond(R3);
poses[1] = Eigen::Isometry3d(q2);
poses[1].pretranslate(t2);
}
return 0;
}.`
As you are using PCL and need to stitch the two pointclouds together, an appropriate way to do that may be to use PCL's pointcloud registration via Iterative Closest Point (ICP), as described in the PCL tutorial in the link below.
https://pcl.readthedocs.io/projects/tutorials/en/latest/pairwise_incremental_registration.html
Thank you very much, it is very useful for me. And here is the best result I have. There is still error in this pointcloud. I want to ask this is normally when we combine different camera, or I still do not good my job. Because i don't have much experience on this.

Don't worry, you are doing well. :)
The stitched image above is much better now. There is a clear distortion on the point cloud of one of the cameras though that is making the chessboard look as though the paper is squashed up.

In reality, it may look like that because there is an error that is making part of the chessboard be overlaid on top of the image and the image would likely look correct if that overlay was not present. The overlaid part resembles the piece from your previous stitch attempt.

This makes me think that there may be a problem in the script and not a mis-calibration of that particular camera.
hello ,I'm new learner. I can not find CustomCalibrationTest.exe in my download file.

@MartyG-RealSense
Can I ask some more question? Can I use se PCL's pointcloud registration as a way to find transform matrix? Is it a good way? With the best result when I apply with tree segmentation, I still get error. In this example, i draw it, means there is no error in prediction ^ ^. You see, there is one purple stem but it become two. My rgb image go through a model to get segmentation image . In my app, there is a code to transform from depth image to pointcloud, I think it is good because this code is popular. Can you give me some comments of what way to deal with it, or another way to get better tranform matrix, or I should change the type of camera. I'm very stressed on this for weeks.
