D455 camera matrix
I am using D455 camera, and I need its camera matrix and distortion coefficients for a camera pose estimation algorithm.
I started realsense-viewer, and tried the following.
on-chip calibration: I received a value of -0.05, good
This means, I do not need software based calibration methods to do the camera calibration.
Next, I have been using aligned color and depth streams in my program. I write these down:
rs2::config cfg;
rs2::align align_to(RS2_STREAM_COLOR);
cfg.enable_stream(RS2_STREAM_DEPTH, 848, 480, RS2_FORMAT_Z16, 30); // optimal resolution for depth stream is 848x480
cfg.enable_stream(RS2_STREAM_COLOR, 1280, 720, RS2_FORMAT_BGR8, 30);
The camera matrix is different based on the stream enabled. Is it received using the depth or the color stream resolution. I have been accessing these values using realsense-viewer. Is there another way to access?
thanks,
-
On the realsense-viewer, I choose More --> Calibration Data and then rectified resolution 1280 x 720. These are the values that I obtain:
Focal Length: 659.186. 659.186
Principal Point: 646.592, 353.885
On the other hand, I run the following script:
rs2_intrinsics realSenseWrapper :: print_intrinsic_parameters() {
selection = pipe.start();
auto color_stream = selection.get_stream(RS2_STREAM_COLOR).as<rs2::video_stream_profile>();
auto resolution = std::make_pair(color_stream.width(), color_stream.height());
auto i = color_stream.get_intrinsics();
auto principal_point = std::make_pair(i.ppx, i.ppy);
auto focal_length = std::make_pair(i.fx, i.fy);
rs2_distortion model = i.model;
//print the parameters
cout << "Resolution: " << resolution.first << "," << resolution.second << endl;
cout << "Principle point: " << principal_point.first << "," << principal_point.second << endl;
cout << "Focal length: " << focal_length.first << "," << focal_length.second << endl;
cout << "distortion model: " << model << endl;
// Find first depth sensor (devices can have zero or more then one)
auto sensor = selection.get_device().first<rs2::depth_sensor>();
auto scale = sensor.get_depth_scale();
printf("sensor.depth_scale: %0.5f\n", scale);
auto sensor_data = pipe.wait_for_frames();
rs2::depth_frame dpt_frame = sensor_data.get_depth_frame();
float pixel_distance_in_meters = dpt_frame.get_distance(23,23);
printf("and the distance in meters is: %0.5f\n", pixel_distance_in_meters);
pipe.stop();
return i;
}I receive the following information:
Resolution: 1280,720
Principle point: 652.595,360.33
Focal length: 642.119,641.383
distortion model: Inverse Brown Conrady
sensor.depth_scale: 0.00100Why these two differ, and which one to choose.
thanks,
-
Hi Zahid Iqbal When depth is aligned to color, the color intrinsics should be used. This is because after alignment to color, the depth origin changes from the centerline of the left IR sensor to the centerline of the RGB color sensor.
You can list the intrinsics and extrinsics of a specific camera for each stream type and at different resolutions using the calibration information mode of the rs-enumerate-devices tool. You can access this mode by launching rs-enumerate-devices with the following command:
rs-enumerate-devices -c
-
And, when I run rs-enumerate-device -c, I receive the following data:
Intrinsic of "Color" / 1280x720 / {YUYV/RGB8/BGR8/RGBA8/BGRA8/Y8/Y16}
Width: 1280
Height: 720
PPX: 652.594848632812
PPY: 360.329559326172
Fx: 642.293334960938
Fy: 641.5576171875
Distortion: Inverse Brown Conrady
Coeffs: -0.0570749416947365 0.0687180981040001 -0.000155126384925097 0.00105448020622134 -0.0224851798266172This seems to agree to what I receive from the software based method above. Does this confirm that camera matrix corresponds to an rgb stream? and for a particular chosen resolution?
thanks,
Please sign in to leave a comment.
Comments
3 comments