lidar_camera_calibration icon indicating copy to clipboard operation
lidar_camera_calibration copied to clipboard

Improve results further

Open poornimajd opened this issue 3 years ago • 8 comments

Hello I tried lidar camera calibration using a checkerboard in different poses,marking 5 points in each pose,for both camera and point_cloud.But I get the following reprojection- Screenshot from 2020-09-30 18-27-47 I also tried with a cardboard with a cutout,so as to get more points in each pose. But the results did not improve much,as shown below: Screenshot from 2020-10-01 19-19-36 Screenshot from 2020-10-01 19-19-51 I have limited the fov of lidar while calibrating,does that have any effect on the results? I was unable to Refine pose estimates using LM because of some error ,which may be due opencv version problem. Is there any other way to improve the results? Any suggestion is appreciated. Thanks

poornimajd avatar Oct 04 '20 09:10 poornimajd

  • What was the total number of correspondences you used for calibration?
  • Place the calibration target in multiple positions such that the target covers all regions and extremes of the image (see the demo video).
  • Ensure that you pick points on the rectified image (the image displayed in the GUI). The launch file rectifies the image using the camera info topic, so make sure that the image is not rectified twice.
  • Most likely the version of OpenCV that your ROS version uses does not have the LM refinement method, you can try to separately refine the pose in Python later (using the saved correspondences and initial results) without using ROS OpenCV. To install OpenCV, pip install opencv-python and remove the source /opt/ros/distro command from your .bashrc, and try it on a new terminal - you should be able to work with a newer version of OpenCV.

heethesh avatar Oct 04 '20 10:10 heethesh

Thanks for the detailed reply!!

* What was the total number of correspondences you used for calibration?

I tried with 5-8 points with different poses such that it covers extremes of the camera image.

  • Ensure that you pick points on the rectified image (the image displayed in the GUI). The launch file rectifies the image using the camera info topic, so make sure that the image is not rectified twice.

  • Most likely the version of OpenCV that your ROS version uses does not have the LM refinement method, you can try to separately refine the pose in Python later (using the saved correspondences and initial results) without using ROS OpenCV

I will check this out.Thanks for the suggestion!

poornimajd avatar Oct 04 '20 10:10 poornimajd

How would you check to make sure the image is not rectified twice? Also, how would you separately refine the pose in Python since I am having almost the same issue with OpenCV and having an older version that does not have the solvePnPRefineLM method.

Bsting118 avatar Oct 19 '20 16:10 Bsting118

@Bsting118

How would you check to make sure the image is not rectified twice?

After you have performed your camera calibration, ROS will auto save this data in ~/.ros/your_camera.yaml and when you playback the camera image topic (eg: /your_camera/image_raw) using rosbag play, ROS will publish this saved calibration on the camera info topic corresponding to the same camera name (eg: /your_camera/camera_info). Take a look at display_camera_calibration.launch and make sure the rectified image here looks exactly same to the image displayed in the GUI to pick 2D points.

Also, how would you separately refine the pose in Python since I am having almost the same issue with OpenCV and having an older version that does not have the solvePnPRefineLM method.

You can simply create a Python virtual env and pip install opencv-python there (no need to worry about the OpenCV C++ version installed on your system). Just load the correspondences which are saved in the calibration folder and use the estimated extrinsics to run the refinement. FYI, the current master checks for the presence of this method and skips the refinement, if not.

heethesh avatar Oct 19 '20 18:10 heethesh

@heethesh When making a python virtual env in my workspace directory/folder, should I be using Python3 or Python? My CV2 seems to be in my Python so would I use Python? Or use Python 3(for python virtual env)?

Bsting118 avatar Oct 19 '20 18:10 Bsting118

Thanks for the detailed reply!!

* What was the total number of correspondences you used for calibration?

I tried with 5-8 points with different poses such that it covers extremes of the camera image.

  • Ensure that you pick points on the rectified image (the image displayed in the GUI). The launch file rectifies the image using the camera info topic, so make sure that the image is not rectified twice.
  • Most likely the version of OpenCV that your ROS version uses does not have the LM refinement method, you can try to separately refine the pose in Python later (using the saved correspondences and initial results) without using ROS OpenCV

I will check this out.Thanks for the suggestion!

Did u solve or figure out the problem? I have same problem as you...

yulan0215 avatar Feb 01 '21 15:02 yulan0215

I took a larger checkerboard and while reprojecting the lidar points make sure that you have changed the parameters of the extrinsic matrix as obtained by your method.

poornimajd avatar Feb 02 '21 07:02 poornimajd

Thanks for the detailed reply!!

* What was the total number of correspondences you used for calibration?

I tried with 5-8 points with different poses such that it covers extremes of the camera image.

  • Ensure that you pick points on the rectified image (the image displayed in the GUI). The launch file rectifies the image using the camera info topic, so make sure that the image is not rectified twice.
  • Most likely the version of OpenCV that your ROS version uses does not have the LM refinement method, you can try to separately refine the pose in Python later (using the saved correspondences and initial results) without using ROS OpenCV

I will check this out.Thanks for the suggestion!

Hello, I have tried multiple poses(10 + ) and picked points using rectified image. But each time I tried, the program return difference result in rotation but approximate value in translation.
I want to know, the more points the program uses, shouldn't the rotation matrix be closer to a fixed value?Why it the rotation matrix become vary?

HRex39 avatar Jul 22 '21 05:07 HRex39