Point clouds from stereo camera not correct visualized in RVIZ after using ROS stereo calibration

asked 2020-11-17 22:28:12 -0500

Astronaut gravatar image

updated 2020-11-19 02:16:26 -0500

Hi

I have two Grasshopper3 GS3 FLIR Cameras working in Master-Slave mode as a stereo camera. The baseline between them is 50cm. I used the ROS stereo calibration tool to calibrate them. The epipolar error was 0.3pixel. This the outcome of the calibration

Left:
('D = ', [0.02737567282717913, -0.4551047182461572, -0.001137413019162705, -0.0009915982202950845, 0.0])
('K = ', [2296.961069410927, 0.0, 625.398224476376, 0.0, 2308.7971426019503, 501.86694724205375, 0.0, 0.0, 1.0])
('R = ', [0.9936699369376326, -0.009155412185781097, -0.11196532880347168, 0.007244581743852582, 0.999821294676313, -0.017461235555884403, 0.11210518481193325, 0.016539562856674725, 0.9935586899618928])
('P = ', [2553.90373019936, 0.0, 908.1497840881348, 0.0, 0.0, 2553.90373019936, 510.66265869140625, 0.0, 0.0, 0.0, 1.0, 0.0])

Right:
('D = ', [-0.12865514431050615, 0.27039839587223014, 0.00025897954088409614, 0.0027478332323184152, 0.0])
('K = ', [2323.3758802873845, 0.0, 669.4989931082697, 0.0, 2333.0361667939355, 516.0905046926046, 0.0, 0.0, 1.0])
('R = ', [0.9952103941041639, -0.008350812384399213, -0.09739884701348, 0.010010034133704436, 0.9998127795356607, 0.01655913928375224, 0.09724232969071027, -0.0174547933157972, 0.9951076622690764])
('P = ', [2553.90373019936, 0.0, 908.1497840881348, -1215.1659205593778, 0.0, 2553.90373019936, 510.66265869140625, 0.0, 0.0, 0.0, 1.0, 0.0])
('self.T ', [-0.47352832465906813, 0.0039733771083513, 0.046343077929299197])
('self.R ', [0.9998845374012215, 0.0025050295419663574, -0.014987884872093293, -0.0030114986360113027, 0.9994218681475354, -0.03386532658126264, 0.014894386254913267, 0.03390655239749609, 0.999314016194412])
None
# oST version 5.0 parameters


[image]

width
1216

height
960

[narrow_stereo/left]

camera matrix
2296.961069 0.000000 625.398224
0.000000 2308.797143 501.866947
0.000000 0.000000 1.000000

distortion
0.027376 -0.455105 -0.001137 -0.000992 0.000000

rectification
0.993670 -0.009155 -0.111965
0.007245 0.999821 -0.017461
0.112105 0.016540 0.993559

projection
2553.903730 0.000000 908.149784 0.000000
0.000000 2553.903730 510.662659 0.000000
0.000000 0.000000 1.000000 0.000000

# oST version 5.0 parameters


[image]

width
1216

height
960

[narrow_stereo/right]

camera matrix
2323.375880 0.000000 669.498993
0.000000 2333.036167 516.090505
0.000000 0.000000 1.000000

distortion
-0.128655 0.270398 0.000259 0.002748 0.000000

rectification
0.995210 -0.008351 -0.097399
0.010010 0.999813 0.016559
0.097242 -0.017455 0.995108

projection
2553.903730 0.000000 908.149784 -1215.165921
0.000000 2553.903730 510.662659 0.000000
0.000000 0.000000 1.000000 0.000000

Then I got the Q matrix with this code

#include<iostream>
#include<opencv2/calib3d.hpp>
#include<opencv2/opencv.hpp>

int main()
{   
    cv::Size imgsize;

    cv::Mat camMatrix_1 =(cv::Mat_<double>(3,3) << 2296.961069, 0, 625.398224,0, 2308.797143,501.866947, 0, 0, 1);
    cv::Mat camMatrix_2 = (cv::Mat_<double>(3,3) << 2323.375880, 0, 669.498993,0, 2333.036167, 516.090505,0, 0, 1);
    cv::Mat dist_1 = (cv::Mat_<double>(1,5) << 0.027376, -0.455105, -0.001137, -0.000992, 0);
    cv::Mat dist_2 = (cv::Mat_<double>(1,5) << -0.128655, 0.270398, 0.000259, 0.002748 , 0 );
    cv::Mat R = (cv::Mat_<double>(3 ...
(more)
edit retag flag offensive close merge delete

Comments

You may be able to check if the calibration is successful with left/image_rect_color and right/image_rect_color.

miura gravatar image miura  ( 2020-11-18 08:46:39 -0500 )edit

First, you might want to also post one of the camera images so we can tell you if we'd expect the resulting point cloud to be dense. Second, it's worth using dynamic reconfigure to play with stereo_image_proc's parameters -- try a different block matching algorithm.

lindzey gravatar image lindzey  ( 2020-11-18 23:55:22 -0500 )edit

ok I edit the left and right rectified images. How to using dynamic reconfigure?

Astronaut gravatar image Astronaut  ( 2020-11-19 02:07:41 -0500 )edit

@Astronaut$ rosrun rqt_reconfigure rqt_reconfigureref: http://wiki.ros.org/stereo_image_proc...

miura gravatar image miura  ( 2020-11-19 07:16:54 -0500 )edit

Ok. Any other help?When calibrate with ROS the epipolar error was 0.3. Should be ok right?

Astronaut gravatar image Astronaut  ( 2020-11-24 21:40:33 -0500 )edit