Coder Social home page Coder Social logo

dogghou / camera-lidar-joint-calibration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aaron20127/camera-lidar-joint-calibration

0.0 0.0 0.0 43.66 MB

A sample way to jointly calibrate camera and lidar

License: MIT License

MATLAB 100.00%

camera-lidar-joint-calibration's Introduction

About

This is a sample method to calibrate camera and lidar jointly. I think this method is suitable for 16, 32, 64 line-lidar. If you want to run this code successfully, please read the discription carefully.

Steps

1. Required software

  • PolyWorks 2019.
  • Matlab 2019a.

2. Procedure

Doawload this code and perform the following steps.

  • Base requirements
  1. All images must be undistorted. This matter is of the utmost importance.
  2. Calibration board requires black and white checkerboard lattice and one side is odd, one side is even.
  3. The short edge of the chessboard should be at the top of the image. The edges of the checkerboard cannot be parallel to the edges of the image. Pose of chessboard in image must look like fisrt row shown below (second row is wrong pose):
  1. The short edge of the chessboard of pointcloud should be at the top of the z-axis direction of lidar. The edges of the checkerboard of pointcloud cannot be parallel to the z-axis of lidar.
  • Data Storage
  1. Put your camera images (.png) into data/images and you have to name it numerically.
  2. Put your lidar data (.txt) into data/pointcloud and each line of the file has only xyz coordinates, for example:
    0.5363237262 -0.3014609218 -0.1039963961
    0.5608119369 -0.3181324303 -0.1093295515
    0.5810572505 -0.3322938681 -0.1137738377
    0.6180613041 -0.3567755520 -0.1217735633
    ...
  1. You can use command below to covert .pcd file to .txt file in linux.
$ pcl_converter -f ascii 1.pcd dst.pcd
$ cat dst.pcd | grep -v [A-Z] | grep -v [a-z] | cut -f 1,2,3 -d ' ' > 1.txt
  • Fit the chessboad to square in the point cloud
  1. open PolyWorks2019 -> tool -> PolyWorks|inspector.

  2. file -> input -> pointcloud, choose .txt file

  3. only choose 'millimeter' and 'Space', click ok.

  4. choose -> unit -> interaction

  5. choose background points, press delete key to delete these points, only save chessboard points.

  6. measure -> feature -> create

  7. choose square

  8. choose fitting

  9. modify parameter

  10. choose max

  11. choose -> unit -> interaction, choose all the points

  12. creation

  13. square -> output

  14. Save '.igs' file to data/chessboard_pointcloud_igs. Note that the prefix name must be a number and its prefix name must match the prefix name of the image in data/images.

  15. Repeat the above steps until all pointcloud of chessboard are fitted.

  • Configuration
  1. Open matlab2019 and change the matlab folder to the root directory Camera-lidar-joint-calibration/.
  2. Open joint_calibration.m file and you need to modify the following options.
    x_grids = 5; % number of grids of short edges of chessboard
    y_grids = 8; % number of grids of long edges of chessboard

    imageType = 'png'; % image format

    % camera parameters
    focalLength    = [2525.9, 2528.1]; % fx, fy
    principalPoint = [942.9102, 584.8342]; % cx, cy
    imageSize = [1080, 1920]; % image size

  • Check the result of image corner detection
  1. If you run this code for the first time, you should check the result of image corner detection carefully. If the corners of some images are not detected successfully, the MinCornerMetric parameter needs to be adjusted . So you should modify the configuration as below.
    MinCornerMetric = 0.4; % Adjusting this parameter can better detect corner points
    onlyShowDetection = 'true';% only show result of image corner detection

  1. Run joint_calibration.m to check the result. Green represents the first detected corner.
  • Joint calibration
  1. If corner detection is successful, you should modify the cofiguration to onlyShowDetection = 'false' to start calibrating jointly.

  2. Reprojection error will be shown in images and the cross symbol represents the reprojection point.

  3. All the pointcloud will be prejected into corresponding image.

  4. Calibration result R and T are in the command window.

  • Notes
  1. The projection formula from point cloud to image looks like this
    Pc = K * R * (Pw - T)
  1. For better results, you shold use at least 20 pairs pointcloud and images. And the calibration board should cover all positions of the images as much as possible.

camera-lidar-joint-calibration's People

Contributors

aaron20127 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.