Disclosure of Invention
The invention aims to solve the defects of the fusion technology among multiple sensors in the existing automobile automatic driving technology, and provides a camera calibration method applied to an automatic driving automobile.
A camera calibration method for an autopilot vehicle, the method comprising the steps of:
firstly, setting a calibration plate in front of an automatic driving vehicle, acquiring an image of the calibration plate through a camera, and acquiring image coordinates of four corner points of the image of the calibration plate by using lableme software;
measuring physical coordinates of the corner points of the calibration plate in a vehicle body coordinate system, and calculating a rotation translation matrix from the camera coordinate system to the vehicle body coordinate system by utilizing a pnp algorithm in combination with the image coordinates of the first step;
and thirdly, calculating and extracting three-dimensional data of four corner points of a calibration plate in the laser radar, calculating a rotation translation matrix from the camera to the laser radar by utilizing a pnp algorithm under a laser radar coordinate system, and projecting three-dimensional point cloud data of the laser radar onto a two-dimensional image of the camera by utilizing the rotation translation matrix so as to realize joint calibration of the camera and the laser radar.
The beneficial effects of the invention are as follows:
the camera calibration method applied to the automatic driving automobile has the advantages of being simple in operation and accurate in fusion result between sensors. Specifically, by means of a square plank, the physical coordinates of the four corner points in a car body coordinate system are measured by extracting the image coordinates of the four corner points of the calibration plank, and then the pnp algorithm is used for carrying out coordinate conversion, so that the calibration of the camera is realized.
Detailed Description
The first embodiment is as follows:
the flow of the method is shown in fig. 1, and the method is realized by the following steps:
firstly, setting a calibration plate in front of an automatic driving vehicle in a static state, acquiring an image of the calibration plate through a camera, and acquiring image coordinates of four corner points of the image of the calibration plate by using lableme software;
measuring physical coordinates of the corner points of the calibration plate in a vehicle body coordinate system, and calculating a rotation translation matrix from the camera coordinate system to the vehicle body coordinate system by utilizing a pnp (permanent-n-Point) algorithm in combination with the image coordinates of the first step;
and thirdly, calculating and extracting three-dimensional data of four corner points of a calibration plate in the laser radar, calculating a rotation translation matrix from the camera to the laser radar by utilizing a pnp algorithm under a laser radar coordinate system, and projecting three-dimensional point cloud data of the laser radar onto a two-dimensional image of the camera by utilizing the rotation translation matrix so as to realize joint calibration of the camera and the laser radar.
The second embodiment is as follows:
in a first difference from the specific embodiment, in the camera calibration method for an automatic driving vehicle according to the present embodiment, a calibration board is disposed in front of the automatic driving vehicle in a stationary state, an image of the calibration board is obtained by the camera, and the process of obtaining the image coordinates of four corner points of the image of the calibration board by using lableme software is that,
step 1, acquiring an image of a calibration plate:
setting a calibration plate perpendicular to the optical axis of the camera in front of the camera of the automatic driving automobile, wherein the distance between the calibration plate and the camera is about 8-15 m, starting the camera to drive and photograph, and obtaining an image of the calibration plate;
step one, 2, obtaining image coordinates of corner points in the calibration plate image:
and (3) sequentially and manually marking four corner points of the calibration plate image by using third-party open source software lableme software, storing, and generating a json file corresponding to the image coordinates containing the corner points by the software through the storage operation, so as to obtain the image coordinates of the corner points in the calibration plate image. The invention acquires the image coordinates of the corner points by using the lableme, so that the image coordinates can be ensured to be more accurate. Under the influence of factors such as illumination and weather, if the angular points are automatically identified by directly using an algorithm, errors are increased, and therefore, the image coordinates of the angular points cannot be accurately acquired.
And a third specific embodiment:
unlike the first or second embodiment, in the camera calibration method for an automatic driving vehicle according to the present embodiment, the step two of calculating the rotational translation matrix from the camera coordinate system to the vehicle body coordinate system by using PnP (transparent-n-Point) algorithm is that,
step two, 1, obtaining physical coordinates of corner points:
measuring and calculating physical coordinates of four corner points of the calibration plate under a world coordinate system by using auxiliary tools such as a tape measure, a plumb line, a laser level meter and the like;
step 2, calculating a rotation translation matrix:
after obtaining the image coordinates of the four corner points of the calibration plate and the physical coordinates under the vehicle body coordinate system, calculating a rotation translation matrix from the camera coordinate system to the vehicle body coordinate system through a library function solvePnP of OpenCV; the working principle of the PnP algorithm is that the PnP algorithm is used for estimating the pose of a camera when n three-dimensional space points and two-dimensional projection positions of the three-dimensional space points are known.
Namely, solving a rotation matrix R and a translation matrix t corresponding to the pixel coordinate point and the physical coordinate point by using a PnP algorithm, and completing camera calibration after R and t are obtained.
The specific embodiment IV is as follows:
unlike the third embodiment, in the third embodiment, a camera calibration method applied to an automatic driving automobile is provided, in the third step, the combined calibration process of the camera and the laser radar is that,
analyzing point cloud data of a calibration plate of the laser radar, and acquiring three-dimensional coordinates of corner points of the calibration plate under a laser radar coordinate system;
acquiring image coordinates of four corner points of a calibration plate by using lableme in the first step, then calling library function solvePnP in OpenCV, and transmitting the image coordinates of a corner point camera and the three-dimensional coordinates of a laser radar into the library function solvePnP of the OpenCV to obtain a rotation translation matrix of the rotation translation matrix;
and finally, projecting the three-dimensional point cloud of the laser radar onto the two-dimensional image of the camera by using a rotation translation matrix, taking the rotation translation matrix as an external parameter among the sensors, projecting the three-dimensional point cloud data of the laser radar onto the two-dimensional image of the camera, and completing the joint calibration of the camera and the laser radar, thereby preparing for fusion among multiple sensors.
The rotation and translation matrix from the camera to the laser radar can be calculated by inputting the coordinates of the corner points extracted by the laser radar into a PNP algorithm, and the rotation and translation matrix is used for projecting the point cloud of the laser radar onto the camera image.