WO2023283929A1 - Method and apparatus for calibrating external parameters of binocular camera - Google Patents

Method and apparatus for calibrating external parameters of binocular camera Download PDF

Info

Publication number
WO2023283929A1
WO2023283929A1 PCT/CN2021/106747 CN2021106747W WO2023283929A1 WO 2023283929 A1 WO2023283929 A1 WO 2023283929A1 CN 2021106747 W CN2021106747 W CN 2021106747W WO 2023283929 A1 WO2023283929 A1 WO 2023283929A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
straight lines
reconstructed
binocular camera
error
Prior art date
Application number
PCT/CN2021/106747
Other languages
French (fr)
Chinese (zh)
Inventor
黄海晖
何启盛
张建军
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2021/106747 priority Critical patent/WO2023283929A1/en
Priority to CN202180094173.2A priority patent/CN116917936A/en
Publication of WO2023283929A1 publication Critical patent/WO2023283929A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration

Definitions

  • the present application relates to the field of data processing, in particular to a method and device for calibrating external parameters of a binocular camera.
  • Camera calibration refers to the process of obtaining camera parameters.
  • the camera parameters include internal parameters and external parameters.
  • the internal parameters are the parameters of the camera itself, and the external parameters are parameters related to the installation position of the camera, such as pitch angle, roll angle, and yaw angle.
  • the binocular camera can obtain dense depth information and realize functions such as distance measurement of the target object.
  • functions such as distance measurement of the target object.
  • a small change in the angle in the extrinsic parameters will significantly affect the results of the binocular camera work, for example, affect the distance measurement results. Therefore, the accuracy of extrinsic calibration directly affects the accuracy of binocular camera work results.
  • the external parameter calibration of the binocular camera on the traditional production line usually relies on the target, for example, a checkerboard calibration board or a QR code calibration board.
  • One solution is to adjust the angle of the target through the mechanical arm or manually, so that the binocular camera can acquire images of various angles of the checkerboard calibration board, and complete the calibration of the extrinsic parameters of the binocular camera. This solution is complex, time-consuming and relies on expensive equipment.
  • Another solution is to arrange a large number of targets, the binocular camera is located on the vehicle, and the external parameter calibration is completed during the operation of the vehicle. This solution needs to maintain a large number of targets, and the high-precision calibration of the targets is difficult to achieve.
  • the feature point extraction and matching between binocular cameras can also be used to realize the calibration of extrinsic parameters through the polar constraint relationship.
  • the solution cannot guarantee that the calibration results of each calibration are accurate, that is, it is difficult to guarantee the stability of the calibration results, which will affect the number of beats in the production line.
  • the present application provides a method and device for calibrating external parameters of a binocular camera, which adjusts the extrinsic parameters of the binocular camera through geometric constraints between multiple straight lines in a three-dimensional space, thereby improving the accuracy of calibrating the external parameters of the binocular camera.
  • a method for calibrating extrinsic parameters of a binocular camera comprising: acquiring a first image and a second image, the first image being obtained by shooting a shooting scene with a first camera in the binocular camera, The second image is obtained by shooting the shooting scene with the second camera in the binocular camera; m straight lines are extracted from the first image and the second image respectively, m is an integer greater than 1, the m straight lines of the first image and There is a corresponding relationship between the m straight lines in the second image; based on the external parameters of the binocular camera, n straight lines in the m straight lines in the first image and n straight lines in the m straight lines in the second image are reconstructed to three dimensions In space, n straight lines after reconstruction are obtained, n straight lines in the first image and n straight lines in the second image are projections of n straight lines in the shooting scene, 1 ⁇ n ⁇ m, n is an integer; according to The external parameters of the binocular camera
  • the first image and the second image are two images in the binocular image, that is, two images captured synchronously by two cameras in the binocular camera.
  • the shooting scene includes one or more calibration objects, and the calibration objects refer to the objects photographed by the binocular camera. That is, the first image and the second image include imaging of the calibration object.
  • the calibration object includes a horizontal object or a vertical object and the like.
  • horizontal objects include road markings.
  • vertical objects include rods or pillars and the like.
  • the m straight lines of the first image and the m straight lines of the second image are the projections of the m straight lines in the shooting scene .
  • the projection of the m straight lines in the shooting scene can also be understood as the imaging of the m straight lines in the shooting scene in the binocular camera.
  • m can be the same or different. That is to say, the number of straight lines extracted in different binocular images may be the same or different.
  • n can be the same or different. That is to say, the number of reconstructed straight lines in different binocular images may be the same or different.
  • Obtaining the reconstructed straight lines can also be understood as obtaining the spatial positions of the n reconstructed straight lines.
  • the binocular camera may be a vehicle-mounted camera, and the reconstructed spatial positions of the n straight lines may be represented by the coordinates of the n straight lines in the ego vehicle coordinate system.
  • Adjusting the extrinsic parameters of the binocular camera according to the reconstruction error may be adjusting the extrinsic parameters of the binocular camera according to the reconstruction error of one or more frames of binocular images.
  • the positional relationship between the straight lines in the shooting scene is used as a geometric constraint, according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene
  • Differential adjustment of the external parameters of the binocular camera does not need to precisely locate the position coordinates of the straight line in the shooting scene in three-dimensional space, avoiding the impact of the accuracy of the position coordinates of the straight line in the shooting scene on the calibration result, and improving the external parameters of the binocular camera. Calibration accuracy of the reference.
  • the solution of the embodiment of the present application can further improve the calibration accuracy by adding geometric constraints.
  • the solutions in the embodiments of the present application have strong generalization ability and are applicable to various calibration scenarios.
  • the calibration objects can use common elements on open roads, such as street light poles or road markings, without pre-arranging the calibration scene. For example, there is no need to preset targets, which reduces costs.
  • adjusting the extrinsic parameters of the binocular camera according to the reconstruction error includes: adjusting the extrinsic parameters of the binocular camera according to the sum of the reconstruction errors of multiple frames of binocular images.
  • adjusting the extrinsic parameters of the binocular camera according to the reconstruction error includes: adjusting the extrinsic parameters of the binocular camera according to the average value of the reconstruction errors of multiple frames of binocular images.
  • the external parameters of the binocular camera are adjusted through the accumulation of reconstruction errors of multiple frames of binocular images, which can reduce the impact of line detection errors and improve the performance of the binocular camera.
  • the accuracy of the external reference calibration is important to improve the accuracy of the external reference calibration.
  • the reconstruction error includes at least one of the following: an angle error between the reconstructed n straight lines or a distance error between the reconstructed n straight lines , the angle error between the reconstructed n straight lines is based on the angle between at least two straight lines in the reconstructed n straight lines and the angle between at least two straight lines in the n straight lines in the shooting scene
  • the distance error between the reconstructed n straight lines is determined according to the distance between at least two of the reconstructed n straight lines and at least one of the n straight lines in the shooting scene The difference between the distances between two straight lines is determined.
  • the at least two straight lines in the shooting scene include at least two parallel straight lines.
  • Adjusting the external parameters according to the parallel error and the distance error can ensure the accuracy of the external parameters.
  • the solution of the embodiment of the present application only needs two parallel lines with known distances in the shooting scene to realize the calibration of the extrinsic parameters of the binocular camera, which can reduce the error term in the reconstruction error, thereby reducing the amount of calculation and improving the external parameters.
  • the adjustment speed of the parameters is improved, that is, the calibration efficiency of the external parameters is improved.
  • extracting m straight lines in the first image and the second image respectively includes: performing instance segmentation on the first image and the second image respectively, to obtain The instance of and the instance in the second image; extract m straight lines in the instance in the first image and the instance in the second image respectively, between the m straight lines in the first image and the m straight lines in the second image
  • the correspondence of is determined from the correspondence between instances in the first image and instances in the second image.
  • the correspondence between the straight lines is determined through the correspondence between the instances in the two images, which can improve the accuracy of straight line matching, improve the accuracy of external parameter calibration, reduce computational complexity, and improve The efficiency of external reference calibration is improved.
  • extracting m straight lines from the instance in the first image and the instance in the second image respectively includes: respectively extracting m straight lines in the instance of the first image and the second image Extract a plurality of original straight lines in the first image; fit a plurality of original straight lines of the same-side edge of the instance in the first image to a target straight line of the side edge of the instance in the first image; fit the same-side edge of the instance in the second image Multiple original straight lines on the side edge are fitted to a target straight line on the side edge of the instance in the second image, and the m straight lines belong to the target straight line.
  • the original straight line on the same side of the example is fitted to obtain a more accurate target straight line, and the target straight line is used to calibrate the external parameters of the binocular camera, which is conducive to improving the calibration of the external parameters of the binocular camera the accuracy of the results.
  • instance segmentation is performed on the first image and the second image respectively to obtain instances in the first image and instances in the second image, including: Perform semantic segmentation with the second image respectively to obtain the semantic segmentation result of the first image and the semantic segmentation result of the second image.
  • the semantic segmentation result of the first image includes horizontal objects or vertical objects in the first image
  • the semantic segmentation result of the second image Semantic segmentation results include horizontal objects or vertical objects in the second image; based on the semantic segmentation results of the first image, the first image is instance-segmented to obtain instances in the first image, and based on the semantic segmentation results of the second image, the second image is Instance segmentation is performed on the second image to obtain the instance in the second image.
  • the horizontal objects or vertical objects in the image are distinguished through semantic segmentation, so that the geometric constraints between the horizontal objects or the vertical objects in the shooting scene, such as vertical constraints, can be used to achieve dual Adjustment of the extrinsic parameters of the camera.
  • the binocular camera is a vehicle-mounted camera, road markings or poles are more common on open roads, the calibration objects on the open road can be used to adjust the external parameters of the binocular camera, and there is no need to pre-arrange the calibration site, which reduces costs.
  • the method further includes: controlling the display to display the calibration status of the extrinsic parameters of the binocular camera.
  • the display may be a vehicle-mounted display.
  • the current calibration situation can be displayed in real time, which is beneficial for the user to know the current calibration progress and improves the user experience.
  • the calibration of the extrinsic parameters of the binocular camera includes at least one of the following: the current calibration progress, the current reconstruction error, or the reconstructed p straight lines , the reconstructed p lines are based on the extrinsic parameters of the current binocular camera to reconstruct p lines in the m lines of the first image and p lines in the m lines of the second image into the three-dimensional space Obtained, 1 ⁇ p ⁇ m, p is an integer.
  • the current extrinsic parameters of the binocular camera may be adjusted extrinsic parameters of the binocular camera.
  • the current extrinsic parameters of the binocular camera may be the optimal extrinsic parameters of the binocular camera during the adjustment process.
  • the optimal external parameter of the binocular camera during the adjustment process may be the external parameter that minimizes the reconstruction error during the adjustment process.
  • the calibration result is visualized and the three-dimensional space position of the reconstructed straight line is displayed, which is helpful for the user to intuitively experience the current calibration situation.
  • the current calibration progress includes at least one of the following: current extrinsic parameters of the binocular camera or current calibration completion.
  • the current reconstruction error includes at least one of the following: a current reconstruction error, a current distance error, or a current angle error.
  • a device for calibrating external parameters of a binocular camera comprising: an acquisition unit configured to acquire a first image and a second image, the first image being taken by a pair of first cameras in the binocular camera The scene is shot, and the second image is shot by the second camera in the binocular camera to the shooting scene; the processing unit is used to extract m straight lines in the first image and the second image respectively, and m is greater than 1 Integer, there is a corresponding relationship between the m lines of the first image and the m lines of the second image; based on the external parameters of the binocular camera, the n lines of the m lines of the first image and the m lines of the second image The n straight lines in the straight line are reconstructed into the three-dimensional space, and the reconstructed n straight lines are obtained.
  • n straight lines in the first image and the n straight lines in the second image are the projections of the n straight lines in the shooting scene, 1 ⁇ n ⁇ m, n is an integer; adjust the external parameters of the binocular camera according to the reconstruction error, the reconstruction error is based on the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene definite.
  • the reconstruction error includes at least one of the following: the angle error between the reconstructed n straight lines or the distance error between the reconstructed n straight lines, and the reconstructed n straight lines
  • the angle error between the straight lines is determined according to the difference between the angle between at least two straight lines among the n straight lines after reconstruction and the angle between at least two straight lines among the n straight lines in the shooting scene ;
  • the distance error between the reconstructed n straight lines is based on the distance between at least two straight lines in the reconstructed n straight lines and the distance between at least two straight lines in the n straight lines in the shooting scene The difference between is determined.
  • the at least two straight lines in the shooting scene include at least two parallel straight lines.
  • the processing unit is specifically configured to: respectively perform instance segmentation on the first image and the second image to obtain instances in the first image and instances in the second image; m straight lines are extracted from the instance and the instance in the second image, and the correspondence between the m straight lines in the first image and the m straight lines in the second image is based on the examples in the first image and the m straight lines in the second image The correspondence between instances is determined.
  • the processing unit is specifically configured to: perform semantic segmentation on the first image and the second image respectively, obtain the semantic segmentation result of the first image and the semantic segmentation result of the second image, and obtain the semantic segmentation result of the first image.
  • the segmentation result includes horizontal or vertical objects in the first image
  • the semantic segmentation result of the second image includes horizontal or vertical objects in the second image; instance segmentation is performed on the first image based on the semantic segmentation result of the first image , get the instance in the first image, perform instance segmentation on the second image based on the semantic segmentation result of the second image, and obtain the instance in the second image.
  • the device further includes: a display unit, configured to display the calibration situation of the extrinsic parameters of the binocular camera.
  • the calibration of the external parameters of the binocular camera includes at least one of the following: the current calibration progress, the current reconstruction error situation or the reconstructed p lines, the reconstructed p lines
  • the straight line is obtained by reconstructing p straight lines out of the m straight lines in the first image and p straight lines in the m straight lines in the second image based on the extrinsic parameters of the current binocular camera, 1 ⁇ p ⁇ m and p are integers.
  • the current calibration progress includes at least one of the following: current extrinsic parameters of the binocular camera or current calibration completion.
  • condition of the current reconstruction error includes at least one of the following: a current reconstruction error, a current distance error, or a current angle error.
  • the binocular camera is a vehicle-mounted camera, and the vehicle on which the binocular camera is carried may be in a stationary state or in a moving state.
  • a device for calibrating external parameters of a binocular camera includes a processor, the processor is coupled with a memory, the memory is used to store computer programs or instructions, and the processor is used to execute the computer programs or instructions stored in the memory , so that the method in the first aspect or any implementation manner in the first aspect is executed.
  • the device includes one or more processors.
  • the device may further include a memory coupled to the processor.
  • the device may include one or more memories.
  • the memory can be integrated with the processor, or set separately.
  • the device may also include a data interface.
  • a computer-readable medium stores program code for execution by a device, and the program code includes a program code for executing the above-mentioned first aspect or any implementation manner in the first aspect. method.
  • a computer program product including instructions is provided, and when the computer program product is run on a computer, it causes the computer to execute the method in the above first aspect or any one of the implementation manners of the first aspect.
  • a chip in a sixth aspect, includes a processor and a data interface, and the processor reads instructions stored on the memory through the data interface, and executes any one of the above-mentioned first aspect or the first aspect method in the implementation.
  • the chip may further include a memory, the memory stores instructions, the processor is configured to execute the instructions stored in the memory, and when the instructions are executed, the The processor is configured to execute the method in the foregoing first aspect or any implementation manner of the first aspect.
  • a terminal in a seventh aspect, includes the second aspect and the device in any one implementation manner of the second aspect.
  • the terminal further includes a binocular camera.
  • the terminal may be a vehicle.
  • FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present application
  • FIG. 2 is a schematic flow chart of a calibration method for extrinsic parameters of a binocular camera provided in an embodiment of the present application;
  • Fig. 3 is a schematic diagram of the imaging principle of a binocular camera provided by the embodiment of the present application.
  • FIG. 4 is a schematic flow chart of another calibration method for extrinsic parameters of a binocular camera provided by an embodiment of the present application;
  • Fig. 5 is a schematic diagram of the calibration site provided by the embodiment of the present application.
  • Fig. 6 is a schematic diagram of the semantic segmentation result of the binocular image provided by the embodiment of the present application.
  • Fig. 7 is a schematic diagram of an example tagging result of a binocular image provided by an embodiment of the present application.
  • Fig. 8 is a schematic diagram of a target line in a binocular image provided by an embodiment of the present application.
  • Fig. 9 is a schematic diagram of the spatial position of the reconstructed straight line provided by the embodiment of the present application.
  • Fig. 10 is a schematic diagram of the current calibration situation provided by the embodiment of the present application.
  • Fig. 11 is a schematic diagram of a calibration device for extrinsic parameters of a binocular camera provided by an embodiment of the present application;
  • Fig. 12 is a schematic diagram of another calibration device for extrinsic parameters of a binocular camera provided by an embodiment of the present application.
  • Smart device refers to any kind of equipment, apparatus or machine with computing power.
  • the smart devices in the embodiments of the present application may be robots, autonomous vehicles, intelligent assisted driving vehicles, unmanned aerial vehicles, intelligent assisted aircraft, smart home devices, and the like. This application does not impose any limitation on the smart device. Any device that can be equipped with a binocular camera can be included in the scope of smart devices of this application.
  • the method provided by the embodiment of the present application can be applied to automatic driving, drone navigation, robot navigation, industrial non-contact detection, 3D reconstruction, virtual reality and other scenarios that require binocular camera calibration.
  • the method in the embodiment of the present application can be applied in an automatic driving scenario, and the automatic driving scenario is briefly introduced below.
  • vehicle 110 may be configured in a fully or partially autonomous driving mode.
  • vehicle 110 may control itself while in an autonomous driving mode, and may be human-operated to determine the current state of the vehicle and its surroundings, determine the likely behavior of at least one other vehicle in the surroundings, and determine the A confidence level corresponding to the likelihood of performing the possible action is used to control the vehicle 110 based on the determined information.
  • the vehicle 100 may be set to operate without human interaction.
  • Mobile data center 120 (mobile data center, MDC) is an automatic driving computing platform, which is used to process various sensor data and provide decision support for automatic driving.
  • Vehicle 110 includes a sensor system.
  • the sensor system includes several sensors that sense information about the environment around the vehicle 110 .
  • the sensor system may include a positioning system (the positioning system may be a GPS system, or a Beidou system or other positioning systems), an inertial measurement unit (IMU), a radar, a laser range finder, and a binocular camera.
  • the positioning system may be a GPS system, or a Beidou system or other positioning systems
  • IMU inertial measurement unit
  • radar a laser range finder
  • binocular camera a binocular camera
  • the calibration module 121 is used to determine the external parameters of the sensor.
  • the sensor system includes a binocular camera, and the calibration module 121 is used to determine external parameters of the binocular camera.
  • the calibration module 121 can calibrate the extrinsic parameters of the binocular camera according to the binocular image collected by the binocular camera.
  • the upper layer function module 122 can realize corresponding functions based on the external parameters of the binocular camera.
  • the external parameter calibration results of the binocular camera can be provided to the upper-level business of automatic driving.
  • the ranging function module can determine the distance between the obstacle and the vehicle from the images collected by the binocular camera according to the external parameters of the binocular camera.
  • the obstacle avoidance function module can identify, evaluate and avoid potential obstacles in the environment of the vehicle in other ways according to the external parameters of the binocular camera from the images collected by the binocular camera.
  • the current calibration situation can be displayed through a human machine interface (human machine interface, HMI) 130 on the vehicle.
  • HMI human machine interface
  • HMI 130 may be a vehicle display.
  • accompanying drawing 1 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between devices, devices, modules, etc. shown in the figure does not constitute any limitation, for example, in accompanying drawing 1 , the calibration module 121 and the upper-layer function module 122 are located in the MDC 120 , and in other cases, the calibration module 121 or the upper-layer function module can also be placed in other processors of the vehicle 110 . Alternatively, some of the processes described above are performed by a processor disposed within the vehicle 110 while others are performed by a remote processor.
  • the MDC 120 is located outside the vehicle 110 and can communicate with the vehicle 110 wirelessly. In other cases, the MDC may be located inside the vehicle 110 . HMI 130 may be located inside vehicle 110 .
  • the solution of the embodiment of the present application can be applied to the calibration module 121 .
  • the solution in the embodiment of the present application may be executed by the calibration module 121 .
  • the solution of the embodiment of the present application can realize the calibration of the external parameters of the binocular camera, improve the efficiency of the calibration of the external parameters of the binocular camera, update the calibration value of the external parameters of the binocular camera in the system, and provide high-precision external parameters for the upper-level business. In order to improve the accuracy of upper-level business, and then improve the performance of automatic driving.
  • Camera calibration is also called camera calibration.
  • M represents the transformation matrix between the three-dimensional space point X W and the two-dimensional image point X P , which may be called a projection matrix.
  • Some elements in the projection matrix M represent camera parameters. Camera calibration is to obtain the projection matrix M.
  • Camera parameters include intrinsic and extrinsic parameters.
  • the internal reference is a parameter of the camera itself, for example, a focal length and the like.
  • the external parameters are parameters related to the installation position of the camera, such as pitch angle (pitch), roll angle (roll) and yaw angle (yaw).
  • the conversion matrix corresponding to the internal reference may be called the internal reference conversion matrix, and the conversion matrix corresponding to the external reference may be called the external reference conversion matrix.
  • Camera calibration generally requires a calibration reference object (also called a calibration object or a reference object).
  • the calibration reference object indicates the object captured by the camera during the camera calibration process.
  • the three-dimensional space point X W may be the coordinates of the calibration reference object in the world coordinate system
  • the two-dimensional image point X P may be the two-dimensional coordinates of the calibration reference object on the image plane of the camera.
  • the calibration of camera parameters is a very critical link.
  • the accuracy of the calibration results directly affects the accuracy of the results produced by the camera.
  • a binocular camera can also be called a binocular camera or a binocular sensor.
  • a binocular camera includes two cameras: a left camera and a right camera.
  • the binocular camera can obtain the depth information of the scene, and can reconstruct the three-dimensional shape and position of the surrounding scenery.
  • the purpose of binocular camera calibration is mainly to obtain the internal and external parameters of the left and right cameras.
  • the extrinsic parameters of the left and right cameras refer to the relative positional relationship between the left and right cameras, for example, the translation vector and rotation matrix of the right camera relative to the left camera.
  • the rotation matrix can also be expressed as pitch angle (pitch), roll angle (roll) and yaw angle (yaw).
  • the calibration of the external parameters of the binocular camera is a key link in image measurement or machine vision applications.
  • the accuracy of the calibration results directly affects the accuracy of the results produced by the binocular camera.
  • Embodiments of the present application provide a method and device for calibrating extrinsic parameters of a binocular camera, which can improve the accuracy of calibrating extrinsic parameters of a binocular camera.
  • FIG. 2 shows a schematic diagram of a method 200 for calibrating extrinsic parameters of a binocular camera provided by an embodiment of the present application.
  • the method 200 includes steps S210 to S240.
  • the method 200 can be applied to the calibration of a vehicle-mounted camera, and the method 200 can be executed by a calibration module, which can be located on a vehicle-mounted computer platform.
  • the binocular image in the embodiment of the present application refers to two images captured synchronously by two cameras in a binocular camera.
  • Two images captured simultaneously can also be understood as two images captured at the same moment.
  • two images in a binocular image have the same timestamp.
  • acquiring a binocular image taken by a binocular camera can also be understood as acquiring two images with the same time stamp taken by a binocular camera.
  • Any binocular image in at least one frame of binocular images includes a first image and a second image.
  • the first image is obtained by shooting the shooting scene with the first camera in the binocular camera
  • the second image in the binocular image is obtained by shooting the shooting scene with the second camera in the binocular camera.
  • the shooting scene includes one or more calibration objects, and the calibration objects refer to the objects photographed by the binocular camera. That is, the first image and the second image include imaging of the calibration object.
  • the calibration object includes a horizontal object or a vertical object and the like.
  • horizontal objects include road markings.
  • vertical objects include rods or pillars and the like.
  • the first camera may be a left camera, and the second camera may be a right camera.
  • the first camera may be a right camera, and the second camera may be a left camera, which is not limited in this embodiment of the present application.
  • An image captured by the left camera may also be called a left-eye image, and an image captured by the right camera may also be called a right-eye image.
  • first and “second” in the “first image” and “second image” in the embodiment of the present application are only used to distinguish different images in a frame of binocular images, and do not have other Limitation.
  • the first images in different binocular images are different images, and the second images in different binocular images are different images.
  • At least one frame of binocular images may be obtained from shooting different shooting scenes, or may be obtained from the same shooting scene.
  • the same shooting scene means that the calibration objects in the shooting scenes are the same
  • the different shooting scenes means that the calibration objects in the shooting scenes are different. That is to say, the calibration objects in different binocular images can be the same or different.
  • the binocular camera may be a vehicle-mounted camera, and the at least one frame of binocular images may be multiple frames of binocular images captured while the vehicle is driving on the calibration site.
  • the straight lines in the shooting scene are the straight lines in the three-dimensional space.
  • the imaging of the straight line in the three-dimensional space in the image coordinate system is the straight line in the image.
  • the straight line in the image is the projection of the straight line in the three-dimensional space.
  • the m straight lines of the first image and the m straight lines of the second image are the projections of the m straight lines in the shooting scene .
  • the projection of the m straight lines in the shooting scene can also be understood as the imaging of the m straight lines in the shooting scene in the binocular camera.
  • the multiple straight lines in the shooting scene can be understood as the straight lines in the calibration object in the shooting scene.
  • the multiple straight lines may be straight lines in one calibration object, or may be straight lines in multiple calibration objects.
  • step S220 can be understood as extracting a straight line from each frame of binocular images in the multiple frames of binocular images. In other words, step S220 is performed on the multiple frames of binocular images.
  • m may be the same or different. That is to say, the number of straight lines extracted in different binocular images may be the same or different, which is not limited in this embodiment of the present application.
  • n straight lines in the first image and the n straight lines in the second image are projections of the n straight lines in the shooting scene. 1 ⁇ n ⁇ m, n is an integer.
  • the n straight lines in the first image belong to the m straight lines in the first image.
  • the n lines in the second image belong to the m lines in the second image.
  • Obtaining the reconstructed straight lines can also be understood as obtaining the spatial positions of the n reconstructed straight lines.
  • the binocular camera may be a vehicle-mounted camera, and the reconstructed spatial positions of the n straight lines may be represented by the coordinates of the n straight lines in the ego vehicle coordinate system.
  • the image obtained by shooting the straight line with the camera includes the imaging of the straight line, that is, the straight line in the image.
  • the straight line in the three-dimensional space, the straight line in the image, and the optical center of the camera are on the same plane. If two cameras in the binocular camera shoot a straight line in the three-dimensional space at the same time, the straight line in the three-dimensional space, the straight line in the left-eye image captured by the left camera, and the optical center of the left camera are in plane 1#, and in the three-dimensional space
  • the straight line, the straight line in the right-eye image captured by the right camera, and the optical center of the right camera are in plane 2#.
  • the intersection of plane 1# and plane 2# is the straight line in the three-dimensional space.
  • the left-eye image and the right-eye image include the projection of the same line, based on the internal and external parameters of the binocular camera, we can get The straight line in the left-eye image and the plane where the optical center of the left camera are located, and the plane where the straight line in the right-eye image and the optical center of the right camera are located, the straight line obtained by the intersection of the two planes is the reconstructed straight line.
  • This process is the process of reconstructing the straight lines in the image into three-dimensional space. The more accurate the external reference of the binocular camera is, the closer the spatial position of the reconstructed straight line is to the spatial position of the straight line in three-dimensional space.
  • the n straight lines in the shooting scene include straight line 1# and straight line 2#
  • the projections of straight line 1# and straight line 2# in the first image are respectively straight line 1# in the first image and straight line 2 in the first image #.
  • the projections of straight line 1# and straight line 2# in the second image are respectively called straight line 1# in the second image and straight line 2# in the second image.
  • the reconstructed straight line 1# can be obtained.
  • the straight line 2# in the first image and the straight line 2# in the second image into space the reconstructed straight line 2# can be obtained.
  • step S230 can be understood as reconstructing the straight lines in the multiple frames of binocular images into space based on the external parameters of the binocular cameras to obtain the multi-frame binocular The reconstructed straight line in the target image. In other words, step S230 is performed on the multiple frames of binocular images.
  • n may be the same or different. That is to say, the number of reconstructed straight lines in different binocular images may be the same or different, which is not limited in this embodiment of the present application.
  • the reconstruction error is determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene.
  • Step S240 can be understood as adjusting the extrinsic parameters of the binocular camera with the goal of reducing the reconstruction error, or in other words, with the goal of minimizing the reconstruction error. That is to say, the extrinsic parameters of the binocular camera are used as independent variables to construct the equation of the reconstruction error, and the goal is to obtain the extrinsic parameters of the binocular camera that minimize the reconstruction error.
  • the positional relationship between the straight lines in the shooting scene is used as a geometric constraint, according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene
  • Differential adjustment of the external parameters of the binocular camera does not need to precisely locate the position coordinates of the straight line in the shooting scene in three-dimensional space, avoiding the impact of the accuracy of the position coordinates of the straight line in the shooting scene on the calibration result, and improving the external parameters of the binocular camera. Calibration accuracy of the reference.
  • the solution of the embodiment of the present application can further improve the calibration accuracy by adding geometric constraints.
  • the solutions in the embodiments of the present application have strong generalization ability and are applicable to various calibration scenarios.
  • the calibration objects can use common elements on open roads, such as street light poles or road markings, without pre-arranging the calibration scene. For example, there is no need to preset targets, which reduces costs.
  • Adjusting the extrinsic parameters of the binocular camera according to the reconstruction error may be adjusting the extrinsic parameters of the binocular camera according to the reconstruction error of one or more frames of binocular images.
  • the reconstruction error of a frame of binocular image will be described below.
  • the reconstruction error of the frame of binocular image is used to indicate the difference between the positional relationship between the reconstructed n straight lines and the positional relationship between n straight lines in the shooting scene. difference between.
  • the smaller the reconstruction error the more the positional relationship between the reconstructed n straight lines conforms to the positional relationship between the n straight lines in the shooting scene, and the higher the accuracy of the extrinsic parameters of the current binocular camera.
  • the adjusted extrinsic parameters of the binocular camera may be used as calibration values of the extrinsic parameters of the binocular camera.
  • the external parameters of the binocular camera in step S230 can be updated to the adjusted external parameters of the binocular camera, and steps S230 to S240 are repeated until a binocular camera that meets the preset conditions is obtained.
  • the external parameter of the binocular camera is used as the external parameter calibration value of the binocular camera.
  • the preset condition may be an external parameter whose reconstruction error is less than or equal to an error threshold.
  • the extrinsic parameters of the binocular camera that minimize the reconstruction error may be searched in the pose space of the extrinsic parameters of the binocular camera, and the searched extrinsic parameters may be used as calibration values of the extrinsic parameters of the binocular camera.
  • the extrinsic parameters of the binocular camera can be adjusted in a non-linear optimization manner, and the adjusted extrinsic parameters can be used as calibration values of the extrinsic parameters of the binocular camera.
  • the positional relationship between the n straight lines in the shooting scene can be used as a geometric constraint between the n straight lines.
  • step S240 can be understood as adjusting the extrinsic parameters of the binocular camera so that the reconstructed n straight lines meet the geometric constraints among the n straight lines in the shooting scene as much as possible. In other words, adjust the extrinsic parameters of the binocular camera according to the geometric constraints between n straight lines in the shooting scene.
  • the specific form of the geometric constraint is related to the positional relationship between n straight lines in the shooting scene.
  • the positional relationship between the two straight lines in the shooting scene is two straight lines with an angle of 60 degrees.
  • the geometric constraints satisfied by the two straight lines may include: the intersection of the two straight lines , with an included angle of 60 degrees.
  • the extrinsic parameters of the binocular camera can be adjusted so that the reconstructed two straight lines satisfy the geometric constraint as much as possible.
  • the reconstruction error includes at least one of the following: an angle error between the reconstructed n straight lines or a distance error between the reconstructed n straight lines.
  • the angle error between the reconstructed n straight lines is based on the difference between the angle between at least two straight lines in the reconstructed n straight lines and the angle between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined.
  • the reconstructed at least two straight lines correspond to at least two straight lines in the shooting scene.
  • the angle error between the reconstructed n straight lines is used to constrain the angle between the reconstructed n straight lines. That is, the angular error can be used as an angular constraint.
  • the angle error of the reconstructed two straight lines is determined according to the difference between the angle between the reconstructed two straight lines and the angle between the two straight lines in the shooting scene.
  • the angle between two straight lines in the shooting scene is a.
  • the angle error of the reconstructed two straight lines is the absolute value of the difference between the angle between the reconstructed two straight lines and a.
  • the angle error between the n reconstructed straight lines may be the angle error of the reconstructed two straight lines.
  • two straight lines can be selected from the reconstructed n straight lines, and the reconstruction error of the two straight lines can be used as the angle error between the n reconstructed straight lines.
  • the angle error between the reconstructed n straight lines may be the sum of the angle errors of the reconstructed at least two straight lines, or, The average value of angle errors of at least two straight lines after the reconstruction.
  • 3 or more straight lines can be selected from the reconstructed n straight lines, and the sum of the angular errors between the selected straight lines, or the sum of the angular errors between the selected straight lines
  • the average value is used as the angle error between the reconstructed n straight lines.
  • the at least two reconstructed straight lines include reconstructed straight line 1#, reconstructed straight line 2# and reconstructed straight line 3#.
  • the angle error between the reconstructed straight line 1# and the reconstructed straight line 2# is the angle error 1#
  • the angle error between the reconstructed straight line 1# and the reconstructed straight line 3# is the angle error 2#.
  • the angle error of the reconstructed n straight lines may be the sum of angle error 1# and angle error 2#, or the angle error may be the average value of angle error 1# and angle error 2#.
  • the distance error between the reconstructed n straight lines is based on the distance between at least two straight lines in the reconstructed n straight lines and the distance between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined.
  • the reconstructed at least two straight lines correspond to at least two straight lines in the shooting scene.
  • the at least two straight lines in the shooting scene used when calculating the distance error include at least two parallel straight lines.
  • the at least two straight lines in the shooting scene may be parallel to each other, or the at least two straight lines include multiple groups of parallel straight lines, the multiple straight lines in the same group are parallel to each other, and the straight lines in different groups are not parallel. There is no limit to this.
  • the at least two straight lines used for the distance error between the n straight lines after reconstruction and the at least two straight lines used for the angle error between the n straight lines after reconstruction may be the same or different.
  • the distance error between the reconstructed n straight lines is used to constrain the distance between the reconstructed straight lines. That is, the distance error can be used as a distance constraint.
  • the distance error of the reconstructed two straight lines is determined according to the difference between the distance between the reconstructed two straight lines and the distance between the two straight lines in the shooting scene.
  • the distance between two straight lines in the shooting scene is b
  • the distance error of the reconstructed two straight lines may be determined according to the difference between the distance between the reconstructed two straight lines and b.
  • the distance between the reconstructed two straight lines may be determined according to the distance between one or more points on one of the straight lines and the other straight line.
  • the one or more points can be set as required, for example, the one or more points are determined according to the depth value. For example, select a point on one of the lines at a depth of 0 meters and a point at a depth of 30 meters.
  • the average value of multiple distances between multiple points on one of the reconstructed straight lines and the other straight line is taken as the distance between the reconstructed two straight lines.
  • the distance error between the n reconstructed straight lines may be the distance error of the reconstructed two straight lines.
  • the distance error between the reconstructed n straight lines may be the sum of the distance errors of the reconstructed at least two straight lines, or, The average value of distance errors of at least two straight lines after the reconstruction.
  • the at least two reconstructed straight lines include reconstructed straight line 1#, reconstructed straight line 2# and reconstructed straight line 3#.
  • the distance error between the reconstructed straight line 1# and the reconstructed straight line 2# is the distance error 1#
  • the distance error between the reconstructed straight line 1# and the reconstructed straight line 3# is the distance error 2#.
  • the distance error between the reconstructed n straight lines may be the sum of the distance error 1# and the distance error 2#, or the distance error may be the average value of the distance error 1# and the distance error 2#.
  • the at least two straight lines in the shooting scene include at least two parallel straight lines.
  • angular errors include parallel errors.
  • the reconstruction error includes a parallel error and a distance error.
  • the parallel error is used to constrain the parallel relationship between the reconstructed lines. That is, the parallel error can be used as a parallel constraint.
  • the angle between two parallel straight lines may be zero.
  • the parallel error may be the angle between the reconstructed straight lines.
  • the distance between two parallel straight lines in the shooting scene may be determined through a high-precision map.
  • the distance between two parallel straight lines in the shooting scene can also be measured by other sensors.
  • the method for determining the distance between the straight lines in the shooting scene in the embodiment of the present application is not limited.
  • At least two straight lines in the shooting scene are two parallel straight lines. That is to say, the reconstructed straight line is constrained by the positional relationship between two parallel straight lines in the shooting scene.
  • the reconstruction error may include a parallel error and a distance error between the two reconstructed straight lines.
  • Adjusting the external parameters according to the parallel error and the distance error can ensure the accuracy of the external parameters.
  • the solution of the embodiment of the present application only needs two parallel lines with known distances in the shooting scene to realize the calibration of the extrinsic parameters of the binocular camera, which can reduce the error term in the reconstruction error, thereby reducing the amount of calculation and improving the external parameters.
  • the adjustment speed of the parameters is improved, that is, the calibration efficiency of the external parameters is improved.
  • the at least two straight lines in the shooting scene include at least two mutually perpendicular straight lines.
  • angular errors include vertical errors.
  • the vertical error is used to constrain the vertical relationship between the reconstructed lines. That is, the vertical error can be used as a vertical constraint.
  • the vertical error is used to calculate the difference between the angle between the reconstructed two straight lines and the angle between the two mutually perpendicular straight lines in the shooting scene.
  • the vertical error term between the reconstructed two straight lines can be the difference between the angle between the reconstructed two straight lines and 90 degrees value.
  • step S240 may be to adjust the extrinsic parameters of the binocular camera according to the reconstruction errors of the multi-frame binocular images.
  • step S240 includes: adjusting the extrinsic parameters of the binocular camera according to the sum of reconstruction errors of multiple frames of binocular images.
  • step S240 includes: adjusting the extrinsic parameters of the binocular camera according to the average value of the reconstruction errors of multiple frames of binocular images.
  • step S240 can be understood as, taking the external parameters of the binocular camera as a variable, constructing the equation of the reconstruction error of the multi-frame binocular image, and calculating the binocular camera that minimizes the reconstruction error of the multi-frame binocular image , and use this external parameter as the external parameter calibration value of the binocular camera.
  • the reconstruction error of each frame of binocular images can be calculated according to the description above, and will not be repeated here.
  • the external parameters of the binocular camera are adjusted through the accumulation of reconstruction errors of multiple frames of binocular images, which can reduce the impact of line detection errors and improve the performance of the binocular camera.
  • the accuracy of the external reference calibration is important to improve the accuracy of the external reference calibration.
  • the method 200 further includes: controlling the display to display the calibration situation of the extrinsic parameters of the binocular camera.
  • the display may be a vehicle-mounted display.
  • the on-board display can display the calibration of the external parameters of the binocular camera in real time.
  • the calibration conditions of the extrinsic parameters of the binocular camera include at least one of the following: current calibration progress, current reconstruction error conditions, or reconstructed p straight lines.
  • the reconstructed p straight lines are based on the extrinsic parameters of the current binocular camera to reconstruct the p straight lines in the m straight lines of the first image and the p straight lines in the m straight lines of the second image to the three-dimensional space obtained from. 1 ⁇ p ⁇ m, p is an integer.
  • the p straight lines in the first image and the p straight lines in the second image are matched straight lines. Project the p lines in the first image and the p lines in the second image into three-dimensional space.
  • the current extrinsic parameters of the binocular camera may be adjusted extrinsic parameters of the binocular camera.
  • the current extrinsic parameters of the binocular camera may be the optimal extrinsic parameters of the binocular camera during the adjustment process.
  • the optimal external parameter of the binocular camera during the adjustment process may be the external parameter that minimizes the reconstruction error during the adjustment process.
  • the calibration results are visualized by reconstructing the spatial positions of the straight lines.
  • straight lines reconstructed in the process of visualizing the calibration results and the straight lines reconstructed in the process of adjusting the external parameters can correspond to the same straight line in the shooting scene, or they can correspond to different straight lines in the shooting scene.
  • the embodiment of the application does not limit this.
  • the calibration result is visualized and the three-dimensional space position of the reconstructed straight line is displayed, which is helpful for the user to intuitively experience the current calibration situation.
  • the current calibration progress includes at least one of the following: current extrinsic parameters of the binocular camera or current calibration completion.
  • the extrinsic parameters of the current binocular camera can be expressed in the form of yaw, pitch and roll.
  • the extrinsic parameters of the current binocular camera can be represented in the form of a rotation matrix. This embodiment of the present application does not limit it.
  • the current calibration completion degree can be determined according to the current reconstruction error.
  • the current reconstruction error refers to the value of the reconstruction error corresponding to the extrinsic parameters of the current binocular camera, that is, the value of the reconstruction error obtained based on the extrinsic parameters of the current binocular camera.
  • the current extrinsic parameters of the binocular camera may be the extrinsic parameters of the optimal binocular camera during the adjustment process, and the current reconstruction error is the smallest reconstruction error during the adjustment process.
  • the current calibration completion degree can be determined according to the difference between the current reconstruction error and the error threshold.
  • the current calibration completion degree may be the difference, or a percentage determined according to the difference. That is to say, the smaller the difference between the current reconstruction error and the error threshold, the higher the current calibration completion.
  • the current calibration completion degree can be determined according to the current search times of the external parameters.
  • the extrinsic parameters of the binocular camera that minimize the reconstruction error may be searched in the pose space of the extrinsic parameters of the binocular camera.
  • the current calibration completion degree can be determined according to the current search times and the search times threshold. The closer the current search times are to the search times threshold, the higher the current calibration completion.
  • the current calibration completion degree may be determined according to the number of currently processed binocular image frames.
  • the extrinsic parameters of the binocular camera can be adjusted according to the reconstruction errors of multiple frames of binocular images.
  • the current calibration completion degree can be determined according to the number of frames of currently processed binocular images and the total number of frames of binocular images that need to be processed. The closer the number of frames of currently processed binocular images is to the total number of frames of binocular images that need to be processed, the higher the current calibration completion. For example, if the total number of binocular images to be processed is 50 frames, and 30 frames of the 50 images have been processed, the current calibration completion degree may be 60%.
  • the current calibration completion degree may be the current reconstruction error.
  • the situation of the current reconstruction error may include at least one of the following: a current reconstruction error, a current distance error, or a current angle error.
  • constraints currently used for calibration can be displayed in the context of the current reconstruction error.
  • the reconstruction error is determined according to the angle error and the distance error
  • the current reconstruction error may include the current reconstruction error, the current angle error, and the current distance error.
  • the current reconstruction error is a value determined according to the current angle error and the current distance error.
  • the current calibration progress and the current reconstruction error can quantitatively display the current calibration situation.
  • the current calibration situation can be displayed in real time, which is beneficial for the user to know the current calibration progress and improves the user experience.
  • step S221 projections of multiple straight lines in the shooting scene in the first image and the second image can be acquired.
  • step S221 the corresponding relationship between the straight lines in the shooting scene, the straight lines in the first image, and the straight lines in the second image can be obtained.
  • step S221 includes step S2211 to step S2213 (not shown in the figure).
  • Steps S2211 to S2213 will be described below.
  • only one frame of binocular image is used as an example for illustration in steps S2211 to S2213, and straight lines can also be extracted in the same way in other binocular images, which will not be repeated here.
  • S2211. Perform instance segmentation on the first image and the second image respectively, to obtain instances in the first image and instances in the second image.
  • Instance segmentation is performed on an image to obtain different instances in the image.
  • the instance segmentation of the image can obtain the instance to which the pixel in the image belongs.
  • step S2211 may be implemented through step 11) and step 12).
  • Step 11 performing semantic segmentation on the first image and the second image respectively, to obtain the semantic segmentation result of the first image and the semantic segmentation result of the second image.
  • the semantic segmentation result of the image includes the semantic information corresponding to the pixels in the image.
  • the semantic information corresponding to a pixel can also be understood as the category to which the pixel belongs.
  • each image may be processed through a semantic segmentation network to obtain a semantic segmentation result.
  • the semantic segmentation network can adopt the existing neural network model, for example, deeplabv3 and so on.
  • Semantic segmentation networks can be trained using public datasets. The specific training process is the prior art, and will not be repeated here.
  • the categories output by the semantic segmentation network may include horizontal objects and vertical objects. That is, a semantic segmentation network is able to distinguish whether a pixel in an image is horizontal or vertical.
  • the semantic segmentation result of the first image includes horizontal objects or vertical objects in the first image.
  • the semantic segmentation result of the second image includes horizontal objects or vertical objects in the second image.
  • semantic segmentation is performed on the first image to obtain pixels belonging to horizontal objects and pixels belonging to vertical objects in the first image.
  • Perform semantic segmentation on the second image to obtain pixels belonging to horizontal objects and pixels belonging to vertical objects in the second image.
  • the binocular camera in the embodiment of the present application may be a vehicle-mounted camera.
  • the level may include road markings.
  • the road markings may include solid road markings or dashed road markings.
  • Vertical objects may include rods or columns, among others.
  • poles may include street light poles and the like.
  • the horizontal objects or vertical objects in the image are distinguished through semantic segmentation, so that the geometric constraints between the horizontal objects or the vertical objects in the shooting scene, such as vertical constraints, can be used to achieve dual Adjustment of the extrinsic parameters of the camera.
  • the binocular camera is a vehicle-mounted camera, road markings or poles are more common on open roads, the calibration objects on the open road can be used to adjust the external parameters of the binocular camera, and there is no need to pre-arrange the calibration site, which reduces costs.
  • the semantic information may be set according to the category of the calibration object.
  • the semantic segmentation network can be trained to output other types of semantic information.
  • the semantic segmentation network can also be trained to distinguish between triangular objects or square objects, which is not limited in this embodiment of the present application.
  • Step 12 according to the semantic segmentation result of the first image, the first image is instance-segmented to obtain the instance in the first image; according to the semantic segmentation result of the second image, the second image is instance-segmented to obtain the instance in the second image instance.
  • Instance segmentation of an image according to the result of semantic segmentation refers to distinguishing different individuals among the pixels of the same semantics, that is, distinguishing the instance to which the pixel in the image belongs.
  • An instance represents an individual.
  • the input can be the coordinates of all pixels with the same semantics
  • the output can be the instance to which the pixel belongs.
  • a clustering method can be used to distinguish different individuals in pixels of the same semantics.
  • different individuals can be distinguished by density-based spatial clustering of applications with noise (Dbscan), etc.
  • the two pixels belong to the same instance.
  • the correspondence between the instance in the first image and the instance in the second image may be determined according to the location of the instance in the first image and the location of the instance in the second image.
  • Instances with a corresponding relationship correspond to the same calibration object in the shooting scene.
  • the instances with corresponding relationship in the image are projections of the same calibration object in the shooting scene.
  • the position of the instance in the image may be the absolute position of the instance in the image, for example, the coordinates of the instance in the image.
  • the position of an instance in the image may also be a relative position among multiple instances in the image.
  • the first image and the second image are images taken by the two cameras of the binocular camera for the same shooting scene, and the difference between the two images is relatively small. That is to say, the positions of the projections of the same calibration object in the two images are close. Therefore, the correspondence between instances in two images can be determined by location.
  • instance annotation may be performed on the first image and the second image respectively, to obtain the annotation information of the instance in the first image and the annotation information of the instance in the second image.
  • Instance labeling of images refers to labeling instances in images. Different annotation information in an image is used to indicate different instances in the image.
  • the annotation information may be an instance number. Different instance numbers in an image are used to indicate different instances in the image.
  • instances in the image are labeled according to their locations in the image.
  • instances with the same relative position are labeled with the same instance number.
  • the corresponding relationship between the instance in the first image and the instance in the second image can be indicated by the annotation information of the instance. For example, there is a correspondence between instances with the same instance number in the first image and the second image.
  • the corresponding relationship between the instance in the first image and the instance in the second image can be obtained.
  • matching the instance in the first image with the instance in the second image can be realized by respectively performing instance annotation on the first image and the second image.
  • the correspondence between the instances in the first image and the instances in the second image may be the correspondence between all the instances in the first image and all the instances in the second image, or, the correspondence in the first image The correspondence between the partial instances of and the partial instances in the second image.
  • the correspondence between the m straight lines in the first image and the m straight lines in the second image is determined according to the correspondence between the instances in the first image and the instances in the second image.
  • step S2212 may be implemented through steps 21) to 23).
  • a plurality of original straight lines may be extracted in an instance by using a machine vision method.
  • the original straight line can be extracted in the instance by the hough transform.
  • a small region of interest region of interest, ROI
  • the instance edge pixels in the ROI are projected to a straight line parameter space, and by setting the threshold of the number of points in the parameter space, extract the straight line in the instance, which is the original straight line in the instance.
  • the extracted instance information of the original straight line in the instance is used to indicate the position of the original straight line in the instance, for example, on the left or right side of the instance.
  • the position of the original straight line in the example is related to the setting manner of the ROI, which is not limited in this embodiment of the present application.
  • multiple original straight lines of the same-side edge of the example in the first image are fitted as a target straight line of the side edge of the example in the first image; multiple straight lines of the same-side edge of the example in the second image The original line is fitted to a target line for the side edge of the instance in the second image.
  • Multiple original straight lines may be extracted from one edge of an instance, for example, multiple original straight lines may be extracted from the left side of an instance.
  • multiple original straight lines extracted from one side edge of the instance can be fitted into a straight line, and the fitted straight line is the target of the side edge of the instance straight line.
  • Step 22) is an optional step.
  • an original straight line may also be selected from a plurality of original straight lines extracted from one side edge of the instance as the target straight line of the side edge of the instance.
  • the original straight line can be used as the target straight line of the side edge of the instance.
  • the fitting may be performed in a random sample consensus (RANSAC) manner.
  • RANSAC random sample consensus
  • two points are randomly selected from the boundary points of multiple original straight lines on the same side of an instance, and a straight line is determined according to the two points.
  • the straight line can be expressed by the slope k and the intercept b, for example, the straight line can be represented by is (k,b).
  • a number of midpoints of the plurality of original straight lines lying on the straight line is determined.
  • the number of midpoints of the multiple original straight lines located on the straight line can also be understood as the number of midpoints of the multiple original straight lines that the straight line passes through.
  • the straight line passing through the midpoints of the plurality of original straight lines with the largest number may be used as the target straight line.
  • straight line passing through the midpoints of the plurality of original straight lines with the largest number may also be processed to obtain the target straight line.
  • an intermediate straight line passing through the midpoints of the multiple original straight lines with the largest number is called an intermediate straight line.
  • the center point For example, take the point of each row in the middle straight line as the center point, and determine the point with the largest pixel gradient among the 5 pixels on the left and 5 pixels on the right of the center point in each row, and the pixel gradient in each row
  • the largest pixel point is used as the original point
  • two points are randomly selected from the original points
  • a straight line is determined according to the two points
  • the number of original points passed by the straight line is determined.
  • the straight line with the largest number of original points can be used as the target straight line.
  • the pixel gradient at the boundary is usually large, and searching for the pixel point with the largest pixel gradient is beneficial to find a more accurate boundary and improve the accuracy of line extraction.
  • the extracted instance information of the target straight line of the instance is used to indicate the position of the target straight line in the instance, for example, the target straight line is located on the left or right side of the instance.
  • the corresponding relationship between the target straight line in the first image and the target straight line in the second image is determined.
  • the two straight lines having a corresponding relationship are projections of the same straight line in the shooting scene on the first image and the second image.
  • step S2213 all target straight lines in the first image may be matched with all target straight lines in the second image.
  • part of the target straight line in the first image may also be matched with the target straight line in the second image, which is not limited in this embodiment of the present application.
  • the m straight lines in the first image and the second image are the target straight lines having a corresponding relationship between the first image and the second image.
  • the corresponding relationship between the target straight line in the first image and the target straight line in the second image is determined according to the instance information of the target straight line.
  • the corresponding relationship between the target straight line in the first image and the target straight line in the second image is determined according to the corresponding relationship between the instances in the first image and the second image and the position of the target straight line in the instance.
  • the target straight line with the same position is the straight line with the corresponding relationship between the first image and the second image.
  • instance 1# in the first image corresponds to instance 1# in the second image.
  • the instance information of line a in the first image indicates that line a is located on the left side of instance 1# in the first image
  • the instance information of line 1# in the second image indicates that line b in the second image is located in the second image
  • the straight line a in the first image and the straight line b in the second image are straight lines with a corresponding relationship.
  • steps S2211 to S2213 are only one possible line matching method, and other methods in the prior art can also be used to determine the correspondence between the lines in the two images, which is not limited in the embodiment of the present application .
  • the correspondence between the straight lines is determined through the correspondence between the instances in the two images, which can improve the accuracy of straight line matching, improve the accuracy of external parameter calibration, reduce computational complexity, and improve The efficiency of external reference calibration is improved.
  • the corresponding relationship between the straight lines in the image and the straight lines in the shooting scene can be determined by the relative positions between the straight lines in the shooting scene and the relative positions between the straight lines in the image, which will not be repeated here.
  • FIG. 4 shows another method 400 for calibrating extrinsic parameters of a binocular camera provided by an embodiment of the present application.
  • the method 400 may be regarded as a specific implementation manner of the method 400 . Therefore, for the content not described in detail in the method 400, reference may be made to the method 200 above, and for the sake of brevity, descriptions are appropriately omitted in the following.
  • the method for calibrating the extrinsic parameters of the binocular camera provided in the embodiment of the present application can be applied to the vehicle camera system.
  • the binocular camera in the embodiment of the present application is a vehicle-mounted camera, and the vehicle where the binocular camera is located may be in a stationary state or in a moving state.
  • the method for calibrating the extrinsic parameters of the binocular camera is described by taking the binocular camera as a vehicle-mounted camera as an example, which does not limit the application scenario of the embodiment of the present application.
  • Fig. 5 shows a schematic diagram of a calibration site.
  • the calibration field in Fig. 5 is provided with roadway lines and vertical poles. Street lines or vertical poles can be used as calibration objects for binocular cameras.
  • the method 400 includes step S410 to step S440. Steps S410 to S440 will be described below.
  • At least one frame of binocular images captured by a binocular camera is acquired.
  • the left-eye image in the binocular image is captured by the left camera in the binocular camera
  • the right-eye image in the binocular image is captured by the right camera in the binocular camera.
  • the at least one frame of binocular images may be multiple frames of binocular images captured by the vehicle while driving on the calibration site.
  • the vehicle can acquire multiple frames of binocular images after driving a short distance, and complete the calibration of the extrinsic parameters of the binocular camera.
  • Step S410 corresponds to step S210, and for a specific description, refer to step S210, which will not be repeated here.
  • step S420 includes step S421 to step S425.
  • semantic segmentation is performed on the left-eye image and the right-eye image respectively, and a semantic segmentation result of the left-eye image and a semantic segmentation result of the right-eye image are obtained.
  • the left-eye image and the right-eye image are respectively processed by using the semantic segmentation network to obtain a semantic segmentation result of the left-eye image and a semantic segmentation result of the right-eye image.
  • the output of a semantic segmentation network includes two types of semantics: road lines or vertical objects. That is to say, the semantic segmentation network can distinguish whether the pixel points of objects in the image belong to road lines or vertical objects.
  • Fig. 6(a) shows the semantic segmentation result of the left-eye image
  • Fig. 6(b) shows the semantic segmentation result of the right-eye image.
  • the vertical objects and road lines in the left-eye image and right-eye image are distinguished through semantic segmentation.
  • Step S421 corresponds to step 11) in step S2211.
  • Step S421 corresponds to step 11) in step S2211.
  • instance annotation is performed on the left-eye image according to the semantic segmentation result of the left-eye image, and the annotation information of the instances in the left-eye image is obtained.
  • instance annotation is performed on the right-eye image, and the annotation information of the instance in the right-eye image is obtained.
  • instance segmentation is performed on the first image according to the semantic segmentation result of the first image to obtain the instance in the first image; an instance in the first image is annotated according to the position of the instance in the first image to obtain the annotation of the instance information.
  • the second image is instance-segmented according to the semantic segmentation result of the second image to obtain instances in the second image; the instances in the second image are annotated according to the positions of the instances in the second image to obtain annotation information of the instances.
  • the labeled information of the example includes: left 1 pillar, left 2 pillar, right 1 pillar, right 2 pillar, lane line 1, lane line 2, lane line 3, lane line 4 and lane line 5.
  • the annotation information of instances with corresponding relations in the left-eye image and the right-eye image is the same. That is to say, the annotation information of the instance in the left-eye image and the annotation information of the instance in the right-eye image are used to indicate the correspondence between the instance in the left-eye image and the instance in the right-eye image.
  • step S422 only some instances are marked in step S422 , and more or fewer instances can be marked as required in practical applications.
  • Step S422 corresponds to step 12) in step S2211.
  • Step S422 corresponds to step 12) in step S2211.
  • a plurality of original straight lines are extracted from the instances of the left-eye image and the right-eye image respectively.
  • step S423 straight line extraction may be performed on the instances marked in step S422.
  • line extraction is performed on instances with annotation information.
  • Step S423 corresponds to step 21) in step S2212.
  • Step S423 corresponds to step 21) in step S2212.
  • multiple original straight lines on the same-side edge of the instance in the left-eye image are fitted to a target straight line on the side edge of the instance in the left-eye image.
  • FIG. 8( b ) shows the target straight line in the right-eye image.
  • straight lines on both sides of the example may be extracted, or only straight lines on one side of the example may be extracted, which is not limited in the present application.
  • Step S424 corresponds to step 22) in step S2212, and the specific description may refer to the previous description, which will not be repeated here.
  • m may be 12. That is, the corresponding relationship between the 12 straight lines in (a) in FIG. 8 and the 12 straight lines in (b) in FIG. 8 is obtained.
  • Step S425 corresponds to step S2213, and the specific description may refer to the previous description, which will not be repeated here.
  • n straight lines in the left-eye image and the n straight lines in the right-eye image are projections of the n straight lines in the shooting scene.
  • n is 12 as shown in FIG. 9 .
  • the straight lines in the left-eye image and right-eye image in Figure 8 are reconstructed into space, and the spatial positions of the reconstructed 12 straight lines are obtained.
  • the reconstruction error is determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene.
  • the reconstruction error is determined according to the positional relationship between two straight lines in the reconstructed n straight lines and the positional relationship between two straight lines in the n straight lines in the shooting scene.
  • the reconstruction error includes at least one of the following: angle error or distance error.
  • the reconstruction error will be described below by taking the reconstructed horizontal line l1 and horizontal line l4 as examples.
  • the reconstruction error satisfies the following formula:
  • f i (yaw, pitch, roll) represents the reconstruction error of the i-th binocular image obtained based on the external parameters of the binocular camera
  • yaw, pitch, roll is the Euler angle representation of the external parameters of the binocular camera .
  • the above formula only takes the horizontal line l1 and the horizontal line l4 in the shooting scene as an example to illustrate the reconstruction error, and the reconstruction error can also be calculated according to other parallel lines in the shooting scene, for example, according to the vertical line L1 and Vertical line L5 calculates the reconstruction error.
  • the above formula can also be used for the reconstruction error between other parallel lines, as long as the straight line in the above formula is replaced with the corresponding straight line.
  • the reconstruction error may also be determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines and the positional relationship between the n straight lines in the shooting scene.
  • q is an integer greater than 2 and less than or equal to n.
  • the reconstruction error satisfies the following formula:
  • the first term is used to calculate the angular error between the reconstructed horizontal lines.
  • the angle error between the four reconstructed horizontal lines is equal to the difference between the angle errors between the reconstructed l 2 , l 3 , l 4 and the reconstructed l 1 and.
  • the first item in the above formula is only an example, and the angle error between the reconstructed horizontal lines can also be calculated in other ways, for example, the angle error between the four reconstructed horizontal lines can also be re- The average value of the angle errors between the reconstructed horizontal lines and the reconstructed l 1 .
  • the angle errors between the four reconstructed horizontal lines may also be the sum of the angle errors between the reconstructed horizontal lines and the reconstructed l2 .
  • the present application does not limit the specific calculation method of the angular error between the reconstructed horizontal lines, as long as the angular error between the reconstructed horizontal lines can constrain the parallel relationship between the reconstructed horizontal lines.
  • the second term is used to calculate the angular error between the reconstructed perpendiculars.
  • the angle error between the 8 reconstructed vertical lines is each vertical line, that is, the reconstructed L 2 , L 3 , L 4 , L 5 , L 6 , L 7 and the reconstructed The sum of the angular errors between L and 1 after construction.
  • the second item in the above formula is only an example, and the angle error between the reconstructed vertical lines can also be calculated in other ways, for example, the angle error between the four reconstructed vertical lines can also be is the average value of the angle errors between the reconstructed vertical lines and the reconstructed L1.
  • the angle errors between the four reconstructed vertical lines may also be the sum of the angle errors between the reconstructed vertical lines and the reconstructed L 2 .
  • the present application does not limit the specific calculation method of the angle error between the reconstructed perpendicular lines, as long as the angle error between the reconstructed perpendicular lines can constrain the parallel relationship between the reconstructed perpendicular lines.
  • the third term is used to calculate the angular error between the reconstructed vertical and horizontal lines.
  • the angle error between the reconstructed vertical line and the horizontal line is the angle error between the reconstructed horizontal line l 1 and the reconstructed L 1 .
  • the third item in the above formula is only an example, and the angle error between the reconstructed vertical line and the horizontal line can also be calculated in other ways, for example, the angle error between the reconstructed vertical line and the horizontal line can also be calculated by Can be the angle error between the vertical and horizontal lines after other reconstructions.
  • the angle error between the reconstructed vertical line and the horizontal line may also be the sum of the angle errors between each vertical line and each horizontal line after reconstruction.
  • the reconstructed angle error between the vertical line and the horizontal line may also be an average value of the angle errors between the reconstructed vertical lines and each horizontal line.
  • This application does not limit the specific calculation method of the angle error between the reconstructed vertical line and the horizontal line, as long as the angle error between the reconstructed vertical line and the horizontal line can constrain the angle error between the reconstructed vertical line and the horizontal line vertical relationship.
  • the fourth term is used to calculate the distance error between the reconstructed horizontal lines.
  • the distance error between the reconstructed horizontal lines is the distance error between the reconstructed horizontal line l 1 and the reconstructed l 4 .
  • the fourth item in the above formula is only an example, and the distance error between the reconstructed horizontal lines can also be calculated in other ways, for example, the distance error between the reconstructed horizontal lines can also be other reconstructed.
  • the distance error between the horizontal lines may also be the sum of the distance errors between the reconstructed horizontal lines.
  • the distance error between the reconstructed horizontal lines may also be an average value of the distance errors between the reconstructed horizontal lines.
  • the present application does not limit the specific calculation method of the distance error between the reconstructed horizontal lines, as long as the distance error between the reconstructed horizontal lines can constrain the distance between the reconstructed horizontal lines.
  • the fifth term is used to calculate the distance error between the reconstructed vertical lines.
  • the distance error between the reconstructed vertical lines is the distance error between the reconstructed vertical line L 1 and the reconstructed L 3 .
  • d2 represents the distance between L1 and L3 in the shooting scene.
  • the fifth item in the above formula is only an example, and the distance error between the reconstructed vertical lines can also be calculated in other ways, for example, the distance error between the reconstructed vertical lines can also be calculated by other The distance error between the constructed vertical lines.
  • the distance error between the reconstructed vertical lines may also be the sum of the distance errors between the reconstructed vertical lines.
  • the distance error between the reconstructed vertical lines may also be an average value of the distance errors between the reconstructed vertical lines.
  • the present application does not limit the specific calculation method of the distance error between the reconstructed vertical lines, as long as the distance error between the reconstructed vertical lines can constrain the distance between the reconstructed vertical lines.
  • step S440 the extrinsic parameters of the binocular camera may be adjusted according to the reconstruction error of one or more frames of binocular images.
  • the reconstruction errors of multiple frames of binocular images are accumulated, and the external parameters of the binocular cameras are adjusted according to the accumulated reconstruction errors, which can reduce the influence of the accuracy of straight line extraction on the calibration results and improve Accuracy of calibration results.
  • the extrinsic parameters of the binocular camera are adjusted with the goal of reducing the reconstruction error of multi-frame binocular images.
  • the extrinsic parameters of the binocular camera that minimize the reconstruction error of multiple frames of binocular images are used as the calibration value of the extrinsic parameters of the binocular camera.
  • the minimum reconstruction error of multiple frames of binocular images may be the minimum sum of reconstruction errors of multiple frames of binocular images.
  • the reconstruction error of multi-frame binocular images satisfies the following formula:
  • F(yaw,pitch,roll) represents the reconstruction error of multi-frame binocular images.
  • the smallest reconstruction error of multiple frames of binocular images may also be the smallest average value of reconstruction errors of multiple frames of binocular images.
  • the external parameter of the binocular camera in the system can be updated.
  • other functional modules provided to the automatic driving system.
  • S450 controlling the vehicle-mounted display to display the calibration of the external parameters of the binocular camera.
  • the calibration situation of the extrinsic parameters of the binocular camera includes the current calibration progress, the current reconstruction error situation or the reconstructed p straight lines.
  • FIG. 10 shows a schematic diagram of calibration of extrinsic parameters of a binocular camera.
  • the calibration of the external parameters of the binocular camera includes the current calibration progress, the current reconstruction error, or the 12 reconstructed straight lines.
  • the current calibration progress includes the current calibration completion and the current extrinsic parameters of the binocular camera.
  • the current reconstruction error conditions include the current distance error and the current angle error.
  • four reconstructed straight lines L 1 , L 5 , l 1 , and l 4 are selected during the calibration process to calculate the reconstruction error.
  • the angle error includes : the angle error between L1 and L5 , the angle error between L1 and L4 , and the angle error between L1 and L1 .
  • the distance error includes: the distance error between L 1 and L 5 .
  • the situation of the reconstruction error in FIG. 10 is only an example, and the situation of the current reconstruction error may also include the current reconstruction error, that is, the reconstruction error calculated according to the current distance error and the current angle error, For example, the value of f i (yaw, pitch, roll). Alternatively, other straight lines are also used to calculate the reconstruction error. Alternatively, other angle errors or distance errors may also be used to calculate the reconstruction error, which is not limited in this embodiment of the present application.
  • (a) and (b) of Fig. 10 show two calibration situations.
  • the calibration completion rate is 25%.
  • the reconstruction error is relatively large, and the 12 straight lines obtained based on the current external parameter reconstruction are relatively distorted, which does not conform to the shooting scene in the real world.
  • the calibration completion is 80%, and the reconstruction error at this time is relatively small, and the 12 straight lines reconstructed based on the current extrinsic parameters are more in line with the shooting scene in the real world.
  • the embodiment of the present application may be applicable to dynamic calibration of a camera, and may also be applicable to static calibration of a camera.
  • the camera in the embodiment of the present application is a vehicle-mounted camera, and the vehicle on which the camera is carried is in a moving state.
  • the landmarks can be any type of road features, and are not strictly limited to lane lines.
  • the calibration reference object in the solution provided by the present application may be any of the following lane features: lane lines, signs, pole objects, road signs, and traffic lights.
  • the signboards are, for example, traffic signboards or pole plates, and the pole-like objects are, for example, street light poles.
  • the solution provided in this application can be applied to both dynamic camera calibration and static camera calibration.
  • the embodiment of the present application may use elements in the open road as calibration objects. Therefore, the solution provided by this application has good versatility.
  • the initial calibration value of the external parameters of the binocular camera may be obtained by manual measurement during the object assembly process.
  • the solution of the embodiment of the application can be used to adjust the external parameters of the binocular camera and update the binocular camera in the system.
  • the external parameters of the camera provide high-precision external parameters for the upper-level business to improve the accuracy of the upper-level business, thereby improving the driving performance.
  • FIG. 11 is a device 600 for calibrating extrinsic parameters of a binocular camera provided by an embodiment of the present application.
  • the device 600 includes an acquisition unit 610 and a processing unit 620 .
  • the acquiring unit 610 is configured to acquire a first image and a second image, the first image is captured by the first camera pair in the binocular camera, and the second image is captured by the second camera pair in the binocular camera The scene was shot.
  • the processing unit 620 is configured to extract m straight lines in the first image and the second image respectively, where m is an integer greater than 1, and there is a corresponding relationship between the m straight lines in the first image and the m straight lines in the second image; based on The extrinsic parameters of the binocular camera reconstruct n straight lines in the m straight lines of the first image and n straight lines in the m straight lines of the second image into three-dimensional space, and obtain n straight lines after reconstruction, the first The n straight lines of the image and the n straight lines of the second image are projections of n straight lines in the shooting scene, 1 ⁇ n ⁇ m, n is an integer; adjust the external parameters of the binocular camera according to the reconstruction error, and the reconstruction error is It is determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene.
  • the reconstruction error includes at least one of the following: an angle error between the reconstructed n straight lines or a distance error between the reconstructed n straight lines,
  • the angle error between the reconstructed n straight lines is based on the difference between the angle between at least two straight lines in the reconstructed n straight lines and the angle between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined;
  • the distance error between the reconstructed n straight lines is based on the distance between at least two straight lines in the reconstructed n straight lines and the distance between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined.
  • the at least two straight lines in the shooting scene include at least two parallel straight lines.
  • the processing unit 620 is specifically configured to:
  • the processing unit 620 is specifically configured to:
  • Semantic segmentation is performed on the first image and the second image respectively to obtain a semantic segmentation result of the first image and a semantic segmentation result of the second image
  • the semantic segmentation result of the first image includes horizontal objects or vertical objects in the first image
  • the semantic segmentation result of the second image includes horizontal objects or vertical objects in the second image
  • Instance segmentation is performed on the first image based on the semantic segmentation result of the first image to obtain instances in the first image
  • instance segmentation is performed on the second image based on the semantic segmentation results of the second image to obtain instances in the second image.
  • the device further includes: a display unit, configured to display the calibration situation of the extrinsic parameters of the binocular camera.
  • the calibration of the external parameters of the binocular camera includes at least one of the following: the current calibration progress, the current reconstruction error situation or the reconstructed p lines, the reconstructed p lines
  • the straight line is obtained by reconstructing p straight lines out of the m straight lines in the first image and p straight lines in the m straight lines in the second image based on the extrinsic parameters of the current binocular camera, 1 ⁇ p ⁇ m and p are integers.
  • the current calibration progress includes at least one of the following:
  • the current reconstruction error situation includes at least one of the following:
  • the binocular camera is a vehicle-mounted camera, and the vehicle on which the binocular camera is carried may be in a stationary state or in a moving state.
  • the apparatus 3000 may include at least one processor 3002 and a communication interface 3003 .
  • the apparatus 3000 may further include at least one of a memory 3001 and a bus 3004 .
  • a memory 3001 any two or all three of the memory 3001 , the processor 3002 and the communication interface 3003 can be connected to each other through the bus 3004 .
  • the memory 3001 may be a read only memory (read only memory, ROM), a static storage device, a dynamic storage device or a random access memory (random access memory, RAM).
  • the memory 3001 can store a program.
  • the processor 3002 and the communication interface 3003 are used to execute each step of the method for calibrating the external parameters of the binocular camera according to the embodiment of the present application. That is to say, the processor 3002 can acquire stored instructions from the memory 3001 through the communication interface 3003, so as to execute each step of the method for calibrating the external parameters of the binocular camera according to the embodiment of the present application.
  • the memory 3001 may implement the above function of storing programs.
  • the processor 3002 may adopt a general-purpose CPU, a microprocessor, an ASIC, a graphics processing unit (graphic processing unit, GPU) or one or more integrated circuits for executing related programs, so as to implement the embodiments of the present application.
  • the processor 3002 may implement the above-mentioned function of executing related programs.
  • the processor 3002 may also be an integrated circuit chip, which has a signal processing capability.
  • each step of the control method in the embodiment of the present application may be completed by an integrated logic circuit of hardware in a processor or instructions in the form of software.
  • the above-mentioned processor 3002 can also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit (ASIC), a ready-made programmable gate array (field programmable gate array, FPGA) or other available Program logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processing
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • Program logic devices discrete gate or transistor logic devices, discrete hardware components.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and combines its hardware to complete the functions required by the units included in the calibration device of the embodiment of the application, or perform the external parameter calibration of the binocular camera in the embodiment of the application steps of the method.
  • the communication interface 3003 can use a transceiver device such as but not limited to a transceiver to implement communication between the device and other devices or communication networks, for example, the communication interface 3003 can be used to acquire binocular images.
  • the communication interface 3003 may also be an interface circuit, for example.
  • Bus 3004 may include pathways for transferring information between various components of the device (eg, memory, processor, communication interface).
  • the embodiments of the present application also provide a computer program product including instructions, which, when executed by a computer, enable the computer to implement the methods in the above method embodiments.
  • An embodiment of the present application also provides a terminal, which includes any of the above-mentioned calibration devices, such as the device shown in FIG. 11 or FIG. 12 .
  • the terminal may be a vehicle, a drone, or a robot.
  • the above-mentioned calibration device can be installed on the terminal or be independent from the terminal.
  • An embodiment of the present application further provides a computer-readable medium, where the computer-readable medium stores program code for execution by a device, where the program code includes the method for executing the above-mentioned embodiments.
  • the embodiment of the present application also provides a computer program product containing instructions, and when the computer program product is run on a computer, the computer is made to execute the method of the above embodiment.
  • the embodiment of the present application also provides a chip, the chip includes a processor and a data interface, and the processor reads the instructions stored in the memory through the data interface, and executes the method of the above embodiment.
  • the chip may further include a memory, in which instructions are stored, and the processor is configured to execute the instructions stored in the memory, and when the instructions are executed, the processor is configured to execute the method in the foregoing embodiments.
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disc and other media that can store program codes. .

Abstract

The present application relates to the field of artificial intelligence, and particularly relates to the field of autonomous driving; provided are a method and an apparatus for calibrating the external parameters of a binocular camera, the method comprising: acquiring a binocular image photographed by a binocular camera; respectively extracting m straight lines from a first image and a second image of the binocular image; on the basis of the external parameters of the binocular camera, reconstructing a plurality of straight lines that match in the first image and the second image in a three-dimensional space to obtain reconstructed straight lines, wherein the plurality of straight lines that match in the binocular image are projections of a plurality of straight lines in the photographed scene; and, on the basis of a reconstruction error, adjusting the external parameters of the binocular camera, wherein the reconstruction error is determined on the basis of the positional relationship between the reconstructed straight lines and the positional relationship between the straight lines in the photographed scene. In the solution of the present application, the external parameters of the binocular camera are adjusted by means of the geometric constraints between multiple straight lines in a three-dimensional space, increasing the precision of calibrating the external parameters of a binocular camera.

Description

双目相机外参标定的方法及装置Method and device for extrinsic calibration of binocular camera 技术领域technical field
本申请涉及数据处理领域,具体涉及一种双目相机外参标定的方法及装置。The present application relates to the field of data processing, in particular to a method and device for calibrating external parameters of a binocular camera.
背景技术Background technique
相机标定表示获取相机参数的过程。相机参数包括内参与外参,内参为相机自身的参数,外参为相机的安装位置相关的参数,例如俯仰角、翻滚角与偏航角等。Camera calibration refers to the process of obtaining camera parameters. The camera parameters include internal parameters and external parameters. The internal parameters are the parameters of the camera itself, and the external parameters are parameters related to the installation position of the camera, such as pitch angle, roll angle, and yaw angle.
双目相机能够获取稠密深度信息,实现目标物的测距等功能。但是由于双目基线长度较小,外参中的角度的微小的变化会显著影响双目相机工作的结果,例如,影响测距结果。因此,外参标定的精度直接影响双目相机工作结果的准确性。The binocular camera can obtain dense depth information and realize functions such as distance measurement of the target object. However, due to the small length of the binocular baseline, a small change in the angle in the extrinsic parameters will significantly affect the results of the binocular camera work, for example, affect the distance measurement results. Therefore, the accuracy of extrinsic calibration directly affects the accuracy of binocular camera work results.
传统产线上双目相机的外参标定通常依赖靶标,例如,棋盘格标定板或者二维码标定板。一种方案是通过机械臂或者人工调整靶标的角度,使双目相机获取棋盘格标定板的各种角度的图像,完成双目相机的外参的标定。该方案操作复杂耗时,且依赖于昂贵的设备。另一种方案是布置大量靶标,双目相机位于车辆上,在车辆运行过程中完成外参标定。该方案需要维护大量靶标,靶标的高精度校准较难实现。The external parameter calibration of the binocular camera on the traditional production line usually relies on the target, for example, a checkerboard calibration board or a QR code calibration board. One solution is to adjust the angle of the target through the mechanical arm or manually, so that the binocular camera can acquire images of various angles of the checkerboard calibration board, and complete the calibration of the extrinsic parameters of the binocular camera. This solution is complex, time-consuming and relies on expensive equipment. Another solution is to arrange a large number of targets, the binocular camera is located on the vehicle, and the external parameter calibration is completed during the operation of the vehicle. This solution needs to maintain a large number of targets, and the high-precision calibration of the targets is difficult to achieve.
此外,现有方案中还可以利用双目相机之间的特征点提取和匹配,通过对极约束关系实现外参的标定。但在环境中特征点较少或者特征点不稳定可控的情况下,该方案难以保证标定结果的准确性。例如,工厂内环境不受控的情况下,该方案无法保证每次标定的结果均为准确的标定结果,即难以保证标定结果的稳定性,影响产线节拍数。In addition, in the existing scheme, the feature point extraction and matching between binocular cameras can also be used to realize the calibration of extrinsic parameters through the polar constraint relationship. However, when there are few feature points in the environment or the feature points are unstable and controllable, it is difficult for this scheme to guarantee the accuracy of the calibration results. For example, when the environment in the factory is not controlled, the solution cannot guarantee that the calibration results of each calibration are accurate, that is, it is difficult to guarantee the stability of the calibration results, which will affect the number of beats in the production line.
因此,如何提高双目相机外参标定的精度成为一个亟待解决的问题。Therefore, how to improve the accuracy of extrinsic calibration of binocular cameras has become an urgent problem to be solved.
发明内容Contents of the invention
本申请提供一种双目相机外参标定的方法及装置,通过三维空间中的多条直线之间的几何约束调整双目相机的外参,提高双目相机外参标定的精度。The present application provides a method and device for calibrating external parameters of a binocular camera, which adjusts the extrinsic parameters of the binocular camera through geometric constraints between multiple straight lines in a three-dimensional space, thereby improving the accuracy of calibrating the external parameters of the binocular camera.
第一方面,提供了一种双目相机外参标定的方法,该方法包括:获取第一图像和第二图像,第一图像是由双目相机中的第一摄像头对拍摄场景拍摄得到的,第二图像是由双目相机中的第二摄像头对拍摄场景拍摄得到的;分别在第一图像和第二图像中提取m条直线,m为大于1的整数,第一图像的m条直线和第二图像的m条直线之间具有对应关系;基于双目相机的外参将第一图像的m条直线中的n条直线和第二图像的m条直线中的n条直线重构到三维空间中,得到重构后的n条直线,第一图像的n条直线和第二图像的n条直线为拍摄场景中的n条直线的投影,1<n≤m,n为整数;根据重构误差调整双目相机的外参,重构误差是根据重构后的n条直线之间的位置关系和拍摄场景中的n条直线之间的位置关系确定的。In a first aspect, a method for calibrating extrinsic parameters of a binocular camera is provided, the method comprising: acquiring a first image and a second image, the first image being obtained by shooting a shooting scene with a first camera in the binocular camera, The second image is obtained by shooting the shooting scene with the second camera in the binocular camera; m straight lines are extracted from the first image and the second image respectively, m is an integer greater than 1, the m straight lines of the first image and There is a corresponding relationship between the m straight lines in the second image; based on the external parameters of the binocular camera, n straight lines in the m straight lines in the first image and n straight lines in the m straight lines in the second image are reconstructed to three dimensions In space, n straight lines after reconstruction are obtained, n straight lines in the first image and n straight lines in the second image are projections of n straight lines in the shooting scene, 1<n≤m, n is an integer; according to The external parameters of the binocular camera are adjusted according to the reconstruction error, and the reconstruction error is determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene.
第一图像和第二图像为双目图像中的两张图像,即双目相机中的两个摄像头同步拍摄到的两张图像。The first image and the second image are two images in the binocular image, that is, two images captured synchronously by two cameras in the binocular camera.
拍摄场景中包括一个或多个标定物,标定物指的是双目相机拍摄的对象。也就是说,第一图像和第二图像包括对该标定物的成像。The shooting scene includes one or more calibration objects, and the calibration objects refer to the objects photographed by the binocular camera. That is, the first image and the second image include imaging of the calibration object.
示例性地,标定物包括水平物或竖直物等。Exemplarily, the calibration object includes a horizontal object or a vertical object and the like.
例如,水平物包括行道线。For example, horizontal objects include road markings.
例如,竖直物包括杆状物或柱状物等。For example, vertical objects include rods or pillars and the like.
第一图像的m条直线和第二图像的m条直线之间具有对应关系,指的是,第一图像的m条直线和第二图像的m条直线是拍摄场景中的m条直线的投影。拍摄场景中的m条直线的投影,也可以理解为,拍摄场景中的m条直线在双目相机中的成像。There is a corresponding relationship between the m straight lines of the first image and the m straight lines of the second image, which means that the m straight lines of the first image and the m straight lines of the second image are the projections of the m straight lines in the shooting scene . The projection of the m straight lines in the shooting scene can also be understood as the imaging of the m straight lines in the shooting scene in the binocular camera.
对于不同的双目图像,m可以相同,也可以不同。也就是说,在不同双目图像中提取的直线的数量可以相同,也可以不同。For different binocular images, m can be the same or different. That is to say, the number of straight lines extracted in different binocular images may be the same or different.
对于不同的双目图像,n可以相同,也可以不同。也就是说,在不同双目图像中被重构的直线的数量可以相同,也可以不同。For different binocular images, n can be the same or different. That is to say, the number of reconstructed straight lines in different binocular images may be the same or different.
得到重构后的直线也可以理解为得到重构后的n条直线的空间位置。示例性地,双目相机可以为车载摄像头,重构后的n条直线的空间位置可以由自车坐标系中的n条直线的坐标表示。Obtaining the reconstructed straight lines can also be understood as obtaining the spatial positions of the n reconstructed straight lines. Exemplarily, the binocular camera may be a vehicle-mounted camera, and the reconstructed spatial positions of the n straight lines may be represented by the coordinates of the n straight lines in the ego vehicle coordinate system.
根据重构误差调整双目相机的外参可以为根据一帧或多帧双目图像的重构误差调整双目相机的外参。Adjusting the extrinsic parameters of the binocular camera according to the reconstruction error may be adjusting the extrinsic parameters of the binocular camera according to the reconstruction error of one or more frames of binocular images.
本申请实施例中,将拍摄场景中的直线之间的位置关系作为几何约束,根据重构后的n条直线之间的位置关系与拍摄场景中的n条直线之间的位置关系之间的差异调整双目相机的外参,无需精确定位拍摄场景中的直线在三维空间中的位置坐标,避免拍摄场景中的直线的位置坐标的准确度对标定结果产生影响,提高了双目相机的外参的标定精度。In the embodiment of the present application, the positional relationship between the straight lines in the shooting scene is used as a geometric constraint, according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene Differential adjustment of the external parameters of the binocular camera does not need to precisely locate the position coordinates of the straight line in the shooting scene in three-dimensional space, avoiding the impact of the accuracy of the position coordinates of the straight line in the shooting scene on the calibration result, and improving the external parameters of the binocular camera. Calibration accuracy of the reference.
而且,本申请实施例的方案中,最少仅需要拍摄场景中的两条直线的位置关系即可完成标定,减少了计算量,提高了标定的效率。Moreover, in the solution of the embodiment of the present application, at least only the positional relationship of two straight lines in the scene needs to be photographed to complete the calibration, which reduces the amount of calculation and improves the efficiency of calibration.
此外,本申请实施例的方案可以通过增加几何约束,进一步提高标定精度。In addition, the solution of the embodiment of the present application can further improve the calibration accuracy by adding geometric constraints.
此外,本申请实施例的方案的泛化能力强,适用于多种标定场景。以车载双目相机为例,标定物可以采用开放道路中的常见元素,例如,路灯杆或行道线等,无需对标定场景预先布置,例如,无需预设靶标,降低了成本。In addition, the solutions in the embodiments of the present application have strong generalization ability and are applicable to various calibration scenarios. Taking the vehicle-mounted binocular camera as an example, the calibration objects can use common elements on open roads, such as street light poles or road markings, without pre-arranging the calibration scene. For example, there is no need to preset targets, which reduces costs.
结合第一方面,在第一方面的某些实现方式中,根据重构误差调整双目相机的外参,包括:根据多帧双目图像的重构误差之和调整双目相机的外参。With reference to the first aspect, in some implementation manners of the first aspect, adjusting the extrinsic parameters of the binocular camera according to the reconstruction error includes: adjusting the extrinsic parameters of the binocular camera according to the sum of the reconstruction errors of multiple frames of binocular images.
或者,根据重构误差调整双目相机的外参,包括:根据多帧双目图像的重构误差的平均值调整双目相机的外参。Alternatively, adjusting the extrinsic parameters of the binocular camera according to the reconstruction error includes: adjusting the extrinsic parameters of the binocular camera according to the average value of the reconstruction errors of multiple frames of binocular images.
由于直线检测可能存在一定的误差,本申请实施例中通过多帧双目图像的重构误差累积的结果调整双目相机的外参,能够减少直线检测的误差带来的影响,提高双目相机的外参标定的准确性。Since there may be certain errors in line detection, in the embodiment of the present application, the external parameters of the binocular camera are adjusted through the accumulation of reconstruction errors of multiple frames of binocular images, which can reduce the impact of line detection errors and improve the performance of the binocular camera. The accuracy of the external reference calibration.
结合第一方面,在第一方面的某些实现方式中,重构误差包括以下至少一项:重构后的n条直线之间的角度误差或重构后的n条直线之间的距离误差,重构后的n条直线之间的角度误差是根据重构后的n条直线中的至少两条直线之间的角度与拍摄场景中的n条直线中的至少两条直线之间的角度之间的差值确定的;重构后的n条直线之间的距离误差是根据重构后的n条直线中的至少两条直线之间的距离与拍摄场景中的n条直线中的至少两 条直线之间的距离之间的差值确定的。With reference to the first aspect, in some implementations of the first aspect, the reconstruction error includes at least one of the following: an angle error between the reconstructed n straight lines or a distance error between the reconstructed n straight lines , the angle error between the reconstructed n straight lines is based on the angle between at least two straight lines in the reconstructed n straight lines and the angle between at least two straight lines in the n straight lines in the shooting scene The distance error between the reconstructed n straight lines is determined according to the distance between at least two of the reconstructed n straight lines and at least one of the n straight lines in the shooting scene The difference between the distances between two straight lines is determined.
结合第一方面,在第一方面的某些实现方式中,拍摄场景中的至少两条直线包括至少两条相互平行的直线。With reference to the first aspect, in some implementation manners of the first aspect, the at least two straight lines in the shooting scene include at least two parallel straight lines.
根据平行误差和距离误差调整外参,能够保证外参的准确度。同时,本申请实施例的方案仅需要拍摄场景中的两条已知距离的平行线即可实现双目相机外参的标定,能够减少重构误差中的误差项,进而减少计算量,提高外参的调整速度,即提高外参的标定效率。此外,由于本申请实施例的方案仅需要拍摄场景中的两条已知距离的平行线即可实现双目相机外参的标定,无需精确定位出直线在三维空间中的位置,无需预设靶标,降低了对拍摄场景的要求,减少了标定成本。Adjusting the external parameters according to the parallel error and the distance error can ensure the accuracy of the external parameters. At the same time, the solution of the embodiment of the present application only needs two parallel lines with known distances in the shooting scene to realize the calibration of the extrinsic parameters of the binocular camera, which can reduce the error term in the reconstruction error, thereby reducing the amount of calculation and improving the external parameters. The adjustment speed of the parameters is improved, that is, the calibration efficiency of the external parameters is improved. In addition, since the solution of the embodiment of the present application only needs to shoot two parallel lines with known distances in the scene to realize the calibration of the external parameters of the binocular camera, there is no need to accurately locate the position of the line in the three-dimensional space, and there is no need to preset the target , which reduces the requirements for the shooting scene and reduces the calibration cost.
结合第一方面,在第一方面的某些实现方式中,分别在第一图像和第二图像中提取m条直线包括:对第一图像和第二图像分别进行实例分割,得到第一图像中的实例和第二图像中的实例;分别在第一图像中的实例和第二图像中的实例中提取m条直线,第一图像中的m条直线和第二图像中的m条直线之间的对应关系是根据第一图像中的实例和第二图像中的实例之间的对应关系确定的。With reference to the first aspect, in some implementations of the first aspect, extracting m straight lines in the first image and the second image respectively includes: performing instance segmentation on the first image and the second image respectively, to obtain The instance of and the instance in the second image; extract m straight lines in the instance in the first image and the instance in the second image respectively, between the m straight lines in the first image and the m straight lines in the second image The correspondence of is determined from the correspondence between instances in the first image and instances in the second image.
本申请实施例中,通过两张图像中的实例之间的对应关系确定直线之间的对应关系,能够提高直线匹配的准确度,提高了外参标定的准确度,同时减少计算复杂度,提高了外参标定的效率。In the embodiment of the present application, the correspondence between the straight lines is determined through the correspondence between the instances in the two images, which can improve the accuracy of straight line matching, improve the accuracy of external parameter calibration, reduce computational complexity, and improve The efficiency of external reference calibration is improved.
结合第一方面,在第一方面的某些实现方式中,分别在第一图像中的实例和第二图像中的实例中提取m条直线,包括:分别在第一图像和第二图像的实例中提取多条原始直线;将第一图像中的实例的同侧边缘的多条原始直线拟合为第一图像中该实例的该侧边缘的一条目标直线;将第二图像中的实例的同侧边缘的多条原始直线拟合为第二图像中该实例的该侧边缘的一条目标直线,m条直线属于目标直线。With reference to the first aspect, in some implementations of the first aspect, extracting m straight lines from the instance in the first image and the instance in the second image respectively includes: respectively extracting m straight lines in the instance of the first image and the second image Extract a plurality of original straight lines in the first image; fit a plurality of original straight lines of the same-side edge of the instance in the first image to a target straight line of the side edge of the instance in the first image; fit the same-side edge of the instance in the second image Multiple original straight lines on the side edge are fitted to a target straight line on the side edge of the instance in the second image, and the m straight lines belong to the target straight line.
在本申请实施例的方案中,对实例同侧的原始直线进行拟合,能够得到更准确的目标直线,利用目标直线对双目相机外参进行标定,有利于提高双目相机外参的标定结果的准确性。In the solution of the embodiment of this application, the original straight line on the same side of the example is fitted to obtain a more accurate target straight line, and the target straight line is used to calibrate the external parameters of the binocular camera, which is conducive to improving the calibration of the external parameters of the binocular camera the accuracy of the results.
结合第一方面,在第一方面的某些实现方式中,对第一图像和第二图像分别进行实例分割,得到第一图像中的实例和第二图像中的实例,包括:对第一图像和第二图像分别进行语义分割,得到第一图像的语义分割结果和第二图像的语义分割结果,第一图像的语义分割结果包括第一图像中的水平物或竖直物,第二图像的语义分割结果包括第二图像中的水平物或竖直物;基于第一图像的语义分割结果对第一图像进行实例分割,得到第一图像中的实例,基于第二图像的语义分割结果对第二图像进行实例分割,得到第二图像中的实例。With reference to the first aspect, in some implementations of the first aspect, instance segmentation is performed on the first image and the second image respectively to obtain instances in the first image and instances in the second image, including: Perform semantic segmentation with the second image respectively to obtain the semantic segmentation result of the first image and the semantic segmentation result of the second image. The semantic segmentation result of the first image includes horizontal objects or vertical objects in the first image, and the semantic segmentation result of the second image Semantic segmentation results include horizontal objects or vertical objects in the second image; based on the semantic segmentation results of the first image, the first image is instance-segmented to obtain instances in the first image, and based on the semantic segmentation results of the second image, the second image is Instance segmentation is performed on the second image to obtain the instance in the second image.
本申请实施例中,通过语义分割区分出图像中的水平物或竖直物,这样能够利用拍摄场景中的水平物或竖直物中的直线之间的几何约束,例如,垂直约束,实现双目相机外参的调整。若双目相机为车载摄像头,行道线或杆状物等在开放道路中较为常见,可以采用开放道路中的标定物实现双目相机外参的调整,无需预先布置标定场地,减少了成本。In the embodiment of the present application, the horizontal objects or vertical objects in the image are distinguished through semantic segmentation, so that the geometric constraints between the horizontal objects or the vertical objects in the shooting scene, such as vertical constraints, can be used to achieve dual Adjustment of the extrinsic parameters of the camera. If the binocular camera is a vehicle-mounted camera, road markings or poles are more common on open roads, the calibration objects on the open road can be used to adjust the external parameters of the binocular camera, and there is no need to pre-arrange the calibration site, which reduces costs.
结合第一方面,在第一方面的某些实现方式中,方法还包括:控制显示器显示双目相机外参的标定情况。With reference to the first aspect, in some implementation manners of the first aspect, the method further includes: controlling the display to display the calibration status of the extrinsic parameters of the binocular camera.
例如,该显示器可以为车载显示器。For example, the display may be a vehicle-mounted display.
在本申请实施例的方案中能够实时显示当前的标定情况,有利于用户了解当前的标定进展,提高用户体验。In the solution of the embodiment of the present application, the current calibration situation can be displayed in real time, which is beneficial for the user to know the current calibration progress and improves the user experience.
结合第一方面,在第一方面的某些实现方式中,双目相机外参的标定情况包括以下至少一项:当前的标定进度、当前的重构误差的情况或重构后的p条直线,重构后的p条直线是基于当前的双目相机的外参将第一图像的m条直线中的p条直线和第二图像的m条直线中的p条直线重构到三维空间中得到的,1<p≤m,p为整数。In combination with the first aspect, in some implementations of the first aspect, the calibration of the extrinsic parameters of the binocular camera includes at least one of the following: the current calibration progress, the current reconstruction error, or the reconstructed p straight lines , the reconstructed p lines are based on the extrinsic parameters of the current binocular camera to reconstruct p lines in the m lines of the first image and p lines in the m lines of the second image into the three-dimensional space Obtained, 1<p≤m, p is an integer.
示例性地,当前的双目相机的外参可以是调整后的双目相机的外参。Exemplarily, the current extrinsic parameters of the binocular camera may be adjusted extrinsic parameters of the binocular camera.
或者,当前的双目相机的外参可以为调整过程中最优的双目相机的外参。调整过程中最优的双目相机的外参可以为调整过程中使得重构误差最小的外参。Alternatively, the current extrinsic parameters of the binocular camera may be the optimal extrinsic parameters of the binocular camera during the adjustment process. The optimal external parameter of the binocular camera during the adjustment process may be the external parameter that minimizes the reconstruction error during the adjustment process.
本申请实施例中,可视化标定结果,显示重构后的直线的三维空间位置,有利于用户直观感受当前的标定情况。In the embodiment of the present application, the calibration result is visualized and the three-dimensional space position of the reconstructed straight line is displayed, which is helpful for the user to intuitively experience the current calibration situation.
结合第一方面,在第一方面的某些实现方式中,当前的标定进度包括以下至少一项:当前的双目相机的外参或当前的标定完成度。With reference to the first aspect, in some implementation manners of the first aspect, the current calibration progress includes at least one of the following: current extrinsic parameters of the binocular camera or current calibration completion.
结合第一方面,在第一方面的某些实现方式中,当前的重构误差的情况包括以下至少一项:当前的重构误差、当前的距离误差或当前的角度误差。With reference to the first aspect, in some implementation manners of the first aspect, the current reconstruction error includes at least one of the following: a current reconstruction error, a current distance error, or a current angle error.
第二方面,提供了一种双目相机外参标定的装置,该装置包括:获取单元,用于获取第一图像和第二图像,第一图像是由双目相机中的第一摄像头对拍摄场景拍摄得到的,第二图像是由双目相机中的第二摄像头对拍摄场景拍摄得到的;处理单元,用于分别在第一图像和第二图像中提取m条直线,m为大于1的整数,第一图像的m条直线和第二图像的m条直线之间具有对应关系;基于双目相机的外参将第一图像的m条直线中的n条直线和第二图像的m条直线中的n条直线重构到三维空间中,得到重构后的n条直线,第一图像的n条直线和第二图像的n条直线为拍摄场景中的n条直线的投影,1<n≤m,n为整数;根据重构误差调整双目相机的外参,重构误差是根据重构后的n条直线之间的位置关系和拍摄场景中的n条直线之间的位置关系确定的。In a second aspect, a device for calibrating external parameters of a binocular camera is provided, the device comprising: an acquisition unit configured to acquire a first image and a second image, the first image being taken by a pair of first cameras in the binocular camera The scene is shot, and the second image is shot by the second camera in the binocular camera to the shooting scene; the processing unit is used to extract m straight lines in the first image and the second image respectively, and m is greater than 1 Integer, there is a corresponding relationship between the m lines of the first image and the m lines of the second image; based on the external parameters of the binocular camera, the n lines of the m lines of the first image and the m lines of the second image The n straight lines in the straight line are reconstructed into the three-dimensional space, and the reconstructed n straight lines are obtained. The n straight lines in the first image and the n straight lines in the second image are the projections of the n straight lines in the shooting scene, 1< n≤m, n is an integer; adjust the external parameters of the binocular camera according to the reconstruction error, the reconstruction error is based on the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene definite.
可选地,作为一个实施例,重构误差包括以下至少一项:重构后的n条直线之间的角度误差或重构后的n条直线之间的距离误差,重构后的n条直线之间的角度误差是根据重构后的n条直线中的至少两条直线之间的角度与拍摄场景中的n条直线中的至少两条直线之间的角度之间的差值确定的;重构后的n条直线之间的距离误差是根据重构后的n条直线中的至少两条直线之间的距离与拍摄场景中的n条直线中的至少两条直线之间的距离之间的差值确定的。Optionally, as an embodiment, the reconstruction error includes at least one of the following: the angle error between the reconstructed n straight lines or the distance error between the reconstructed n straight lines, and the reconstructed n straight lines The angle error between the straight lines is determined according to the difference between the angle between at least two straight lines among the n straight lines after reconstruction and the angle between at least two straight lines among the n straight lines in the shooting scene ; The distance error between the reconstructed n straight lines is based on the distance between at least two straight lines in the reconstructed n straight lines and the distance between at least two straight lines in the n straight lines in the shooting scene The difference between is determined.
可选地,作为一个实施例,拍摄场景中的至少两条直线包括至少两条相互平行的直线。Optionally, as an embodiment, the at least two straight lines in the shooting scene include at least two parallel straight lines.
可选地,作为一个实施例,处理单元具体用于:对第一图像和第二图像分别进行实例分割,得到第一图像中的实例和第二图像中的实例;分别在第一图像中的实例和第二图像中的实例中提取m条直线,第一图像中的m条直线和第二图像中的m条直线之间的对应关系是根据第一图像中的实例和第二图像中的实例之间的对应关系确定的。Optionally, as an embodiment, the processing unit is specifically configured to: respectively perform instance segmentation on the first image and the second image to obtain instances in the first image and instances in the second image; m straight lines are extracted from the instance and the instance in the second image, and the correspondence between the m straight lines in the first image and the m straight lines in the second image is based on the examples in the first image and the m straight lines in the second image The correspondence between instances is determined.
可选地,作为一个实施例,处理单元具体用于:对第一图像和第二图像分别进行语义分割,得到第一图像的语义分割结果和第二图像的语义分割结果,第一图像的语义分割结果包括第一图像中的水平物或竖直物,第二图像的语义分割结果包括第二图像中的水平物或竖直物;基于第一图像的语义分割结果对第一图像进行实例分割,得到第一图像中的实 例,基于第二图像的语义分割结果对第二图像进行实例分割,得到第二图像中的实例。Optionally, as an embodiment, the processing unit is specifically configured to: perform semantic segmentation on the first image and the second image respectively, obtain the semantic segmentation result of the first image and the semantic segmentation result of the second image, and obtain the semantic segmentation result of the first image. The segmentation result includes horizontal or vertical objects in the first image, and the semantic segmentation result of the second image includes horizontal or vertical objects in the second image; instance segmentation is performed on the first image based on the semantic segmentation result of the first image , get the instance in the first image, perform instance segmentation on the second image based on the semantic segmentation result of the second image, and obtain the instance in the second image.
可选地,作为一个实施例,装置还包括:显示单元,用于显示双目相机外参的标定情况。Optionally, as an embodiment, the device further includes: a display unit, configured to display the calibration situation of the extrinsic parameters of the binocular camera.
可选地,作为一个实施例,双目相机外参的标定情况包括以下至少一项:当前的标定进度、当前的重构误差的情况或重构后的p条直线,重构后的p条直线是基于当前的双目相机的外参将第一图像的m条直线中的p条直线和第二图像的m条直线中的p条直线重构到三维空间中得到的,1<p≤m,p为整数。Optionally, as an embodiment, the calibration of the external parameters of the binocular camera includes at least one of the following: the current calibration progress, the current reconstruction error situation or the reconstructed p lines, the reconstructed p lines The straight line is obtained by reconstructing p straight lines out of the m straight lines in the first image and p straight lines in the m straight lines in the second image based on the extrinsic parameters of the current binocular camera, 1<p≤ m and p are integers.
可选地,作为一个实施例,当前的标定进度包括以下至少一项:当前的双目相机的外参或当前的标定完成度。Optionally, as an embodiment, the current calibration progress includes at least one of the following: current extrinsic parameters of the binocular camera or current calibration completion.
可选地,作为一个实施例,当前的重构误差的情况包括以下至少一项:当前的重构误差、当前的距离误差或当前的角度误差。Optionally, as an embodiment, the condition of the current reconstruction error includes at least one of the following: a current reconstruction error, a current distance error, or a current angle error.
可选地,双目相机为车载摄像头,双目相机承载于的车辆可以处于静止状态,也可以处于移动状态。Optionally, the binocular camera is a vehicle-mounted camera, and the vehicle on which the binocular camera is carried may be in a stationary state or in a moving state.
第三方面,提供一种双目相机外参标定的装置,该装置包括处理器,该处理器与存储器耦合,该存储器用于存储计算机程序或指令,处理器用于执行存储器存储的计算机程序或指令,使得第一方面或第一方面中的任一项实现方式中的方法被执行。In a third aspect, a device for calibrating external parameters of a binocular camera is provided, the device includes a processor, the processor is coupled with a memory, the memory is used to store computer programs or instructions, and the processor is used to execute the computer programs or instructions stored in the memory , so that the method in the first aspect or any implementation manner in the first aspect is executed.
可选地,该装置包括的处理器为一个或多个。Optionally, the device includes one or more processors.
可选地,该装置中还可以包括与处理器耦合的存储器。Optionally, the device may further include a memory coupled to the processor.
可选地,该装置包括的存储器可以为一个或多个。Optionally, the device may include one or more memories.
可选地,该存储器可以与该处理器集成在一起,或者分离设置。Optionally, the memory can be integrated with the processor, or set separately.
可选地,该装置还可以包括数据接口。Optionally, the device may also include a data interface.
第四方面,提供一种计算机可读介质,该计算机可读介质存储用于设备执行的程序代码,该程序代码包括用于执行上述第一方面或第一方面中的任一项实现方式中的方法。In a fourth aspect, a computer-readable medium is provided, where the computer-readable medium stores program code for execution by a device, and the program code includes a program code for executing the above-mentioned first aspect or any implementation manner in the first aspect. method.
第五方面,提供一种包含指令的计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述第一方面或第一方面中的任一项实现方式中的方法。In a fifth aspect, a computer program product including instructions is provided, and when the computer program product is run on a computer, it causes the computer to execute the method in the above first aspect or any one of the implementation manners of the first aspect.
第六方面,提供一种芯片,所述芯片包括处理器与数据接口,所述处理器通过所述数据接口读取存储器上存储的指令,执行上述第一方面或第一方面中的任一项实现方式中的方法。In a sixth aspect, a chip is provided, the chip includes a processor and a data interface, and the processor reads instructions stored on the memory through the data interface, and executes any one of the above-mentioned first aspect or the first aspect method in the implementation.
可选地,作为一种实现方式,所述芯片还可以包括存储器,所述存储器中存储有指令,所述处理器用于执行所述存储器上存储的指令,当所述指令被执行时,所述处理器用于执行上述第一方面或第一方面中的任一项实现方式中的方法。Optionally, as an implementation manner, the chip may further include a memory, the memory stores instructions, the processor is configured to execute the instructions stored in the memory, and when the instructions are executed, the The processor is configured to execute the method in the foregoing first aspect or any implementation manner of the first aspect.
第七方面,提供一种终端,该终端包括第二方面及第二方面任一种实现方式中的装置。In a seventh aspect, a terminal is provided, and the terminal includes the second aspect and the device in any one implementation manner of the second aspect.
可选地,该终端还包括双目相机。Optionally, the terminal further includes a binocular camera.
示例性地,该终端可以为车辆。Exemplarily, the terminal may be a vehicle.
附图说明Description of drawings
图1是本申请实施例提供的一种应用场景的示意图;FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present application;
图2是本申请实施例提供的一种双目相机外参的标定方法的示意性流程图;FIG. 2 is a schematic flow chart of a calibration method for extrinsic parameters of a binocular camera provided in an embodiment of the present application;
图3是本申请实施例提供的一种双目相机成像的原理的示意图;Fig. 3 is a schematic diagram of the imaging principle of a binocular camera provided by the embodiment of the present application;
图4是本申请实施例提供的另一种双目相机外参的标定方法的示意性流程图;FIG. 4 is a schematic flow chart of another calibration method for extrinsic parameters of a binocular camera provided by an embodiment of the present application;
图5是本申请实施例提供的标定场地的示意图;Fig. 5 is a schematic diagram of the calibration site provided by the embodiment of the present application;
图6是本申请实施例提供的双目图像的语义分割结果的示意图;Fig. 6 is a schematic diagram of the semantic segmentation result of the binocular image provided by the embodiment of the present application;
图7是本申请实施例提供的双目图像的实例标注结果的示意图;Fig. 7 is a schematic diagram of an example tagging result of a binocular image provided by an embodiment of the present application;
图8是本申请实施例提供的双目图像中的目标直线的示意图;Fig. 8 is a schematic diagram of a target line in a binocular image provided by an embodiment of the present application;
图9是本申请实施例提供的重构后的直线的空间位置的示意图;Fig. 9 is a schematic diagram of the spatial position of the reconstructed straight line provided by the embodiment of the present application;
图10是本申请实施例提供的当前的标定情况的示意图;Fig. 10 is a schematic diagram of the current calibration situation provided by the embodiment of the present application;
图11是本申请实施例提供的一种双目相机外参的标定装置的示意图;Fig. 11 is a schematic diagram of a calibration device for extrinsic parameters of a binocular camera provided by an embodiment of the present application;
图12是本申请实施例提供的另一种双目相机外参的标定装置的示意图。Fig. 12 is a schematic diagram of another calibration device for extrinsic parameters of a binocular camera provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合附图,对本申请中的技术方案进行描述。The technical solution in this application will be described below with reference to the accompanying drawings.
本申请实施例的方案能够应用于智能设备上。智能设备是指任何一种具有计算处理能力的设备、器械或者机器。本申请实施例中的智能设备可以是机器人(robot)、自动驾驶汽车(autonomous vehicles)、智能辅助驾驶汽车、无人机(unmanned aerial vehicle)、智能辅助飞机、智能家居(smart home)设备等。本申请对该智能设备不作任何限定。只要是可以安装双目相机的设备均可以纳入本申请智能设备的范围。The solutions of the embodiments of the present application can be applied to smart devices. Smart device refers to any kind of equipment, apparatus or machine with computing power. The smart devices in the embodiments of the present application may be robots, autonomous vehicles, intelligent assisted driving vehicles, unmanned aerial vehicles, intelligent assisted aircraft, smart home devices, and the like. This application does not impose any limitation on the smart device. Any device that can be equipped with a binocular camera can be included in the scope of smart devices of this application.
本申请实施例提供的方法能够应用在自动驾驶、无人机导航、机器人导航、工业非接触式检测、三维重建、虚拟现实以及其他需要进行双目相机标定的场景。具体而言,本申请实施例的方法能够应用在自动驾驶场景中,下面对自动驾驶场景进行简单的介绍。The method provided by the embodiment of the present application can be applied to automatic driving, drone navigation, robot navigation, industrial non-contact detection, 3D reconstruction, virtual reality and other scenarios that require binocular camera calibration. Specifically, the method in the embodiment of the present application can be applied in an automatic driving scenario, and the automatic driving scenario is briefly introduced below.
如图1所示,车辆110可以被配置为完全或部分地自动驾驶模式。例如,车辆110可以在处于自动驾驶模式中的同时控制自身,并且可通过人为操作来确定车辆及其周边环境的当前状态,确定周边环境中的至少一个其他车辆的可能行为,并确定该其他车辆执行可能行为的可能性相对应的置信水平,基于所确定的信息来控制车辆110。在车辆110处于自动驾驶模式中时,可以将车辆100置为在没有和人交互的情况下操作。As shown in FIG. 1 , vehicle 110 may be configured in a fully or partially autonomous driving mode. For example, vehicle 110 may control itself while in an autonomous driving mode, and may be human-operated to determine the current state of the vehicle and its surroundings, determine the likely behavior of at least one other vehicle in the surroundings, and determine the A confidence level corresponding to the likelihood of performing the possible action is used to control the vehicle 110 based on the determined information. While the vehicle 110 is in the autonomous driving mode, the vehicle 100 may be set to operate without human interaction.
移动数据中心120(mobile data center,MDC)作为一种自动驾驶计算平台,用于处理各种传感器数据,为自动驾驶提供决策支持。Mobile data center 120 (mobile data center, MDC) is an automatic driving computing platform, which is used to process various sensor data and provide decision support for automatic driving.
车辆110包括传感器系统。传感器系统包括感知关于车辆110周边的环境的信息的若干个传感器。例如,传感器系统可包括定位系统(定位系统可以是GPS系统,也可以是北斗系统或者其他定位系统)、惯性测量单元(inertial measurement unit,IMU)、雷达、激光测距仪以及双目相机等。应理解,虽然图1中仅示出了双目相机111,但在车辆110中还可以包括其他传感器。Vehicle 110 includes a sensor system. The sensor system includes several sensors that sense information about the environment around the vehicle 110 . For example, the sensor system may include a positioning system (the positioning system may be a GPS system, or a Beidou system or other positioning systems), an inertial measurement unit (IMU), a radar, a laser range finder, and a binocular camera. It should be understood that although only the binocular camera 111 is shown in FIG. 1 , other sensors may also be included in the vehicle 110 .
为了得到更好的感知结果,需要融合多个若干个传感器的信息。具体地,可以通过各个传感器之间的外参将不同传感器统一到相同的坐标系下,进而实现多个传感器信息的融合。In order to obtain better perception results, it is necessary to fuse information from multiple sensors. Specifically, different sensors can be unified into the same coordinate system through the external reference between the various sensors, thereby realizing the fusion of information from multiple sensors.
标定模块121用于确定传感器的外参。在本申请实施例中,传感器系统包括双目相机,标定模块121用于确定双目相机的外参。如图1所示,标定模块121可以根据双目相机采集的双目图像实现双目相机外参的标定。The calibration module 121 is used to determine the external parameters of the sensor. In the embodiment of the present application, the sensor system includes a binocular camera, and the calibration module 121 is used to determine external parameters of the binocular camera. As shown in FIG. 1 , the calibration module 121 can calibrate the extrinsic parameters of the binocular camera according to the binocular image collected by the binocular camera.
上层功能模块122可以基于双目相机的外参实现相应的功能。也就是说,双目相机的 外参标定结果可以提供给自动驾驶的上层业务。例如,测距功能模块可以根据双目相机的外参从双目相机采集的图像中确定障碍物与车辆之间的距离。再如,避障功能模块可以根据双目相机的外参从双目相机采集的图像中识别、评估和避免或者以其他方式越过车辆的环境中的潜在障碍物。The upper layer function module 122 can realize corresponding functions based on the external parameters of the binocular camera. In other words, the external parameter calibration results of the binocular camera can be provided to the upper-level business of automatic driving. For example, the ranging function module can determine the distance between the obstacle and the vehicle from the images collected by the binocular camera according to the external parameters of the binocular camera. For another example, the obstacle avoidance function module can identify, evaluate and avoid potential obstacles in the environment of the vehicle in other ways according to the external parameters of the binocular camera from the images collected by the binocular camera.
进一步地,可以通过车辆上的人机交互界面(human machine interface,HMI)130显示当前的标定情况。Further, the current calibration situation can be displayed through a human machine interface (human machine interface, HMI) 130 on the vehicle.
示例性地,HMI130可以为车载显示器。Exemplarily, HMI 130 may be a vehicle display.
需要说明的是,附图1仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在附图1中,标定模块121和上层功能模块122位于MDC120中,在其它情况下,也可以将标定模块121或上层功能模块置于车辆110的其他处理器中。或者,上述过程中的一些由布置在车辆110内的处理器执行而其他的则由远程处理器执行。再如,附图1中,MDC120位于车辆110外部,并且可以与车辆110进行无线通信。在其他情况下,MDC可以位于车辆110内部。HMI130可以位于车辆110内部。It should be noted that accompanying drawing 1 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between devices, devices, modules, etc. shown in the figure does not constitute any limitation, for example, in accompanying drawing 1 , the calibration module 121 and the upper-layer function module 122 are located in the MDC 120 , and in other cases, the calibration module 121 or the upper-layer function module can also be placed in other processors of the vehicle 110 . Alternatively, some of the processes described above are performed by a processor disposed within the vehicle 110 while others are performed by a remote processor. For another example, in FIG. 1 , the MDC 120 is located outside the vehicle 110 and can communicate with the vehicle 110 wirelessly. In other cases, the MDC may be located inside the vehicle 110 . HMI 130 may be located inside vehicle 110 .
本申请实施例的方案能够应用于标定模块121。本申请实施例的方案可以由标定模块121执行。采用本申请实施例的方案能够实现双目相机外参的标定,提高双目相机外参标定的效率,更新系统中的双目相机的外参标定值,为上层业务提供高精度的外参,以提高上层业务的准确性,进而提高了自动驾驶的性能。The solution of the embodiment of the present application can be applied to the calibration module 121 . The solution in the embodiment of the present application may be executed by the calibration module 121 . The solution of the embodiment of the present application can realize the calibration of the external parameters of the binocular camera, improve the efficiency of the calibration of the external parameters of the binocular camera, update the calibration value of the external parameters of the binocular camera in the system, and provide high-precision external parameters for the upper-level business. In order to improve the accuracy of upper-level business, and then improve the performance of automatic driving.
为了便于理解本申请实施例,下面先介绍本申请实施例涉及的概念进行说明。In order to facilitate the understanding of the embodiments of the present application, concepts involved in the embodiments of the present application are firstly introduced below for description.
摄像头标定(camera calibration)也称为相机标定。Camera calibration is also called camera calibration.
基于摄像头的成像原理可知,摄像头成像的几何模型中三维空间点与图像平面上二维像点之间存在对应关系,这个对应关系是由摄像头的参数决定的。获得摄像头的参数的过程就称之为摄像头标定。关于摄像头的成像原理为现有技术,本文对此不作详述。Based on the imaging principle of the camera, it can be known that there is a corresponding relationship between the three-dimensional space points in the geometric model of the camera imaging and the two-dimensional image points on the image plane, and this corresponding relationship is determined by the parameters of the camera. The process of obtaining the parameters of the camera is called camera calibration. The imaging principle of the camera is the prior art, and this article will not describe it in detail.
作为示例,假设将摄像头成像的几何模型中的三维空间点记为X W,将摄像头成像的几何模型中图像平面上二维像点记为X P,三维空间点X W与二维像点X P之间的关系可以表示如下: As an example, assume that the three-dimensional space point in the geometric model of camera imaging is recorded as X W , the two-dimensional image point on the image plane in the geometric model of camera imaging is recorded as X P , the three-dimensional space point X W and the two-dimensional image point X The relationship between P can be expressed as follows:
X P=MX W X P =MX W
其中,M表示三维空间点X W与二维像点X P之间的转换矩阵,可以称为投影矩阵。该投影矩阵M中的一些元素表征摄像头的参数。摄像头标定就是要获取该投影矩阵M。 Wherein, M represents the transformation matrix between the three-dimensional space point X W and the two-dimensional image point X P , which may be called a projection matrix. Some elements in the projection matrix M represent camera parameters. Camera calibration is to obtain the projection matrix M.
摄像头的参数包括内参与外参。其中,内参为摄像头自身的参数,例如,焦距等。外参为摄像头的安装位置相关的参数,例如俯仰角(pitch)、翻滚角(roll)和偏航角(yaw)等。Camera parameters include intrinsic and extrinsic parameters. Wherein, the internal reference is a parameter of the camera itself, for example, a focal length and the like. The external parameters are parameters related to the installation position of the camera, such as pitch angle (pitch), roll angle (roll) and yaw angle (yaw).
可以将内参对应的转换矩阵称为内参转换矩阵,将外参对应的转换矩阵称为外参转换矩阵。The conversion matrix corresponding to the internal reference may be called the internal reference conversion matrix, and the conversion matrix corresponding to the external reference may be called the external reference conversion matrix.
摄像头标定一般来说需要标定参照物(也可称为标定物或参照物)。标定参照物表示,摄像头标定过程中,摄像头所拍摄的对象。Camera calibration generally requires a calibration reference object (also called a calibration object or a reference object). The calibration reference object indicates the object captured by the camera during the camera calibration process.
例如,在上面示例中,三维空间点X W可以是标定参照物在世界坐标系下的坐标,二维像点X P可以是标定参照物在摄像头的像平面上的二维坐标。 For example, in the above example, the three-dimensional space point X W may be the coordinates of the calibration reference object in the world coordinate system, and the two-dimensional image point X P may be the two-dimensional coordinates of the calibration reference object on the image plane of the camera.
无论是在图像测量或者机器视觉应用中,摄像头参数的标定都是非常关键的环节,标 定结果的精度直接影响摄像头工作产生结果的准确性。Whether it is in image measurement or machine vision applications, the calibration of camera parameters is a very critical link. The accuracy of the calibration results directly affects the accuracy of the results produced by the camera.
双目相机也可以称为双目摄像头或者双目传感器。双目相机包括两个摄像头:左摄像头和右摄像头。双目相机能够获得场景的深度信息,并且可以重建周围景物的三维形状和位置。双目相机标定的目的主要是获得左右两个摄像头的内参和外参。左右两个摄像头的外参指的是左右两个摄像头的相对位置关系,例如,右摄像头相对左摄像头的平移向量和旋转矩阵。旋转矩阵也可以表示为俯仰角(pitch)、翻滚角(roll)和偏航角(yaw)。A binocular camera can also be called a binocular camera or a binocular sensor. A binocular camera includes two cameras: a left camera and a right camera. The binocular camera can obtain the depth information of the scene, and can reconstruct the three-dimensional shape and position of the surrounding scenery. The purpose of binocular camera calibration is mainly to obtain the internal and external parameters of the left and right cameras. The extrinsic parameters of the left and right cameras refer to the relative positional relationship between the left and right cameras, for example, the translation vector and rotation matrix of the right camera relative to the left camera. The rotation matrix can also be expressed as pitch angle (pitch), roll angle (roll) and yaw angle (yaw).
双目相机外参标定是图像测量或者机器视觉应用中的关键环节,标定结果的准确性直接影响双目相机工作产生结果的准确性。The calibration of the external parameters of the binocular camera is a key link in image measurement or machine vision applications. The accuracy of the calibration results directly affects the accuracy of the results produced by the binocular camera.
本申请实施例提供了一种双目相机外参标定的方法与装置,能够提高双目相机外参标定的精度。Embodiments of the present application provide a method and device for calibrating extrinsic parameters of a binocular camera, which can improve the accuracy of calibrating extrinsic parameters of a binocular camera.
图2示出了本申请实施例提供的一种双目相机外参标定的方法200的示意图。方法200包括步骤S210至步骤S240。FIG. 2 shows a schematic diagram of a method 200 for calibrating extrinsic parameters of a binocular camera provided by an embodiment of the present application. The method 200 includes steps S210 to S240.
示例性地,方法200可以应用于车载摄像头的标定,方法200可以由标定模块执行,标定模块可以位于车载计算机平台上。Exemplarily, the method 200 can be applied to the calibration of a vehicle-mounted camera, and the method 200 can be executed by a calibration module, which can be located on a vehicle-mounted computer platform.
S210,获取双目相机拍摄的至少一帧双目图像。S210. Acquire at least one frame of binocular images captured by a binocular camera.
本申请实施例中的双目图像指的是双目相机中的两个摄像头同步拍摄到的两张图像。同步拍摄到的两张图像也可以理解为在同一时刻拍摄到的两张图像。例如,双目图像中的两张图像的时间戳相同。在该情况下,获取双目相机拍摄的双目图像也可以理解为获取双目相机拍摄的同一时间戳的两张图像。The binocular image in the embodiment of the present application refers to two images captured synchronously by two cameras in a binocular camera. Two images captured simultaneously can also be understood as two images captured at the same moment. For example, two images in a binocular image have the same timestamp. In this case, acquiring a binocular image taken by a binocular camera can also be understood as acquiring two images with the same time stamp taken by a binocular camera.
至少一帧双目图像中的任一双目图像包括第一图像和第二图像。第一图像是由双目相机中的第一摄像头对拍摄场景拍摄得到的,该双目图像中的第二图像是由双目相机中的第二摄像头拍摄对该拍摄场景拍摄得到的。Any binocular image in at least one frame of binocular images includes a first image and a second image. The first image is obtained by shooting the shooting scene with the first camera in the binocular camera, and the second image in the binocular image is obtained by shooting the shooting scene with the second camera in the binocular camera.
拍摄场景中包括一个或多个标定物,标定物指的是双目相机拍摄的对象。也就是说,第一图像和第二图像包括对该标定物的成像。The shooting scene includes one or more calibration objects, and the calibration objects refer to the objects photographed by the binocular camera. That is, the first image and the second image include imaging of the calibration object.
示例性地,标定物包括水平物或竖直物等。Exemplarily, the calibration object includes a horizontal object or a vertical object and the like.
例如,水平物包括行道线。For example, horizontal objects include road markings.
例如,竖直物包括杆状物或柱状物等。For example, vertical objects include rods or pillars and the like.
第一摄像头可以为左摄像头,第二摄像头可以为右摄像头。或者,第一摄像头可以为右摄像头,第二摄像头可以为左摄像头,本申请实施例对此不作限定。左摄像头拍摄的图像也可以称为左目图像,右摄像头拍摄的图像也可以称为右目图像。The first camera may be a left camera, and the second camera may be a right camera. Alternatively, the first camera may be a right camera, and the second camera may be a left camera, which is not limited in this embodiment of the present application. An image captured by the left camera may also be called a left-eye image, and an image captured by the right camera may also be called a right-eye image.
需要说明的是,本申请实施例中的“第一图像”和“第二图像”中的“第一”和“第二”仅用于区分一帧双目图像中的不同图像,不具有其他限定作用。不同的双目图像中的第一图像为不同的图像,不同的双目图像中的第二图像为不同的图像。It should be noted that the "first" and "second" in the "first image" and "second image" in the embodiment of the present application are only used to distinguish different images in a frame of binocular images, and do not have other Limitation. The first images in different binocular images are different images, and the second images in different binocular images are different images.
至少一帧双目图像可以是对不同的拍摄场景拍摄得到的,也可以是相同的拍摄场景得到的。At least one frame of binocular images may be obtained from shooting different shooting scenes, or may be obtained from the same shooting scene.
本申请实施例中,拍摄场景相同指的是拍摄场景中的标定物相同,拍摄场景不同指的是拍摄场景中的标定物不同。也就是说,不同双目图像中的标定物可以相同,也可以不同。In the embodiment of the present application, the same shooting scene means that the calibration objects in the shooting scenes are the same, and the different shooting scenes means that the calibration objects in the shooting scenes are different. That is to say, the calibration objects in different binocular images can be the same or different.
示例性地,双目相机可以是车载摄像头,该至少一帧双目图像可以是车辆在标定场地上行驶过程中拍摄得到的多帧双目图像。Exemplarily, the binocular camera may be a vehicle-mounted camera, and the at least one frame of binocular images may be multiple frames of binocular images captured while the vehicle is driving on the calibration site.
为了描述简洁和清楚,在步骤S220至步骤S240中仅以一帧双目图像为例进行说明,其他双目图像可以采用相同的方式进行处理。For simplicity and clarity of description, only one frame of binocular image is used as an example for illustration in steps S220 to S240 , and other binocular images can be processed in the same manner.
S220,分别在第一图像和第二图像中提取m条直线,m为大于1的整数。S220. Extract m straight lines from the first image and the second image respectively, where m is an integer greater than 1.
第一图像的m条直线和第二图像的m条直线之间具有对应关系。There is a corresponding relationship between the m straight lines of the first image and the m straight lines of the second image.
拍摄场景中的直线为三维空间中的直线。三维空间中的直线在图像坐标系中的成像即为图像中的直线。或者说,图像中的直线为三维空间中的直线的投影。The straight lines in the shooting scene are the straight lines in the three-dimensional space. The imaging of the straight line in the three-dimensional space in the image coordinate system is the straight line in the image. In other words, the straight line in the image is the projection of the straight line in the three-dimensional space.
第一图像的m条直线和第二图像的m条直线之间具有对应关系,指的是,第一图像的m条直线和第二图像的m条直线是拍摄场景中的m条直线的投影。拍摄场景中的m条直线的投影,也可以理解为,拍摄场景中的m条直线在双目相机中的成像。There is a corresponding relationship between the m straight lines of the first image and the m straight lines of the second image, which means that the m straight lines of the first image and the m straight lines of the second image are the projections of the m straight lines in the shooting scene . The projection of the m straight lines in the shooting scene can also be understood as the imaging of the m straight lines in the shooting scene in the binocular camera.
也就是说,第一图像的m条直线、第二图像的m条直线以及拍摄场景中的m条直线之间具有对应关系。That is to say, there is a correspondence between the m straight lines in the first image, the m straight lines in the second image, and the m straight lines in the shooting scene.
拍摄场景中的多条直线可以理解为拍摄场景中的标定物中的直线。该多条直线可以是一个标定物中的直线,也可以是多个标定物中的直线。The multiple straight lines in the shooting scene can be understood as the straight lines in the calibration object in the shooting scene. The multiple straight lines may be straight lines in one calibration object, or may be straight lines in multiple calibration objects.
若该至少一帧双目图像包括多帧双目图像,则步骤S220可以理解为在该多帧双目图像中的每帧双目图像中提取直线。或者说,对该多帧双目图像执行步骤S220。If the at least one frame of binocular images includes multiple frames of binocular images, step S220 can be understood as extracting a straight line from each frame of binocular images in the multiple frames of binocular images. In other words, step S220 is performed on the multiple frames of binocular images.
应理解,对于不同的双目图像,m可以相同,也可以不同。也就是说,在不同双目图像中提取的直线的数量可以相同,也可以不同,本申请实施例对此不做限定。It should be understood that for different binocular images, m may be the same or different. That is to say, the number of straight lines extracted in different binocular images may be the same or different, which is not limited in this embodiment of the present application.
S230,基于双目相机的外参将第一图像中的n条直线和第二图像中的n条直线重构到三维空间中,得到重构后的n条直线。第一图像的n条直线和第二图像中的n条直线为拍摄场景中的n条直线的投影。1<n≤m,n为整数。S230. Reconstruct the n straight lines in the first image and the n straight lines in the second image into a three-dimensional space based on the external parameters of the binocular camera, to obtain n straight lines after reconstruction. The n straight lines in the first image and the n straight lines in the second image are projections of the n straight lines in the shooting scene. 1<n≤m, n is an integer.
第一图像中的n条直线属于第一图像的m条直线。第二图像中的n条直线属于第二图像的m条直线。The n straight lines in the first image belong to the m straight lines in the first image. The n lines in the second image belong to the m lines in the second image.
得到重构后的直线也可以理解为得到重构后的n条直线的空间位置。示例性地,双目相机可以为车载摄像头,重构后的n条直线的空间位置可以由自车坐标系中的n条直线的坐标表示。Obtaining the reconstructed straight lines can also be understood as obtaining the spatial positions of the n reconstructed straight lines. Exemplarily, the binocular camera may be a vehicle-mounted camera, and the reconstructed spatial positions of the n straight lines may be represented by the coordinates of the n straight lines in the ego vehicle coordinate system.
对于三维空间中的一条直线,由摄像头拍摄该直线得到的图像中包括该直线的成像,即图像中的直线。根据摄像头的成像原理可知,三维空间中的该直线、图像中的该直线以及摄像头的光心处于同一个平面。若双目相机中的两个摄像头同时拍摄三维空间中的一条直线,则三维空间中的该直线、左摄像头拍摄的左目图像中的该直线以及左摄像头的光心处于平面1#,三维空间中的该直线、右摄像头拍摄的右目图像中的该直线以及右摄像头的光心处于平面2#。平面1#和平面2#的交线即为三维空间中的该直线。For a straight line in the three-dimensional space, the image obtained by shooting the straight line with the camera includes the imaging of the straight line, that is, the straight line in the image. According to the imaging principle of the camera, the straight line in the three-dimensional space, the straight line in the image, and the optical center of the camera are on the same plane. If two cameras in the binocular camera shoot a straight line in the three-dimensional space at the same time, the straight line in the three-dimensional space, the straight line in the left-eye image captured by the left camera, and the optical center of the left camera are in plane 1#, and in the three-dimensional space The straight line, the straight line in the right-eye image captured by the right camera, and the optical center of the right camera are in plane 2#. The intersection of plane 1# and plane 2# is the straight line in the three-dimensional space.
如图3所示,若双目相机中的两个摄像头同时拍摄三维空间中的一条直线,则左目图像和右目图像中包括同一条直线的投影,基于双目相机的内参和外参,可以得到左目图像中的直线与左摄像头的光心所在的平面,以及右目图像中的直线与右摄像头的光心所在的平面,两个平面相交得到的直线即为重构后的直线。该过程即为将图像中的直线重构到三维空间中的过程。双目相机的外参越准确,重构后的直线的空间位置与三维空间中的该直线的空间位置越接近。As shown in Figure 3, if the two cameras in the binocular camera capture a straight line in the three-dimensional space at the same time, the left-eye image and the right-eye image include the projection of the same line, based on the internal and external parameters of the binocular camera, we can get The straight line in the left-eye image and the plane where the optical center of the left camera are located, and the plane where the straight line in the right-eye image and the optical center of the right camera are located, the straight line obtained by the intersection of the two planes is the reconstructed straight line. This process is the process of reconstructing the straight lines in the image into three-dimensional space. The more accurate the external reference of the binocular camera is, the closer the spatial position of the reconstructed straight line is to the spatial position of the straight line in three-dimensional space.
例如,拍摄场景中的n条直线包括直线1#和直线2#,直线1#和直线2#在第一图像中的投影分别为第一图像中的直线1#和第一图像中的直线2#。直线1#和直线2#在第二图像 中的投影分别称为第二图像中的直线1#和第二图像中的直线2#。For example, the n straight lines in the shooting scene include straight line 1# and straight line 2#, and the projections of straight line 1# and straight line 2# in the first image are respectively straight line 1# in the first image and straight line 2 in the first image #. The projections of straight line 1# and straight line 2# in the second image are respectively called straight line 1# in the second image and straight line 2# in the second image.
将第一图像中的直线1#和第二图像中的直线1#重构到空间中,可以得到重构后的直线1#。同理,将第一图像中的直线2#和第二图像中的直线2#重构到空间中,可以得到重构后的直线2#。Reconstructing the straight line 1# in the first image and the straight line 1# in the second image into space, the reconstructed straight line 1# can be obtained. Similarly, by reconstructing the straight line 2# in the first image and the straight line 2# in the second image into space, the reconstructed straight line 2# can be obtained.
若该至少一帧双目图像包括多帧双目图像,则步骤S230可以理解为基于双目相机的外参将该多帧双目图像中的直线分别重构到空间中,得到该多帧双目图像中的重构后的直线。或者说,对该多帧双目图像执行步骤S230。If the at least one frame of binocular images includes multiple frames of binocular images, step S230 can be understood as reconstructing the straight lines in the multiple frames of binocular images into space based on the external parameters of the binocular cameras to obtain the multi-frame binocular The reconstructed straight line in the target image. In other words, step S230 is performed on the multiple frames of binocular images.
应理解,对于不同的双目图像,n可以相同,也可以不同。也就是说,在不同双目图像中被重构的直线的数量可以相同,也可以不同,本申请实施例对此不做限定。It should be understood that for different binocular images, n may be the same or different. That is to say, the number of reconstructed straight lines in different binocular images may be the same or different, which is not limited in this embodiment of the present application.
S240,根据重构误差调整双目相机的外参,重构误差是根据重构后的n条直线之间的位置关系与拍摄场景中的n条直线之间的位置关系确定的。S240. Adjust the external parameters of the binocular camera according to the reconstruction error. The reconstruction error is determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene.
步骤S240可以理解为,以减小重构误差为目标,或者说,以最小化重构误差为目标调整双目相机的外参。也就是说,以双目相机的外参作为自变量,构建重构误差的方程,目标为得到使重构误差最小的双目相机的外参。Step S240 can be understood as adjusting the extrinsic parameters of the binocular camera with the goal of reducing the reconstruction error, or in other words, with the goal of minimizing the reconstruction error. That is to say, the extrinsic parameters of the binocular camera are used as independent variables to construct the equation of the reconstruction error, and the goal is to obtain the extrinsic parameters of the binocular camera that minimize the reconstruction error.
本申请实施例中,将拍摄场景中的直线之间的位置关系作为几何约束,根据重构后的n条直线之间的位置关系与拍摄场景中的n条直线之间的位置关系之间的差异调整双目相机的外参,无需精确定位拍摄场景中的直线在三维空间中的位置坐标,避免拍摄场景中的直线的位置坐标的准确度对标定结果产生影响,提高了双目相机的外参的标定精度。In the embodiment of the present application, the positional relationship between the straight lines in the shooting scene is used as a geometric constraint, according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene Differential adjustment of the external parameters of the binocular camera does not need to precisely locate the position coordinates of the straight line in the shooting scene in three-dimensional space, avoiding the impact of the accuracy of the position coordinates of the straight line in the shooting scene on the calibration result, and improving the external parameters of the binocular camera. Calibration accuracy of the reference.
而且,本申请实施例的方案中,最少仅需要拍摄场景中的两条直线的位置关系即可完成标定,减少了计算量,提高了标定的效率。Moreover, in the solution of the embodiment of the present application, at least only the positional relationship of two straight lines in the scene needs to be photographed to complete the calibration, which reduces the amount of calculation and improves the efficiency of calibration.
此外,本申请实施例的方案可以通过增加几何约束,进一步提高标定精度。In addition, the solution of the embodiment of the present application can further improve the calibration accuracy by adding geometric constraints.
此外,本申请实施例的方案的泛化能力强,适用于多种标定场景。以车载双目相机为例,标定物可以采用开放道路中的常见元素,例如,路灯杆或行道线等,无需对标定场景预先布置,例如,无需预设靶标,降低了成本。In addition, the solutions in the embodiments of the present application have strong generalization ability and are applicable to various calibration scenarios. Taking the vehicle-mounted binocular camera as an example, the calibration objects can use common elements on open roads, such as street light poles or road markings, without pre-arranging the calibration scene. For example, there is no need to preset targets, which reduces costs.
根据重构误差调整双目相机的外参可以为根据一帧或多帧双目图像的重构误差调整双目相机的外参。为了便于描述,下面先对一帧双目图像的重构误差进行说明。Adjusting the extrinsic parameters of the binocular camera according to the reconstruction error may be adjusting the extrinsic parameters of the binocular camera according to the reconstruction error of one or more frames of binocular images. For the convenience of description, the reconstruction error of a frame of binocular image will be described below.
具体地,对于一帧双目图像而言,该帧双目图像的重构误差用于指示重构后的n条直线之间的位置关系与拍摄场景中的n条直线之间的位置关系之间的差异。重构误差越小,说明重构后的n条直线之间的位置关系越符合拍摄场景中的n条直线之间的位置关系,当前双目相机的外参的准确性越高。Specifically, for a frame of binocular image, the reconstruction error of the frame of binocular image is used to indicate the difference between the positional relationship between the reconstructed n straight lines and the positional relationship between n straight lines in the shooting scene. difference between. The smaller the reconstruction error, the more the positional relationship between the reconstructed n straight lines conforms to the positional relationship between the n straight lines in the shooting scene, and the higher the accuracy of the extrinsic parameters of the current binocular camera.
在一种实现方式中,可以将调整后的双目相机的外参作为双目相机的外参标定值。In an implementation manner, the adjusted extrinsic parameters of the binocular camera may be used as calibration values of the extrinsic parameters of the binocular camera.
在另一种实现方式中,可以将步骤S230中的双目相机的外参更新为调整后的双目相机的外参,重复执行步骤S230至步骤S240,直至得到满足预设条件的双目相机的外参,将该双目相机的外参作为双目相机的外参标定值。例如,预设条件可以为重构误差小于或等于误差阈值的外参。In another implementation, the external parameters of the binocular camera in step S230 can be updated to the adjusted external parameters of the binocular camera, and steps S230 to S240 are repeated until a binocular camera that meets the preset conditions is obtained. The external parameter of the binocular camera is used as the external parameter calibration value of the binocular camera. For example, the preset condition may be an external parameter whose reconstruction error is less than or equal to an error threshold.
示例性地,可以在双目相机的外参姿态空间搜索使重构误差最小的双目相机的外参,并将搜索到的外参作为双目相机的外参标定值。Exemplarily, the extrinsic parameters of the binocular camera that minimize the reconstruction error may be searched in the pose space of the extrinsic parameters of the binocular camera, and the searched extrinsic parameters may be used as calibration values of the extrinsic parameters of the binocular camera.
可替换地,可以通过非线性优化的方式调整双目相机的外参,并将调整后的外参作为双目相机的外参标定值。Alternatively, the extrinsic parameters of the binocular camera can be adjusted in a non-linear optimization manner, and the adjusted extrinsic parameters can be used as calibration values of the extrinsic parameters of the binocular camera.
应理解,以上仅为示例,其他求解最优解的方式也适用于本申请实施例的方案。It should be understood that the above is only an example, and other ways of finding the optimal solution are also applicable to the solution of the embodiment of the present application.
拍摄场景中的n条直线之间的位置关系可以作为该n条直线之间的几何约束。重构误差越小,说明重构后的n条直线越能满足该几何约束。The positional relationship between the n straight lines in the shooting scene can be used as a geometric constraint between the n straight lines. The smaller the reconstruction error, the better the reconstructed n straight lines can satisfy the geometric constraint.
在该情况下,步骤S240可以理解为,调整双目相机的外参以使重构后的n条直线尽量满足拍摄场景中的n条直线之间的几何约束。或者说,根据拍摄场景中的n条直线之间的几何约束调整双目相机的外参。In this case, step S240 can be understood as adjusting the extrinsic parameters of the binocular camera so that the reconstructed n straight lines meet the geometric constraints among the n straight lines in the shooting scene as much as possible. In other words, adjust the extrinsic parameters of the binocular camera according to the geometric constraints between n straight lines in the shooting scene.
该几何约束的具体表现形式与拍摄场景中的n条直线之间的位置关系有关。The specific form of the geometric constraint is related to the positional relationship between n straight lines in the shooting scene.
以拍摄场景中的两条直线为例,拍摄场景中的两条直线之间的位置关系为夹角为60度的两条直线,该两条直线满足的几何约束可以包括:该两条直线相交,夹角为60度。在该情况下,可以调整双目相机的外参以使重构后的两条直线尽量满足该几何约束。Taking two straight lines in the shooting scene as an example, the positional relationship between the two straight lines in the shooting scene is two straight lines with an angle of 60 degrees. The geometric constraints satisfied by the two straight lines may include: the intersection of the two straight lines , with an included angle of 60 degrees. In this case, the extrinsic parameters of the binocular camera can be adjusted so that the reconstructed two straight lines satisfy the geometric constraint as much as possible.
可选地,重构误差包括以下至少一项:重构后的n条直线之间的角度误差或重构后的n条直线之间的距离误差。Optionally, the reconstruction error includes at least one of the following: an angle error between the reconstructed n straight lines or a distance error between the reconstructed n straight lines.
重构后的n条直线之间的角度误差是根据重构后的n条直线中的至少两条直线之间的角度与拍摄场景中的n条直线中的至少两条直线之间的角度之间的差值确定的。重构后的至少两条直线与拍摄场景中的至少两条直线是对应的。The angle error between the reconstructed n straight lines is based on the difference between the angle between at least two straight lines in the reconstructed n straight lines and the angle between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined. The reconstructed at least two straight lines correspond to at least two straight lines in the shooting scene.
重构后的n条直线之间的角度误差用于约束重构后的n条直线之间的角度。即角度误差可以作为一种角度约束。The angle error between the reconstructed n straight lines is used to constrain the angle between the reconstructed n straight lines. That is, the angular error can be used as an angular constraint.
重构后的两条直线的角度误差是根据重构后的两条直线之间的角度与拍摄场景中的两条直线之间的角度之间的差值确定的。The angle error of the reconstructed two straight lines is determined according to the difference between the angle between the reconstructed two straight lines and the angle between the two straight lines in the shooting scene.
例如,拍摄场景中的两条直线之间的角度为a。重构后的两条直线的角度误差为重构后的两条直线之间的角度与a之间的差值的绝对值。For example, the angle between two straight lines in the shooting scene is a. The angle error of the reconstructed two straight lines is the absolute value of the difference between the angle between the reconstructed two straight lines and a.
示例性地,若重构后的至少两条直线数量为2,则重构后的n条直线之间的角度误差可以为该重构后的两条直线的角度误差。Exemplarily, if the number of at least two reconstructed straight lines is 2, the angle error between the n reconstructed straight lines may be the angle error of the reconstructed two straight lines.
也就是说,可以从重构后的n条直线中选择两条直线,并将该两条直线的重构误差作为重构后的n条直线之间的角度误差。That is to say, two straight lines can be selected from the reconstructed n straight lines, and the reconstruction error of the two straight lines can be used as the angle error between the n reconstructed straight lines.
示例性地,若重构后的至少两条直线的数量大于2,则重构后的n条直线之间的角度误差可以为该重构后的至少两条直线的角度误差的总和,或者,该重构后的至少两条直线的角度误差的平均值。Exemplarily, if the number of the reconstructed at least two straight lines is greater than 2, the angle error between the reconstructed n straight lines may be the sum of the angle errors of the reconstructed at least two straight lines, or, The average value of angle errors of at least two straight lines after the reconstruction.
也就是说,可以从重构后的n条直线中选择3条或3条以上的直线,并将被选择的直线之间的角度误差的总和,或者,被选择的直线之间的角度误差的平均值作为重构后的n条直线之间的角度误差。That is to say, 3 or more straight lines can be selected from the reconstructed n straight lines, and the sum of the angular errors between the selected straight lines, or the sum of the angular errors between the selected straight lines The average value is used as the angle error between the reconstructed n straight lines.
例如,重构后的至少两条直线包括重构后的直线1#、重构后的直线2#和重构后的直线3#。重构后的直线1#与重构后的直线2#的角度误差为角度误差1#,重构后的直线1#和重构后的直线3#的角度误差为角度误差2#。重构后的n条直线的角度误差可以为角度误差1#和角度误差2#的总和,或者,角度误差可以为角度误差1#和角度误差2#的平均值。For example, the at least two reconstructed straight lines include reconstructed straight line 1#, reconstructed straight line 2# and reconstructed straight line 3#. The angle error between the reconstructed straight line 1# and the reconstructed straight line 2# is the angle error 1#, and the angle error between the reconstructed straight line 1# and the reconstructed straight line 3# is the angle error 2#. The angle error of the reconstructed n straight lines may be the sum of angle error 1# and angle error 2#, or the angle error may be the average value of angle error 1# and angle error 2#.
重构后的n条直线之间的距离误差是根据重构后的n条直线中的至少两条直线之间的距离与拍摄场景中的n条直线中的至少两条直线之间的距离之间的差值确定的。重构后的至少两条直线与拍摄场景中的至少两条直线是对应的。The distance error between the reconstructed n straight lines is based on the distance between at least two straight lines in the reconstructed n straight lines and the distance between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined. The reconstructed at least two straight lines correspond to at least two straight lines in the shooting scene.
在计算距离误差时所采用的拍摄场景中的该至少两条直线包括至少两条平行的直线。 例如,拍摄场景中的该至少两条直线可以相互平行,或者,该至少两条直线包括多组平行的直线,同一组内的多条直线相互平行,不同组的直线不平行,本申请实施例对此不做限定。The at least two straight lines in the shooting scene used when calculating the distance error include at least two parallel straight lines. For example, the at least two straight lines in the shooting scene may be parallel to each other, or the at least two straight lines include multiple groups of parallel straight lines, the multiple straight lines in the same group are parallel to each other, and the straight lines in different groups are not parallel. There is no limit to this.
应理解,重构后的n条直线之间的距离误差所采用的至少两条直线与重构后的n条直线之间的角度误差所采用的至少两条直线可以相同,也可以不同。It should be understood that the at least two straight lines used for the distance error between the n straight lines after reconstruction and the at least two straight lines used for the angle error between the n straight lines after reconstruction may be the same or different.
重构后的n条直线之间的距离误差用于约束重构后的直线之间的距离。即距离误差可以作为一种距离约束。The distance error between the reconstructed n straight lines is used to constrain the distance between the reconstructed straight lines. That is, the distance error can be used as a distance constraint.
重构后的两条直线的距离误差是根据重构后的两条直线之间的距离与拍摄场景中的两条直线之间的距离之间的差值确定的。The distance error of the reconstructed two straight lines is determined according to the difference between the distance between the reconstructed two straight lines and the distance between the two straight lines in the shooting scene.
例如,拍摄场景中的两条直线之间的距离为b,重构后的两条直线的距离误差可以是根据重构后的两条直线之间的距离与b之间的差值确定的。For example, the distance between two straight lines in the shooting scene is b, and the distance error of the reconstructed two straight lines may be determined according to the difference between the distance between the reconstructed two straight lines and b.
示例性地,重构后的两条直线之间的距离可以根据其中一条直线上的一个或多个点和另一条直线之间的距离确定。Exemplarily, the distance between the reconstructed two straight lines may be determined according to the distance between one or more points on one of the straight lines and the other straight line.
该一个或多个点可以根据需要设置,示例性地,根据深度值确定该一个点或多个点。例如,选择其中一条直线上深度为0米的点和深度为30米的点。The one or more points can be set as required, for example, the one or more points are determined according to the depth value. For example, select a point on one of the lines at a depth of 0 meters and a point at a depth of 30 meters.
例如,将重构后的两条直线中的一条直线上的多个点与另一条直线之间的多个距离的平均值作为重构后的两条直线之间的距离。For example, the average value of multiple distances between multiple points on one of the reconstructed straight lines and the other straight line is taken as the distance between the reconstructed two straight lines.
以两个点为例,从重构后的两条直线中的直线1#上取两个点,分别计算这两个点到另一条直线2#的距离,将这两个点到另一条直线2#的距离的平均值作为重构后的两条直线之间的距离。或者,从重构后的两条直线中的直线1#上取一个点,计算该点到另一条直线2#的距离,从直线2#上取一个点,计算该点到直线1#的距离,将该两个距离的平均值作为重构后的两条直线之间的距离。Take two points as an example, take two points from straight line 1# of the two straight lines after reconstruction, calculate the distance from these two points to another straight line 2#, and connect these two points to another straight line The average value of the distance of 2# is used as the distance between the two straight lines after reconstruction. Or, take a point from straight line 1# among the two reconstructed straight lines, calculate the distance from this point to another straight line 2#, take a point from straight line 2#, and calculate the distance from this point to straight line 1# , taking the average of the two distances as the distance between the reconstructed two straight lines.
应理解,以上仅为示例,还可以通过其他方式确定重构后的两条直线之间的距离,本申请实施例对此不作限定。It should be understood that the above is only an example, and the distance between the reconstructed two straight lines may also be determined in other ways, which is not limited in this embodiment of the present application.
示例性地,若重构后的至少两条直线数量为2,则重构后的n条直线之间的距离误差可以为该重构后的两条直线的距离误差。Exemplarily, if the number of at least two reconstructed straight lines is 2, the distance error between the n reconstructed straight lines may be the distance error of the reconstructed two straight lines.
示例性地,若重构后的至少两条直线的数量大于2,则重构后的n条直线之间的距离误差可以为该重构后的至少两条直线的距离误差的总和,或者,该重构后的至少两条直线的距离误差的平均值。Exemplarily, if the number of the reconstructed at least two straight lines is greater than 2, the distance error between the reconstructed n straight lines may be the sum of the distance errors of the reconstructed at least two straight lines, or, The average value of distance errors of at least two straight lines after the reconstruction.
例如,重构后的至少两条直线包括重构后的直线1#、重构后的直线2#和重构后的直线3#。重构后的直线1#与重构后的直线2#的距离误差为距离误差1#,重构后的直线1#和重构后的直线3#的距离误差为距离误差2#。重构后的n条直线之间的距离误差可以为距离误差1#和距离误差2#的总和,或者距离误差可以为距离误差1#和距离误差2#的平均值。For example, the at least two reconstructed straight lines include reconstructed straight line 1#, reconstructed straight line 2# and reconstructed straight line 3#. The distance error between the reconstructed straight line 1# and the reconstructed straight line 2# is the distance error 1#, and the distance error between the reconstructed straight line 1# and the reconstructed straight line 3# is the distance error 2#. The distance error between the reconstructed n straight lines may be the sum of the distance error 1# and the distance error 2#, or the distance error may be the average value of the distance error 1# and the distance error 2#.
可选地,拍摄场景中的至少两条直线包括至少两条相互平行的直线。Optionally, the at least two straight lines in the shooting scene include at least two parallel straight lines.
在该情况下,角度误差包括平行误差。In this case, angular errors include parallel errors.
示例性地,重构误差包括平行误差和距离误差。Exemplarily, the reconstruction error includes a parallel error and a distance error.
平行误差用于约束重构后的直线之间的平行关系。即平行误差可以作为一种平行约束。The parallel error is used to constrain the parallel relationship between the reconstructed lines. That is, the parallel error can be used as a parallel constraint.
示例性地,两条相互平行的直线之间的角度可以为0。平行误差可以为该重构后的直线之间的角度。Exemplarily, the angle between two parallel straight lines may be zero. The parallel error may be the angle between the reconstructed straight lines.
示例性地,拍摄场景中的两条相互平行的直线之间的距离可以通过高精地图确定。Exemplarily, the distance between two parallel straight lines in the shooting scene may be determined through a high-precision map.
或者,拍摄场景中的两条相互平行的直线之间的距离也可以通过其他传感器测量得到。本申请实施例拍摄场景中的直线之间的距离的确定方法不做限定。Alternatively, the distance between two parallel straight lines in the shooting scene can also be measured by other sensors. The method for determining the distance between the straight lines in the shooting scene in the embodiment of the present application is not limited.
例如,拍摄场景中的至少两条直线为两条相互平行的直线。也就是说,采用拍摄场景中两条相互平行的直线之间的位置关系约束重构后的直线。重构误差可以包括重构后的该两条直线之间的平行误差和距离误差。For example, at least two straight lines in the shooting scene are two parallel straight lines. That is to say, the reconstructed straight line is constrained by the positional relationship between two parallel straight lines in the shooting scene. The reconstruction error may include a parallel error and a distance error between the two reconstructed straight lines.
根据平行误差和距离误差调整外参,能够保证外参的准确度。同时,本申请实施例的方案仅需要拍摄场景中的两条已知距离的平行线即可实现双目相机外参的标定,能够减少重构误差中的误差项,进而减少计算量,提高外参的调整速度,即提高外参的标定效率。此外,由于本申请实施例的方案仅需要拍摄场景中的两条已知距离的平行线即可实现双目相机外参的标定,无需精确定位出直线在三维空间中的位置,无需预设靶标,降低了对拍摄场景的要求,减少了标定成本。Adjusting the external parameters according to the parallel error and the distance error can ensure the accuracy of the external parameters. At the same time, the solution of the embodiment of the present application only needs two parallel lines with known distances in the shooting scene to realize the calibration of the extrinsic parameters of the binocular camera, which can reduce the error term in the reconstruction error, thereby reducing the amount of calculation and improving the external parameters. The adjustment speed of the parameters is improved, that is, the calibration efficiency of the external parameters is improved. In addition, since the solution of the embodiment of the present application only needs to shoot two parallel lines with known distances in the scene to realize the calibration of the external parameters of the binocular camera, there is no need to accurately locate the position of the line in the three-dimensional space, and there is no need to preset the target , which reduces the requirements for the shooting scene and reduces the calibration cost.
进一步地,拍摄场景中的至少两条直线包括至少两条相互垂直的直线。Further, the at least two straight lines in the shooting scene include at least two mutually perpendicular straight lines.
在该情况下,角度误差包括垂直误差。In this case, angular errors include vertical errors.
垂直误差用于约束重构后的直线之间的垂直关系。即垂直误差可以作为一种垂直约束。The vertical error is used to constrain the vertical relationship between the reconstructed lines. That is, the vertical error can be used as a vertical constraint.
具体地,垂直误差用于计算重构后的两条直线之间的角度与拍摄场景中的两条相互垂直的直线之间的角度之间的差异。Specifically, the vertical error is used to calculate the difference between the angle between the reconstructed two straight lines and the angle between the two mutually perpendicular straight lines in the shooting scene.
例如,两条相互垂直的直线之间的角度为90度,则重构后的两条直线之间的垂直误差项可以为重构后的两条直线之间的角度与90度之间的差值。For example, if the angle between two mutually perpendicular straight lines is 90 degrees, the vertical error term between the reconstructed two straight lines can be the difference between the angle between the reconstructed two straight lines and 90 degrees value.
如前所述,步骤S240可以为根据多帧双目图像的重构误差调整双目相机的外参。As mentioned above, step S240 may be to adjust the extrinsic parameters of the binocular camera according to the reconstruction errors of the multi-frame binocular images.
示例性地,步骤S240包括:根据多帧双目图像的重构误差之和调整双目相机的外参。Exemplarily, step S240 includes: adjusting the extrinsic parameters of the binocular camera according to the sum of reconstruction errors of multiple frames of binocular images.
或者,步骤S240包括:根据多帧双目图像的重构误差的平均值调整双目相机的外参。Alternatively, step S240 includes: adjusting the extrinsic parameters of the binocular camera according to the average value of the reconstruction errors of multiple frames of binocular images.
在该情况下,步骤S240可以理解为,以双目相机的外参作为变量,构建多帧双目图像的重构误差的方程,计算使多帧双目图像的重构误差最小的双目相机的外参,并将该外参作为双目相机的外参标定值。In this case, step S240 can be understood as, taking the external parameters of the binocular camera as a variable, constructing the equation of the reconstruction error of the multi-frame binocular image, and calculating the binocular camera that minimizes the reconstruction error of the multi-frame binocular image , and use this external parameter as the external parameter calibration value of the binocular camera.
各帧双目图像的重构误差可以根据前文中的描述计算,此处不再赘述。The reconstruction error of each frame of binocular images can be calculated according to the description above, and will not be repeated here.
由于直线检测可能存在一定的误差,本申请实施例中通过多帧双目图像的重构误差累积的结果调整双目相机的外参,能够减少直线检测的误差带来的影响,提高双目相机的外参标定的准确性。Since there may be certain errors in line detection, in the embodiment of the present application, the external parameters of the binocular camera are adjusted through the accumulation of reconstruction errors of multiple frames of binocular images, which can reduce the impact of line detection errors and improve the performance of the binocular camera. The accuracy of the external reference calibration.
可选地,方法200还包括:控制显示器显示双目相机外参的标定情况。Optionally, the method 200 further includes: controlling the display to display the calibration situation of the extrinsic parameters of the binocular camera.
示例性地,该显示器可以为车载显示器。Exemplarily, the display may be a vehicle-mounted display.
也就是说,车载显示器可以实时显示双目相机外参的标定情况。In other words, the on-board display can display the calibration of the external parameters of the binocular camera in real time.
这样,有利于使用户实时获知外参的标定情况,提高用户体验。In this way, it is beneficial for the user to know the calibration situation of the external parameters in real time and improve the user experience.
可选地,双目相机外参的标定情况包括以下至少一项:当前的标定进度、当前的重构误差的情况或重构后的p条直线。Optionally, the calibration conditions of the extrinsic parameters of the binocular camera include at least one of the following: current calibration progress, current reconstruction error conditions, or reconstructed p straight lines.
其中,重构后的p条直线是基于当前的双目相机的外参将第一图像的m条直线中的p 条直线和第二图像的m条直线中的p条直线重构到三维空间中得到的。1<p≤m,p为整数。Among them, the reconstructed p straight lines are based on the extrinsic parameters of the current binocular camera to reconstruct the p straight lines in the m straight lines of the first image and the p straight lines in the m straight lines of the second image to the three-dimensional space obtained from. 1<p≤m, p is an integer.
第一图像中的p条直线和第二图像中的p条直线为匹配的直线。将第一图像中的p条直线和第二图像中的p条直线投影到三维空间中。The p straight lines in the first image and the p straight lines in the second image are matched straight lines. Project the p lines in the first image and the p lines in the second image into three-dimensional space.
示例性地,当前的双目相机的外参可以是调整后的双目相机的外参。Exemplarily, the current extrinsic parameters of the binocular camera may be adjusted extrinsic parameters of the binocular camera.
或者,当前的双目相机的外参可以为调整过程中最优的双目相机的外参。调整过程中最优的双目相机的外参可以为调整过程中使得重构误差最小的外参。Alternatively, the current extrinsic parameters of the binocular camera may be the optimal extrinsic parameters of the binocular camera during the adjustment process. The optimal external parameter of the binocular camera during the adjustment process may be the external parameter that minimizes the reconstruction error during the adjustment process.
也就是说,通过重构直线的空间位置可视化标定结果。That is, the calibration results are visualized by reconstructing the spatial positions of the straight lines.
需要说明的是,在可视化标定结果的过程中所重构的直线与调整外参的过程中所重构的直线可以对应拍摄场景中的相同的直线,也可以对应拍摄场景中不同的直线,本申请实施例对此不作限定。It should be noted that the straight lines reconstructed in the process of visualizing the calibration results and the straight lines reconstructed in the process of adjusting the external parameters can correspond to the same straight line in the shooting scene, or they can correspond to different straight lines in the shooting scene. The embodiment of the application does not limit this.
现有的标定方案中,通常在标定完成后给出重投影误差,无法实时给出当前的标定情况。In the existing calibration scheme, the reprojection error is usually given after the calibration is completed, and the current calibration situation cannot be given in real time.
本申请实施例中,可视化标定结果,显示重构后的直线的三维空间位置,有利于用户直观感受当前的标定情况。In the embodiment of the present application, the calibration result is visualized and the three-dimensional space position of the reconstructed straight line is displayed, which is helpful for the user to intuitively experience the current calibration situation.
可选地,当前的标定进度包括以下至少一项:当前的双目相机的外参或当前的标定完成度。Optionally, the current calibration progress includes at least one of the following: current extrinsic parameters of the binocular camera or current calibration completion.
例如,当前的双目相机的外参可以以yaw、pitch和roll的形式表示。或者,当前的双目相机的外参可以以旋转矩阵的形式表示。本申请实施例对此不作限定。For example, the extrinsic parameters of the current binocular camera can be expressed in the form of yaw, pitch and roll. Alternatively, the extrinsic parameters of the current binocular camera can be represented in the form of a rotation matrix. This embodiment of the present application does not limit it.
示例性地,当前的标定完成度可以根据当前的重构误差确定。Exemplarily, the current calibration completion degree can be determined according to the current reconstruction error.
当前的重构误差指的是当前的双目相机的外参对应的重构误差的值,即基于当前的双目相机的外参得到的重构误差的值。例如,当前的双目相机的外参可以为调整过程中最优的双目相机的外参,则当前的重构误差即为调整过程中最小的重构误差。The current reconstruction error refers to the value of the reconstruction error corresponding to the extrinsic parameters of the current binocular camera, that is, the value of the reconstruction error obtained based on the extrinsic parameters of the current binocular camera. For example, the current extrinsic parameters of the binocular camera may be the extrinsic parameters of the optimal binocular camera during the adjustment process, and the current reconstruction error is the smallest reconstruction error during the adjustment process.
例如,当前的标定完成度可以根据当前的重构误差与误差阈值之间的差值确定。当前的标定完成度可以为该差值,或者为根据该差值确定的百分比。也就是说,当前的重构误差与误差阈值之间的差值越小,当前的标定完成度越高。For example, the current calibration completion degree can be determined according to the difference between the current reconstruction error and the error threshold. The current calibration completion degree may be the difference, or a percentage determined according to the difference. That is to say, the smaller the difference between the current reconstruction error and the error threshold, the higher the current calibration completion.
示例性地,当前的标定完成度可以根据当前的外参的搜索次数确定。Exemplarily, the current calibration completion degree can be determined according to the current search times of the external parameters.
如前所述,在步骤S240中,可以在双目相机的外参姿态空间中搜索使得重构误差最小的双目相机的外参。当前的标定完成度可以根据当前的搜索次数和搜索次数阈值确定。当前的搜索次数越接近搜索次数阈值,当前的标定完成度越高。As mentioned above, in step S240, the extrinsic parameters of the binocular camera that minimize the reconstruction error may be searched in the pose space of the extrinsic parameters of the binocular camera. The current calibration completion degree can be determined according to the current search times and the search times threshold. The closer the current search times are to the search times threshold, the higher the current calibration completion.
示例性地,当前的标定完成度可以根据当前已处理的双目图像的帧数确定。Exemplarily, the current calibration completion degree may be determined according to the number of currently processed binocular image frames.
如前所述,在步骤S240中,可以根据多帧双目图像的重构误差调整双目相机的外参。当前的标定完成度可以根据当前已处理的双目图像的帧数和需要处理的双目图像的总帧数确定。当前已处理的双目图像的帧数越接近需要处理的双目图像的总帧数,当前的标定完成度越高。例如,需要处理的双目图像的总帧数为50帧,当前已处理了该50帧图像中的30帧,则当前的标定完成度可以为60%。As mentioned above, in step S240, the extrinsic parameters of the binocular camera can be adjusted according to the reconstruction errors of multiple frames of binocular images. The current calibration completion degree can be determined according to the number of frames of currently processed binocular images and the total number of frames of binocular images that need to be processed. The closer the number of frames of currently processed binocular images is to the total number of frames of binocular images that need to be processed, the higher the current calibration completion. For example, if the total number of binocular images to be processed is 50 frames, and 30 frames of the 50 images have been processed, the current calibration completion degree may be 60%.
再如,当前的标定完成度可以为当前的重构误差。For another example, the current calibration completion degree may be the current reconstruction error.
可选地,当前的重构误差的情况可以包括以下至少一项:当前的重构误差、当前的距离误差或当前的角度误差。Optionally, the situation of the current reconstruction error may include at least one of the following: a current reconstruction error, a current distance error, or a current angle error.
也就是说,当前的重构误差的情况中能够显示当前用于标定的约束项。That is to say, the constraints currently used for calibration can be displayed in the context of the current reconstruction error.
例如,重构误差是根据角度误差和距离误差确定的,则当前的重构误差的情况可以包括当前的重构误差、当前的角度误差和当前的距离误差。当前的重构误差即为根据当前的角度误差和当前的距离误差确定的值。For example, the reconstruction error is determined according to the angle error and the distance error, and the current reconstruction error may include the current reconstruction error, the current angle error, and the current distance error. The current reconstruction error is a value determined according to the current angle error and the current distance error.
当前标定进度和当前的重构误差的情况能够定量的显示当前的标定情况。The current calibration progress and the current reconstruction error can quantitatively display the current calibration situation.
在本申请实施例的方案中能够实时显示当前的标定情况,有利于用户了解当前的标定进展,提高用户体验。In the solution of the embodiment of the present application, the current calibration situation can be displayed in real time, which is beneficial for the user to know the current calibration progress and improves the user experience.
应理解,以上仅为示例,在标定过程中还可以根据需要设置其他显示项,本申请实施例对此不做限定。It should be understood that the above is only an example, and other display items may also be set as required during the calibration process, which is not limited in this embodiment of the present application.
通过步骤S221能够获取拍摄场景中的多条直线在第一图像和第二图像中的投影。或者说,通过步骤S221能够获得拍摄场景中的直线与第一图像中的直线、第二图像中的直线的对应关系。Through step S221, projections of multiple straight lines in the shooting scene in the first image and the second image can be acquired. In other words, through step S221, the corresponding relationship between the straight lines in the shooting scene, the straight lines in the first image, and the straight lines in the second image can be obtained.
可选地,步骤S221包括步骤S2211至步骤S2213(图中未示出)。下面对步骤S2211至步骤S2213进行说明。为了描述简洁和清楚,在步骤S2211至步骤S2213中仅以一帧双目图像为例进行说明,在其他双目图像中也可以采用相同的方式提取直线,此处不再赘述。Optionally, step S221 includes step S2211 to step S2213 (not shown in the figure). Steps S2211 to S2213 will be described below. For the sake of brevity and clarity, only one frame of binocular image is used as an example for illustration in steps S2211 to S2213, and straight lines can also be extracted in the same way in other binocular images, which will not be repeated here.
S2211,对第一图像和第二图像分别进行实例分割,得到第一图像中的实例和第二图像中的实例。S2211. Perform instance segmentation on the first image and the second image respectively, to obtain instances in the first image and instances in the second image.
对图像进行实例分割,可以得到图像中的不同的实例。或者说,对图像进行实例分割,可以得到图像中像素所属的实例。Instance segmentation is performed on an image to obtain different instances in the image. In other words, the instance segmentation of the image can obtain the instance to which the pixel in the image belongs.
可选地,步骤S2211可以通过步骤11)和步骤12)实现。Optionally, step S2211 may be implemented through step 11) and step 12).
步骤11),对第一图像和第二图像分别进行语义分割,得到第一图像的语义分割结果和第二图像的语义分割结果。Step 11), performing semantic segmentation on the first image and the second image respectively, to obtain the semantic segmentation result of the first image and the semantic segmentation result of the second image.
图像的语义分割结果包括图像中的像素对应的语义信息。像素对应的语义信息也可以理解为像素所属的类别。The semantic segmentation result of the image includes the semantic information corresponding to the pixels in the image. The semantic information corresponding to a pixel can also be understood as the category to which the pixel belongs.
示例性地,可以通过语义分割网络对每张图像进行处理,得到语义分割结果。Exemplarily, each image may be processed through a semantic segmentation network to obtain a semantic segmentation result.
语义分割网络可以采用现有的神经网络模型,例如,deeplabv3等。The semantic segmentation network can adopt the existing neural network model, for example, deeplabv3 and so on.
语义分割网络可以是利用公开数据集训练得到的。具体的训练过程为现有技术,此处不再赘述。Semantic segmentation networks can be trained using public datasets. The specific training process is the prior art, and will not be repeated here.
将图像输入至语义分割网络中,可以得到图像中的像素对应的语义信息。Input the image into the semantic segmentation network, and the semantic information corresponding to the pixels in the image can be obtained.
示例性地,语义分割网络输出的类别可以包括水平物和竖直物。也就是说,语义分割网络能够区分图像中的像素属于水平物或竖直物。Exemplarily, the categories output by the semantic segmentation network may include horizontal objects and vertical objects. That is, a semantic segmentation network is able to distinguish whether a pixel in an image is horizontal or vertical.
可选地,第一图像的语义分割结果包括第一图像中的水平物或竖直物。第二图像的语义分割结果包括第二图像中的水平物或竖直物。Optionally, the semantic segmentation result of the first image includes horizontal objects or vertical objects in the first image. The semantic segmentation result of the second image includes horizontal objects or vertical objects in the second image.
或者说,对第一图像进行语义分割,得到第一图像中属于水平物的像素以及属于竖直物的像素。对第二图像进行语义分割,得到第二图像中属于水平物的像素以及属于竖直物的像素。In other words, semantic segmentation is performed on the first image to obtain pixels belonging to horizontal objects and pixels belonging to vertical objects in the first image. Perform semantic segmentation on the second image to obtain pixels belonging to horizontal objects and pixels belonging to vertical objects in the second image.
如前所述,本申请实施例中的双目相机可以为车载摄像头。在该情况下,水平物可以包括行道线。例如,行道线可以包括实线的行道线或虚线的行道线。竖直物可以包括杆状物或柱状物等。例如,杆状物可以包括路灯杆等。As mentioned above, the binocular camera in the embodiment of the present application may be a vehicle-mounted camera. In this case, the level may include road markings. For example, the road markings may include solid road markings or dashed road markings. Vertical objects may include rods or columns, among others. For example, poles may include street light poles and the like.
本申请实施例中,通过语义分割区分出图像中的水平物或竖直物,这样能够利用拍摄场景中的水平物或竖直物中的直线之间的几何约束,例如,垂直约束,实现双目相机外参的调整。若双目相机为车载摄像头,行道线或杆状物等在开放道路中较为常见,可以采用开放道路中的标定物实现双目相机外参的调整,无需预先布置标定场地,减少了成本。In the embodiment of the present application, the horizontal objects or vertical objects in the image are distinguished through semantic segmentation, so that the geometric constraints between the horizontal objects or the vertical objects in the shooting scene, such as vertical constraints, can be used to achieve dual Adjustment of the extrinsic parameters of the camera. If the binocular camera is a vehicle-mounted camera, road markings or poles are more common on open roads, the calibration objects on the open road can be used to adjust the external parameters of the binocular camera, and there is no need to pre-arrange the calibration site, which reduces costs.
应理解,上述语义分割结果仅为示例,语义信息可以根据标定物的类别设置。若标定场地中包括其他类型的标定物,则可以训练语义分割网络输出其他类型的语义信息,例如,还可以训练语义分割网络区分三角形物体或方形物体等,本申请实施例对此不做限定。It should be understood that the above semantic segmentation result is only an example, and the semantic information may be set according to the category of the calibration object. If the calibration site includes other types of calibration objects, the semantic segmentation network can be trained to output other types of semantic information. For example, the semantic segmentation network can also be trained to distinguish between triangular objects or square objects, which is not limited in this embodiment of the present application.
步骤12),根据第一图像的语义分割结果对第一图像进行实例分割,得到第一图像中的实例;根据第二图像的语义分割结果对第二图像进行实例分割,得到第二图像中的实例。Step 12), according to the semantic segmentation result of the first image, the first image is instance-segmented to obtain the instance in the first image; according to the semantic segmentation result of the second image, the second image is instance-segmented to obtain the instance in the second image instance.
根据语义分割结果对图像进行实例分割,指的是,在同一语义的像素中区分出不同的个体,即区分图像中的像素所属的实例。一个实例代表一个个体。Instance segmentation of an image according to the result of semantic segmentation refers to distinguishing different individuals among the pixels of the same semantics, that is, distinguishing the instance to which the pixel in the image belongs. An instance represents an individual.
也就是说,步骤12)中,输入可以为具有相同语义的所有像素的坐标,输出可以为像素所属的实例。That is to say, in step 12), the input can be the coordinates of all pixels with the same semantics, and the output can be the instance to which the pixel belongs.
示例性地,可以通过聚类方法在同一语义的像素中区分出不同的个体。例如,可以通过具有噪声的基于密度的聚类方法(density-based spatial clustering of applications with noise,Dbscan)等方式区分不同的个体。Exemplarily, a clustering method can be used to distinguish different individuals in pixels of the same semantics. For example, different individuals can be distinguished by density-based spatial clustering of applications with noise (Dbscan), etc.
具体地,在具有相同语义的两个像素点之间的距离小于或等于间隔阈值的情况下,该两个像素点属于同一个实例。Specifically, when the distance between two pixels with the same semantics is less than or equal to the interval threshold, the two pixels belong to the same instance.
应理解,还可以采用现有技术中的其他实例分割方法对图像进行实例分割,本申请实施例对实例分割的具体实现方式不做限定。It should be understood that other instance segmentation methods in the prior art may also be used to perform instance segmentation on the image, and the embodiment of the present application does not limit the specific implementation manner of the instance segmentation.
第一图像中的实例和第二图像中的实例之间的对应关系可以根据第一图像中的实例的位置和第二图像中的实例的位置确定。The correspondence between the instance in the first image and the instance in the second image may be determined according to the location of the instance in the first image and the location of the instance in the second image.
具有对应关系的实例对应拍摄场景中的同一标定物。或者说,图像中具有对应关系的实例为拍摄场景中同一标定物的投影。Instances with a corresponding relationship correspond to the same calibration object in the shooting scene. In other words, the instances with corresponding relationship in the image are projections of the same calibration object in the shooting scene.
图像中的实例的位置可以为图像中的实例的绝对位置,例如,实例在图像中的坐标。或者,图像中的实例的位置也可以为图像中的多个实例之间的相对位置。The position of the instance in the image may be the absolute position of the instance in the image, for example, the coordinates of the instance in the image. Alternatively, the position of an instance in the image may also be a relative position among multiple instances in the image.
第一图像和第二图像是双目相机的两个摄像头是对同一拍摄场景拍摄的图像,两张图像之间的差异较小。也就是说,同一标定物在两张图像中的投影的位置接近。因此,可以通过位置确定两张图像中的实例之间的对应关系。The first image and the second image are images taken by the two cameras of the binocular camera for the same shooting scene, and the difference between the two images is relatively small. That is to say, the positions of the projections of the same calibration object in the two images are close. Therefore, the correspondence between instances in two images can be determined by location.
例如,第一图像中多个竖直物中的最左侧的实例和第二图像中的多个竖直物中的最左侧的实例之间具有对应关系。For example, there is a corresponding relationship between the leftmost instance of the plurality of vertical objects in the first image and the leftmost instance of the plurality of vertical objects in the second image.
进一步地,可以对第一图像和第二图像分别进行实例标注,得到第一图像中的实例的标注信息和第二图像中的实例的标注信息。Further, instance annotation may be performed on the first image and the second image respectively, to obtain the annotation information of the instance in the first image and the annotation information of the instance in the second image.
对图像进行实例标注指的是对图像中的实例进行标注。图像中的不同的标注信息用于指示该图像中不同的实例。Instance labeling of images refers to labeling instances in images. Different annotation information in an image is used to indicate different instances in the image.
例如,标注信息可以为实例号。图像中不同的实例号用于指示该图像中不同的实例。For example, the annotation information may be an instance number. Different instance numbers in an image are used to indicate different instances in the image.
具体地,根据图像中的实例的位置对图像中的实例进行标注。Specifically, instances in the image are labeled according to their locations in the image.
例如,在第一图像和第二图像中,为相对位置相同的实例标注相同的实例号。For example, in the first image and the second image, instances with the same relative position are labeled with the same instance number.
这样,第一图像中的实例和第二图像中的实例之间的对应关系可以由实例的标注信息指示。例如,在第一图像和第二图像中实例号相同的实例之间具有对应关系。In this way, the corresponding relationship between the instance in the first image and the instance in the second image can be indicated by the annotation information of the instance. For example, there is a correspondence between instances with the same instance number in the first image and the second image.
对第一图像中的实例和第二图像中的实例进行匹配,可以得到第一图像中的实例和第二图像中的实例之间的对应关系。By matching the instance in the first image with the instance in the second image, the corresponding relationship between the instance in the first image and the instance in the second image can be obtained.
也就是说,对第一图像中的实例和第二图像中的实例进行匹配可以通过第一图像和第二图像分别进行实例标注实现。That is to say, matching the instance in the first image with the instance in the second image can be realized by respectively performing instance annotation on the first image and the second image.
应理解,第一图像中的实例和第二图像中的实例之间的对应关系可以为第一图像中的全部实例和第二图像中的全部实例之间的对应关系,或者,第一图像中的部分实例和第二图像中的部分实例之间的对应关系。It should be understood that the correspondence between the instances in the first image and the instances in the second image may be the correspondence between all the instances in the first image and all the instances in the second image, or, the correspondence in the first image The correspondence between the partial instances of and the partial instances in the second image.
S2212,分别在第一图像中的实例和第二图像中的实例中提取m条直线。S2212. Extract m straight lines from the instance in the first image and the instance in the second image respectively.
第一图像中的m条直线和第二图像中的m条直线之间的对应关系是根据第一图像中的实例和第二图像中的实例之间的对应关系确定的。The correspondence between the m straight lines in the first image and the m straight lines in the second image is determined according to the correspondence between the instances in the first image and the instances in the second image.
可选地,步骤S2212可以通过步骤21)至步骤23)实现。Optionally, step S2212 may be implemented through steps 21) to 23).
21)分别在第一图像和第二图像的实例中提取多条原始直线。21) Extract a plurality of original straight lines in the instances of the first image and the second image respectively.
示例性地,可以通过机器视觉的方法在实例中提取多条原始直线。Exemplarily, a plurality of original straight lines may be extracted in an instance by using a machine vision method.
例如,可以通过霍夫变换(hough transform)在实例中提取原始直线。For example, the original straight line can be extracted in the instance by the hough transform.
具体地,在图像中的各个实例的边缘,例如,在各个实例的左侧和右侧,设置小范围的感兴趣区域(region of interest,ROI),将ROI中的实例边缘像素点投影到直线参数空间,并通过设置参数空间点数的阈值,提取出实例中的直线,该直线即为实例中的原始直线。Specifically, on the edge of each instance in the image, for example, on the left and right sides of each instance, a small region of interest (region of interest, ROI) is set, and the instance edge pixels in the ROI are projected to a straight line parameter space, and by setting the threshold of the number of points in the parameter space, extract the straight line in the instance, which is the original straight line in the instance.
提取到的实例中的原始直线的实例信息用于指示该原始直线在该实例中的位置,例如,位于该实例的左侧或右侧。The extracted instance information of the original straight line in the instance is used to indicate the position of the original straight line in the instance, for example, on the left or right side of the instance.
应理解,原始直线在实例中的位置与ROI的设置方式有关,本申请实施例对此不做限定。It should be understood that the position of the original straight line in the example is related to the setting manner of the ROI, which is not limited in this embodiment of the present application.
22)将第一图像中的实例的同侧边缘的多条原始直线拟合为第一图像中该实例的该侧边缘的一条目标直线;将第二图像中的实例的同侧边缘的多条原始直线拟合为第二图像中该实例的该侧边缘的一条目标直线。22) multiple original straight lines of the same-side edge of the example in the first image are fitted as a target straight line of the side edge of the example in the first image; multiple straight lines of the same-side edge of the example in the second image The original line is fitted to a target line for the side edge of the instance in the second image.
一个实例的一侧边缘可能提取到多条原始直线,例如,在一个实例的左侧可能提取到多条原始直线。为了进一步提高标定所需的直线的准确性,可以将该实例的一侧边缘提取到的多条原始直线拟合为一条直线,该拟合后得到的直线即为该实例的该侧边缘的目标直线。Multiple original straight lines may be extracted from one edge of an instance, for example, multiple original straight lines may be extracted from the left side of an instance. In order to further improve the accuracy of the straight line required for calibration, multiple original straight lines extracted from one side edge of the instance can be fitted into a straight line, and the fitted straight line is the target of the side edge of the instance straight line.
步骤22)为可选步骤。在步骤S2212不包括步骤S22的情况下,也可以从实例的一侧边缘提取的多条原始直线中选择一条原始直线作为该实例的该侧边缘的目标直线。Step 22) is an optional step. In the case that step S2212 does not include step S22, an original straight line may also be selected from a plurality of original straight lines extracted from one side edge of the instance as the target straight line of the side edge of the instance.
若一个实例的一侧边缘仅包括一条原始直线,可以将该原始直线作为该实例的该侧边缘的目标直线。If one side edge of an instance only includes one original straight line, the original straight line can be used as the target straight line of the side edge of the instance.
示例性地,可以采用随机采样一致(random sample consensus,RANSAC)的方式进行拟合。Exemplarily, the fitting may be performed in a random sample consensus (RANSAC) manner.
例如,随机从一个实例同侧的多条原始直线的边界点中任意选择两个点,根据该两个点确定一条直线,该直线可以通过斜率k和截距b表示,例如,该直线可以表示为(k,b)。 确定位于该直线上的该多条原始直线的中点的数量。位于该直线上的该多条原始直线的中点的数量也可以理解为该直线通过的该多条原始直线的中点的数量。通过该多条原始直线的中点的数量最多的直线可以作为目标直线。For example, two points are randomly selected from the boundary points of multiple original straight lines on the same side of an instance, and a straight line is determined according to the two points. The straight line can be expressed by the slope k and the intercept b, for example, the straight line can be represented by is (k,b). A number of midpoints of the plurality of original straight lines lying on the straight line is determined. The number of midpoints of the multiple original straight lines located on the straight line can also be understood as the number of midpoints of the multiple original straight lines that the straight line passes through. The straight line passing through the midpoints of the plurality of original straight lines with the largest number may be used as the target straight line.
这样,对实例同侧的原始直线进行拟合,能够得到更准确的目标直线,利用目标直线对双目相机外参进行标定,有利于提高双目相机外参的标定结果的准确性。In this way, fitting the original straight line on the same side of the example can obtain a more accurate target straight line, and using the target straight line to calibrate the extrinsic parameters of the binocular camera will help improve the accuracy of the calibration results of the extrinsic parameters of the binocular camera.
进一步地,还可以对通过该多条原始直线的中点的数量最多的直线进行处理,得到目标直线。Further, the straight line passing through the midpoints of the plurality of original straight lines with the largest number may also be processed to obtain the target straight line.
为了便于描述,将该通过多条原始直线的中点的数量最多的直线称为中间直线。For ease of description, the straight line passing through the midpoints of the multiple original straight lines with the largest number is called an intermediate straight line.
遍历中间直线中的每一行,以中间直线中的每一行的点作为中心点,确定每一行的中心点左右的像素中像素梯度最大的像素点,以每一行中的像素梯度最大的像素点作为原始点,再次通过RANSAC的方式进行拟合,得到目标直线。Traverse each row in the middle straight line, take the point of each row in the middle straight line as the center point, determine the pixel point with the largest pixel gradient among the pixels around the center point of each row, and use the pixel point with the largest pixel gradient in each row as The original point is fitted again by RANSAC to obtain the target straight line.
例如,以中间直线中的每一行的点作为中心点,将每一行中的中心点左侧5个像素点和右侧5个像素点中确定像素梯度最大的点,将每一行中的像素梯度最大的像素点作为原始点,从原始点中任意选择两个点,根据该两个点确定一条直线,确定该直线通过的原始点的数量,通过原始点的数量最多的直线可以作为目标直线。For example, take the point of each row in the middle straight line as the center point, and determine the point with the largest pixel gradient among the 5 pixels on the left and 5 pixels on the right of the center point in each row, and the pixel gradient in each row The largest pixel point is used as the original point, two points are randomly selected from the original points, a straight line is determined according to the two points, and the number of original points passed by the straight line is determined. The straight line with the largest number of original points can be used as the target straight line.
边界处的像素梯度通常较大,搜索像素梯度最大的像素点,有利于找到更准确的边界,提高直线提取的准确度。The pixel gradient at the boundary is usually large, and searching for the pixel point with the largest pixel gradient is beneficial to find a more accurate boundary and improve the accuracy of line extraction.
提取到的实例的目标直线的实例信息用于指示该目标直线在该实例中的位置,例如,该目标直线位于该实例的左侧或右侧。The extracted instance information of the target straight line of the instance is used to indicate the position of the target straight line in the instance, for example, the target straight line is located on the left or right side of the instance.
应理解,以上仅以一个实例为例进行说明,在其他实例中可以采用相同的方式提取直线。It should be understood that the above is only an example for illustration, and in other examples the straight line can be extracted in the same manner.
S2213,对第一图像中的目标直线和第二图像中的目标直线进行匹配,得到第一图像中的m条直线和第二图像中的m条直线之间的对应关系。S2213. Match the target straight lines in the first image and the target straight lines in the second image to obtain correspondences between the m straight lines in the first image and the m straight lines in the second image.
即确定第一图像中的目标直线和第二图像中的目标直线的对应关系。具有对应关系的两条直线即为拍摄场景中的同一直线在第一图像和第二图像的投影。That is, the corresponding relationship between the target straight line in the first image and the target straight line in the second image is determined. The two straight lines having a corresponding relationship are projections of the same straight line in the shooting scene on the first image and the second image.
或者说,匹配拍摄场景中的同一直线在第一图像和第二图像中的投影。In other words, the projections of the same straight line in the shooting scene in the first image and the second image are matched.
应理解,步骤S2213中,可以对第一图像中的全部目标直线和第二图像中的全部目标直线进行匹配。或者,也可以对第一图像中的部分目标直线和第二图像中的目标直线进行匹配,本申请实施例对此不做限定。It should be understood that in step S2213, all target straight lines in the first image may be matched with all target straight lines in the second image. Alternatively, part of the target straight line in the first image may also be matched with the target straight line in the second image, which is not limited in this embodiment of the present application.
也就是说,本申请实施例中不需要确定第一图像中的每条目标直线与第二图像中的每条目标直线之间的对应关系。只要确定第一图像中的m条目标直线和第二图像中的m条目标直线之间的对应关系即可。That is to say, in the embodiment of the present application, it is not necessary to determine the corresponding relationship between each target straight line in the first image and each target straight line in the second image. It only needs to determine the corresponding relationship between the m target straight lines in the first image and the m target straight lines in the second image.
第一图像和第二图像中的m条直线即为第一图像中和第二图像中具有对应关系的目标直线。The m straight lines in the first image and the second image are the target straight lines having a corresponding relationship between the first image and the second image.
第一图像中的目标直线和第二图像中的目标直线之间的对应关系是根据目标直线的实例信息确定的。The corresponding relationship between the target straight line in the first image and the target straight line in the second image is determined according to the instance information of the target straight line.
具体地,第一图像中的目标直线和第二图像中的目标直线之间的对应关系是根据第一图像和第二图像中的实例的对应关系以及目标直线在实例中的位置确定的。Specifically, the corresponding relationship between the target straight line in the first image and the target straight line in the second image is determined according to the corresponding relationship between the instances in the first image and the second image and the position of the target straight line in the instance.
在第一图像和第二图像中具有对应关系的实例中位置相同的目标直线即为第一图像 和第二图像中具有对应关系的直线。In the example of the corresponding relationship between the first image and the second image, the target straight line with the same position is the straight line with the corresponding relationship between the first image and the second image.
例如,第一图像中的实例1#和第二图像中的实例1#是对应的。第一图像中的直线a的实例信息指示直线a位于第一图像中的实例1#的左侧,第二图像中的直线1#的实例新指示第二图像中的直线b位于第二图像中的实例1#的左侧,则第一图像中的直线a和第二图像中的直线b为具有对应关系的直线。For example, instance 1# in the first image corresponds to instance 1# in the second image. The instance information of line a in the first image indicates that line a is located on the left side of instance 1# in the first image, and the instance information of line 1# in the second image indicates that line b in the second image is located in the second image On the left side of Example 1#, the straight line a in the first image and the straight line b in the second image are straight lines with a corresponding relationship.
应理解,步骤S2211至步骤S2213仅为一种可能的直线匹配方式,还可以通过现有技术中的其他方式确定两张图像中的直线之间的对应关系,本申请实施例对此不做限定。It should be understood that steps S2211 to S2213 are only one possible line matching method, and other methods in the prior art can also be used to determine the correspondence between the lines in the two images, which is not limited in the embodiment of the present application .
本申请实施例中,通过两张图像中的实例之间的对应关系确定直线之间的对应关系,能够提高直线匹配的准确度,提高了外参标定的准确度,同时减少计算复杂度,提高了外参标定的效率。In the embodiment of the present application, the correspondence between the straight lines is determined through the correspondence between the instances in the two images, which can improve the accuracy of straight line matching, improve the accuracy of external parameter calibration, reduce computational complexity, and improve The efficiency of external reference calibration is improved.
类似地,图像中的直线与拍摄场景中的直线之间的对应关系可以通过拍摄场景中的直线之间的相对位置以及图像中的直线之间的相对位置确定,此处不再赘述。Similarly, the corresponding relationship between the straight lines in the image and the straight lines in the shooting scene can be determined by the relative positions between the straight lines in the shooting scene and the relative positions between the straight lines in the image, which will not be repeated here.
图4示出了本申请实施例提供的另一种双目相机外参的标定方法400。方法400可以视为方法400的一种具体实现方式。因此,方法400中未详细描述的内容可以参见上文方法200,为了描述简洁,后文中做适当省略的描述。FIG. 4 shows another method 400 for calibrating extrinsic parameters of a binocular camera provided by an embodiment of the present application. The method 400 may be regarded as a specific implementation manner of the method 400 . Therefore, for the content not described in detail in the method 400, reference may be made to the method 200 above, and for the sake of brevity, descriptions are appropriately omitted in the following.
如前所述,本申请实施例提供的双目相机外参标定的方法可以适用于车载摄像头系统。例如,本申请实施例中的双目相机为车载摄像头,双目相机所在的车辆可以处于静止状态,也可以处于移动状态。方法400中以双目相机为车载摄像头为例对双目相机外参的标定方法进行说明,不对本申请实施例的应用场景构成限定。As mentioned above, the method for calibrating the extrinsic parameters of the binocular camera provided in the embodiment of the present application can be applied to the vehicle camera system. For example, the binocular camera in the embodiment of the present application is a vehicle-mounted camera, and the vehicle where the binocular camera is located may be in a stationary state or in a moving state. In the method 400, the method for calibrating the extrinsic parameters of the binocular camera is described by taking the binocular camera as a vehicle-mounted camera as an example, which does not limit the application scenario of the embodiment of the present application.
车辆驶入标定场地后,执行方法400以完成双目相机外参的标定,利用标定值更新双目相机的外参,为上层业务提供高精度的外参,以提高上层业务的准确性,进而提高了自动驾驶的性能。图5示出了一种标定场地的示意图。图5的标定场地中设置有行道线和竖直杆。行道线或竖直杆均可以作为双目相机的标定物。After the vehicle enters the calibration site, execute method 400 to complete the calibration of the external parameters of the binocular camera, update the external parameters of the binocular camera with the calibration value, provide high-precision external parameters for the upper-level business, and improve the accuracy of the upper-level business, and then Improved autopilot performance. Fig. 5 shows a schematic diagram of a calibration site. The calibration field in Fig. 5 is provided with roadway lines and vertical poles. Street lines or vertical poles can be used as calibration objects for binocular cameras.
方法400包括步骤S410至步骤S440。下面对步骤S410至步骤S440进行说明。The method 400 includes step S410 to step S440. Steps S410 to S440 will be described below.
S410,获取双目图像。S410, acquiring binocular images.
具体地,获取双目相机拍摄的至少一帧双目图像。双目图像中的左目图像是由双目相机中的左摄像头拍摄的,该双目图像中的右目图像是由双目相机中的右摄像头拍摄的。Specifically, at least one frame of binocular images captured by a binocular camera is acquired. The left-eye image in the binocular image is captured by the left camera in the binocular camera, and the right-eye image in the binocular image is captured by the right camera in the binocular camera.
示例性地,该至少一帧双目图像可以是车辆在标定场地行驶过程中拍摄的多帧双目图像。Exemplarily, the at least one frame of binocular images may be multiple frames of binocular images captured by the vehicle while driving on the calibration site.
车辆行驶一小段距离即可获取多帧双目图像,完成双目相机外参的标定。The vehicle can acquire multiple frames of binocular images after driving a short distance, and complete the calibration of the extrinsic parameters of the binocular camera.
步骤S410与步骤S210对应,具体描述参见步骤S210,此处不再赘述。Step S410 corresponds to step S210, and for a specific description, refer to step S210, which will not be repeated here.
S420,分别从左目图像和右目图像中提取m条直线,m为大于1的整数。S420. Extract m straight lines from the left-eye image and the right-eye image respectively, where m is an integer greater than 1.
左目图像的m条直线和右目图像的m条直线之间具有对应关系。There is a corresponding relationship between the m straight lines of the left-eye image and the m straight lines of the right-eye image.
示例性地,步骤S420包括步骤S421至步骤S425。Exemplarily, step S420 includes step S421 to step S425.
S421,对双目图像进行语义分割,得到双目图像的语义分割结果。S421. Perform semantic segmentation on the binocular image to obtain a semantic segmentation result of the binocular image.
具体地,对左目图像和右目图像分别进行语义分割,得到左目图像的语义分割结果和右目图像的语义分割结果。Specifically, semantic segmentation is performed on the left-eye image and the right-eye image respectively, and a semantic segmentation result of the left-eye image and a semantic segmentation result of the right-eye image are obtained.
示例性地,利用语义分割网络对左目图像和右目图像分别进行处理,得到左目图像的语义分割结果和右目图像的语义分割结果。Exemplarily, the left-eye image and the right-eye image are respectively processed by using the semantic segmentation network to obtain a semantic segmentation result of the left-eye image and a semantic segmentation result of the right-eye image.
例如,语义分割网络的输出结果包括两类语义:行道线或竖直物。也就是说,该语义分割网络能够区分图像中的物体的像素点属于行道线或竖直物。图6的(a)示出了左目图像的语义分割结果,图6的(b)示出了右目图像的语义分割结果。如图6所示,通过语义分割区分出左目图像和右目图像中的竖直物和行道线。For example, the output of a semantic segmentation network includes two types of semantics: road lines or vertical objects. That is to say, the semantic segmentation network can distinguish whether the pixel points of objects in the image belong to road lines or vertical objects. Fig. 6(a) shows the semantic segmentation result of the left-eye image, and Fig. 6(b) shows the semantic segmentation result of the right-eye image. As shown in Figure 6, the vertical objects and road lines in the left-eye image and right-eye image are distinguished through semantic segmentation.
步骤S421与步骤S2211中的步骤11)对应,具体描述可以参照前文中的描述,此处不再赘述。Step S421 corresponds to step 11) in step S2211. For specific description, please refer to the previous description, which will not be repeated here.
S422,根据语义分割结果进行实例标注。S422. Perform instance labeling according to the semantic segmentation result.
具体地,根据左目图像的语义分割结果对左目图像进行实例标注,得到左目图像中的实例的标注信息。根据右目图像的语义分割结果对右目图像进行实例标注,得到右目图像中的实例的标注信息。Specifically, instance annotation is performed on the left-eye image according to the semantic segmentation result of the left-eye image, and the annotation information of the instances in the left-eye image is obtained. According to the semantic segmentation result of the right-eye image, instance annotation is performed on the right-eye image, and the annotation information of the instance in the right-eye image is obtained.
具体地,根据第一图像的语义分割结果对第一图像进行实例分割,得到第一图像中的实例;根据第一图像中的实例的位置对第一图像中的实例进行标注,得到实例的标注信息。Specifically, instance segmentation is performed on the first image according to the semantic segmentation result of the first image to obtain the instance in the first image; an instance in the first image is annotated according to the position of the instance in the first image to obtain the annotation of the instance information.
根据第二图像的语义分割结果对第二图像进行实例分割,得到第二图像中的实例;根据第二图像中的实例的位置对第二图像中的实例进行标注,得到实例的标注信息。The second image is instance-segmented according to the semantic segmentation result of the second image to obtain instances in the second image; the instances in the second image are annotated according to the positions of the instances in the second image to obtain annotation information of the instances.
图7的(a)示出了左目图像中的实例的标注信息,图7的(b)示出了右目图像中的实例的标注信息。如图7所示,实例的标注信息包括:左1柱、左2柱、右1柱、右2柱、行道线1、行道线2、行道线3、行道线4和行道线5。在左目图像和右目图像中具有对应关系的实例的标注信息是相同的。也就是说,左目图像中的实例的标注信息和右目图像中的实例的标注信息用于指示左目图像中的实例和右目图像中的实例之间的对应关系。(a) of FIG. 7 shows the annotation information of the instance in the left-eye image, and (b) of FIG. 7 shows the annotation information of the instance in the right-eye image. As shown in FIG. 7 , the labeled information of the example includes: left 1 pillar, left 2 pillar, right 1 pillar, right 2 pillar, lane line 1, lane line 2, lane line 3, lane line 4 and lane line 5. The annotation information of instances with corresponding relations in the left-eye image and the right-eye image is the same. That is to say, the annotation information of the instance in the left-eye image and the annotation information of the instance in the right-eye image are used to indicate the correspondence between the instance in the left-eye image and the instance in the right-eye image.
如图7所示,步骤S422中仅对部分实例进行了标注,在实际应用中,可以根据需要标注更多或更少的实例。As shown in FIG. 7 , only some instances are marked in step S422 , and more or fewer instances can be marked as required in practical applications.
步骤S422与步骤S2211中的步骤12)对应,具体描述可以参照前文中的描述,此处不再赘述。Step S422 corresponds to step 12) in step S2211. For specific description, please refer to the previous description, which will not be repeated here.
S423,在双目图像的实例中提取多条原始直线。S423. Extract a plurality of original straight lines in the instance of the binocular image.
具体地,分别在左目图像和右目图像的实例中提取多条原始直线。Specifically, a plurality of original straight lines are extracted from the instances of the left-eye image and the right-eye image respectively.
在步骤S423中可以对步骤S422中被标注的实例进行直线提取。或者说,对具有标注信息的实例进行直线提取。In step S423, straight line extraction may be performed on the instances marked in step S422. In other words, line extraction is performed on instances with annotation information.
步骤S423与步骤S2212中的步骤21)对应,具体描述可以参照前文中的描述,此处不再赘述。Step S423 corresponds to step 21) in step S2212. For specific description, please refer to the previous description, which will not be repeated here.
S424,对多条原始直线进行直线拟合,得到目标直线。S424. Perform straight line fitting on multiple original straight lines to obtain a target straight line.
具体地,将左目图像中的实例的同侧边缘的多条原始直线拟合为左目图像中该实例的该侧边缘的一条目标直线。将右目图像中的实例的同侧边缘的多条原始直线拟合为右目图像中该实例的该侧边缘的一条目标直线。Specifically, multiple original straight lines on the same-side edge of the instance in the left-eye image are fitted to a target straight line on the side edge of the instance in the left-eye image. Fit multiple original straight lines on the same side edge of the instance in the right-eye image to a target straight line on the side edge of the instance in the right-eye image.
图8的(a)示出了左目图像中的目标直线,图8的(b)示出了右目图像中的目标直线。(a) of FIG. 8 shows the target straight line in the left-eye image, and FIG. 8( b ) shows the target straight line in the right-eye image.
如图8所示,对于一个实例,可以提取该实例两侧边缘的直线,也可以仅提取该实例一侧边缘的直线,本申请对此不作限定。As shown in FIG. 8 , for an example, straight lines on both sides of the example may be extracted, or only straight lines on one side of the example may be extracted, which is not limited in the present application.
步骤S424与步骤S2212中的步骤22)对应,具体描述可以参照前文中的描述,此处不再赘述。Step S424 corresponds to step 22) in step S2212, and the specific description may refer to the previous description, which will not be repeated here.
S425,对左目图像中的目标直线和右目图像中的目标直线进行匹配,得到左目图像中的m条直线和右目图像中的m条直线之间的对应关系。S425. Match the target straight line in the left-eye image with the target straight line in the right-eye image to obtain the correspondence between the m straight lines in the left-eye image and the m straight lines in the right-eye image.
或者说,得到拍摄场景中的m条直线在左目图像和右目图像中的投影。In other words, the projections of the m straight lines in the shooting scene on the left-eye image and the right-eye image are obtained.
例如,如图8所示,m可以为12。即得到图8中的(a)中的12条直线与图8的(b)中的12条直线之间的对应关系。For example, as shown in FIG. 8, m may be 12. That is, the corresponding relationship between the 12 straight lines in (a) in FIG. 8 and the 12 straight lines in (b) in FIG. 8 is obtained.
步骤S425与步骤S2213对应,具体描述可以参照前文中的描述,此处不再赘述。Step S425 corresponds to step S2213, and the specific description may refer to the previous description, which will not be repeated here.
S430,基于双目相机的外参将左目图像中的n条直线和右目图像中的n条直线重构到三维空间中,得到重构后的n条直线。左目图像的n条直线和右目图像中的n条直线为拍摄场景中的n条直线的投影。S430. Reconstruct the n straight lines in the left-eye image and the n straight lines in the right-eye image into a three-dimensional space based on the external parameters of the binocular camera, and obtain the reconstructed n straight lines. The n straight lines in the left-eye image and the n straight lines in the right-eye image are projections of the n straight lines in the shooting scene.
例如,如图9所示,n为12。将图8中左目图像和右目图像中的直线重构到空间中,得到重构后的12条直线的空间位置。For example, n is 12 as shown in FIG. 9 . The straight lines in the left-eye image and right-eye image in Figure 8 are reconstructed into space, and the spatial positions of the reconstructed 12 straight lines are obtained.
S440,根据重构误差调整双目相机的外参。S440. Adjust extrinsic parameters of the binocular camera according to the reconstruction error.
重构误差是根据重构后的n条直线之间的位置关系与拍摄场景中的n条直线之间的位置关系确定的。The reconstruction error is determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene.
示例性地,重构误差是根据重构后的n条直线中的两条直线之间的位置关系和拍摄场景中的n条直线中的两条直线之间的位置关系确定的。Exemplarily, the reconstruction error is determined according to the positional relationship between two straight lines in the reconstructed n straight lines and the positional relationship between two straight lines in the n straight lines in the shooting scene.
如前所述,重构误差包括以下至少一项:角度误差或距离误差。As mentioned above, the reconstruction error includes at least one of the following: angle error or distance error.
下面以重构后的水平线l 1和水平线l 4为例,对重构误差进行说明。 The reconstruction error will be described below by taking the reconstructed horizontal line l1 and horizontal line l4 as examples.
重构误差满足如下公式:The reconstruction error satisfies the following formula:
Figure PCTCN2021106747-appb-000001
Figure PCTCN2021106747-appb-000001
其中,f i(yaw,pitch,roll)表示基于双目相机的外参得到的第i帧双目图像的重构误差,yaw,pitch,roll为双目相机的外参的欧拉角表示形式。
Figure PCTCN2021106747-appb-000002
为重构后的水平线l 1和水平线l 4之间的角度,用于计算重构后的水平线l 1和水平线l 4之间的角度误差。|dis(l 1,l 4)-d1|用于计算重构后的水平线l 1和水平线l 4之间的距离误差,其中,dis()用于计算重构后的两条直线之间的距离,例如,dis(l 1,l 4)用于计算重构后的水平线l 1和水平线l 4之间的距离,d1表示拍摄场景中的水平线l 1和水平线l 4之间的距离,即水平线l 1和水平线l 4之间的实际距离。
Among them, f i (yaw, pitch, roll) represents the reconstruction error of the i-th binocular image obtained based on the external parameters of the binocular camera, and yaw, pitch, roll is the Euler angle representation of the external parameters of the binocular camera .
Figure PCTCN2021106747-appb-000002
is the angle between the reconstructed horizontal line l1 and the horizontal line l4 , and is used to calculate the angle error between the reconstructed horizontal line l1 and the horizontal line l4 . |dis(l 1 ,l 4 )-d1|is used to calculate the distance error between the reconstructed horizontal line l 1 and the horizontal line l 4 , where dis() is used to calculate the distance between the reconstructed two straight lines Distance, for example, dis(l 1 ,l 4 ) is used to calculate the distance between the reconstructed horizontal line l 1 and the horizontal line l 4 , d1 represents the distance between the horizontal line l 1 and the horizontal line l 4 in the shooting scene, namely Actual distance between horizontal line l 1 and horizontal line l 4 .
应理解,上述公式中仅以拍摄场景中的水平线l 1和水平线l 4为例对重构误差进行说明,还可以根据拍摄场景中的其他平行线计算重构误差,例如,根据垂线L1和垂线L5计算重构误差。其他平行线之间的重构误差也可以采用上述公式,只要将上述公式中的直线替换为相应的直线即可。 It should be understood that the above formula only takes the horizontal line l1 and the horizontal line l4 in the shooting scene as an example to illustrate the reconstruction error, and the reconstruction error can also be calculated according to other parallel lines in the shooting scene, for example, according to the vertical line L1 and Vertical line L5 calculates the reconstruction error. The above formula can also be used for the reconstruction error between other parallel lines, as long as the straight line in the above formula is replaced with the corresponding straight line.
进一步地,重构误差也可以是根据重构后的n条直线中q条直线之间的位置关系和拍摄场景中的n条直线中的q条直线之间的位置关系确定的。q为大于2且小于等于n的整数。Further, the reconstruction error may also be determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines and the positional relationship between the n straight lines in the shooting scene. q is an integer greater than 2 and less than or equal to n.
下面以图9中的12条直线为例,即q为12,对重构误差进行说明。The reconstruction error will be described below by taking the 12 straight lines in FIG. 9 as an example, that is, q is 12.
重构误差满足如下公式:The reconstruction error satisfies the following formula:
Figure PCTCN2021106747-appb-000003
Figure PCTCN2021106747-appb-000003
其中,第一项用于计算重构后的水平线之间的角度误差。具体地,在上述公式中,4条重构后的水平线之间的角度误差为各水平线,即重构后的l 2、l 3、l 4与重构后的l 1之间的角度误差之和。应理解,上述公式中的第一项仅为示例,重构后的水平线之间的角度误差还可以通过其他方式计算,例如,该4条重构后的水平线之间的角度误差还可以为重构后的各水平线与重构后的l 1之间的角度误差的平均值。再如,该4条重构后的水平线之间的角度误差还可以为重构后的各水平线与重构后的l 2之间的角度误差之和。本申请对重构后的水平线之间的角度误差的具体计算方法不做限定,只要重构后的水平线之间的角度误差能够约束重构的水平线之间的平行关系即可。 Among them, the first term is used to calculate the angular error between the reconstructed horizontal lines. Specifically, in the above formula, the angle error between the four reconstructed horizontal lines is equal to the difference between the angle errors between the reconstructed l 2 , l 3 , l 4 and the reconstructed l 1 and. It should be understood that the first item in the above formula is only an example, and the angle error between the reconstructed horizontal lines can also be calculated in other ways, for example, the angle error between the four reconstructed horizontal lines can also be re- The average value of the angle errors between the reconstructed horizontal lines and the reconstructed l 1 . For another example, the angle errors between the four reconstructed horizontal lines may also be the sum of the angle errors between the reconstructed horizontal lines and the reconstructed l2 . The present application does not limit the specific calculation method of the angular error between the reconstructed horizontal lines, as long as the angular error between the reconstructed horizontal lines can constrain the parallel relationship between the reconstructed horizontal lines.
第二项用于计算重构后的垂线之间的角度误差。具体地,在上述公式中,8条重构后的垂线之间的角度误差为各垂线,即重构后的L 2、L 3、L 4、L 5、L 6、L 7和重构后的L 1之间的角度误差之和。应理解,上述公式中的第二项仅为示例,重构后的垂线之间的角度误差还可以通过其他方式计算,例如,该4条重构后的垂线之间的角度误差还可以为重构后的各垂线与重构后的L 1之间的角度误差的平均值。再如,该4条重构后的垂线之间的角度误差还可以为重构后的各垂线与重构后的L 2之间的角度误差之和。本申请对重构后的垂线之间的角度误差的具体计算方法不做限定,只要重构后的垂线之间的角度误差能够约束重构的垂线之间的平行关系即可。 The second term is used to calculate the angular error between the reconstructed perpendiculars. Specifically, in the above formula, the angle error between the 8 reconstructed vertical lines is each vertical line, that is, the reconstructed L 2 , L 3 , L 4 , L 5 , L 6 , L 7 and the reconstructed The sum of the angular errors between L and 1 after construction. It should be understood that the second item in the above formula is only an example, and the angle error between the reconstructed vertical lines can also be calculated in other ways, for example, the angle error between the four reconstructed vertical lines can also be is the average value of the angle errors between the reconstructed vertical lines and the reconstructed L1. For another example, the angle errors between the four reconstructed vertical lines may also be the sum of the angle errors between the reconstructed vertical lines and the reconstructed L 2 . The present application does not limit the specific calculation method of the angle error between the reconstructed perpendicular lines, as long as the angle error between the reconstructed perpendicular lines can constrain the parallel relationship between the reconstructed perpendicular lines.
第三项用于计算重构后的垂线和水平线之间的角度误差。具体地,在上述公式中,重构后的垂线和水平线之间的角度误差为重构后的水平线l 1和重构后的L 1之间的角度误差。应理解,上述公式中的第三项仅为示例,重构后的垂线和水平线之间的角度误差还可以通过其他方式计算,例如,重构后的垂线和水平线之间的角度误差还可以为其他重构后的垂线和水平线之间的角度误差。再如,重构后的垂线和水平线之间的角度误差还可以为重构后的各垂线与各水平线之间的角度误差之和。再如,重构后的垂线和水平线之间的角度误差还可以为重构后的各垂线与各水平线之间的角度误差的平均值。本申请对重构后的垂线和水平线之间的角度误差的具体计算方法不做限定,只要重构后的垂线和水平线之间的角度误差能够约束重构的垂线和水平线之间的垂直关系即可。 The third term is used to calculate the angular error between the reconstructed vertical and horizontal lines. Specifically, in the above formula, the angle error between the reconstructed vertical line and the horizontal line is the angle error between the reconstructed horizontal line l 1 and the reconstructed L 1 . It should be understood that the third item in the above formula is only an example, and the angle error between the reconstructed vertical line and the horizontal line can also be calculated in other ways, for example, the angle error between the reconstructed vertical line and the horizontal line can also be calculated by Can be the angle error between the vertical and horizontal lines after other reconstructions. For another example, the angle error between the reconstructed vertical line and the horizontal line may also be the sum of the angle errors between each vertical line and each horizontal line after reconstruction. For another example, the reconstructed angle error between the vertical line and the horizontal line may also be an average value of the angle errors between the reconstructed vertical lines and each horizontal line. This application does not limit the specific calculation method of the angle error between the reconstructed vertical line and the horizontal line, as long as the angle error between the reconstructed vertical line and the horizontal line can constrain the angle error between the reconstructed vertical line and the horizontal line vertical relationship.
第四项用于计算重构后的水平线之间的距离误差。具体地,在上述公式中,重构后的水平线之间的距离误差为重构后的水平线l 1和重构后的l 4之间的距离误差。应理解,上述公式中的第四项仅为示例,重构后的水平线之间的距离误差还可以通过其他方式计算,例如,重构后的水平线之间的距离误差还可以为其他重构后的水平线之间的距离误差。再如,重构后的水平线之间的距离误差还可以为重构后的各水平线之间的距离误差之和。再如,重构后的水平线之间的距离误差还可以为重构后的各水平线之间的距离误差的平均值。本申请对重构后的水平线之间的距离误差的具体计算方法不做限定,只要重构后的水平线之间的距离误差能够约束重构的水平线之间的距离即可。 The fourth term is used to calculate the distance error between the reconstructed horizontal lines. Specifically, in the above formula, the distance error between the reconstructed horizontal lines is the distance error between the reconstructed horizontal line l 1 and the reconstructed l 4 . It should be understood that the fourth item in the above formula is only an example, and the distance error between the reconstructed horizontal lines can also be calculated in other ways, for example, the distance error between the reconstructed horizontal lines can also be other reconstructed The distance error between the horizontal lines. For another example, the distance error between the reconstructed horizontal lines may also be the sum of the distance errors between the reconstructed horizontal lines. For another example, the distance error between the reconstructed horizontal lines may also be an average value of the distance errors between the reconstructed horizontal lines. The present application does not limit the specific calculation method of the distance error between the reconstructed horizontal lines, as long as the distance error between the reconstructed horizontal lines can constrain the distance between the reconstructed horizontal lines.
第五项用于计算重构后的垂线之间的距离误差。具体地,在上述公式中,重构后的垂线之间的距离误差为重构后的垂线L 1和重构后的L 3之间的距离误差。其中,d2表示拍摄场景中的L 1和L 3之间的距离。应理解,上述公式中的第五项仅为示例,重构后的垂线之 间的距离误差还可以通过其他方式计算,例如,重构后的垂线之间的距离误差还可以为其他重构后的垂线之间的距离误差。再如,重构后的垂线之间的距离误差还可以为重构后的各垂线之间的距离误差之和。再如,重构后的垂线之间的距离误差还可以为重构后的各垂线之间的距离误差的平均值。本申请对重构后的垂线之间的距离误差的具体计算方法不做限定,只要重构后的垂线之间的距离误差能够约束重构的垂线之间的距离即可。 The fifth term is used to calculate the distance error between the reconstructed vertical lines. Specifically, in the above formula, the distance error between the reconstructed vertical lines is the distance error between the reconstructed vertical line L 1 and the reconstructed L 3 . Among them, d2 represents the distance between L1 and L3 in the shooting scene. It should be understood that the fifth item in the above formula is only an example, and the distance error between the reconstructed vertical lines can also be calculated in other ways, for example, the distance error between the reconstructed vertical lines can also be calculated by other The distance error between the constructed vertical lines. For another example, the distance error between the reconstructed vertical lines may also be the sum of the distance errors between the reconstructed vertical lines. For another example, the distance error between the reconstructed vertical lines may also be an average value of the distance errors between the reconstructed vertical lines. The present application does not limit the specific calculation method of the distance error between the reconstructed vertical lines, as long as the distance error between the reconstructed vertical lines can constrain the distance between the reconstructed vertical lines.
在步骤S440中,可以根据一帧或多帧双目图像的重构误差调整双目相机的外参。In step S440, the extrinsic parameters of the binocular camera may be adjusted according to the reconstruction error of one or more frames of binocular images.
在本申请实施例中,对多帧双目图像的重构误差进行累积,并根据累积后的重构误差调整双目相机的外参,能够减少直线提取的准确度对标定结果的影响,提高标定结果的准确度。In the embodiment of the present application, the reconstruction errors of multiple frames of binocular images are accumulated, and the external parameters of the binocular cameras are adjusted according to the accumulated reconstruction errors, which can reduce the influence of the accuracy of straight line extraction on the calibration results and improve Accuracy of calibration results.
也就是说,以减少多帧双目图像的重构误差为目标调整双目相机的外参。That is to say, the extrinsic parameters of the binocular camera are adjusted with the goal of reducing the reconstruction error of multi-frame binocular images.
例如,将使得多帧双目图像的重构误差最小的双目相机的外参作为双目相机外参的标定值。For example, the extrinsic parameters of the binocular camera that minimize the reconstruction error of multiple frames of binocular images are used as the calibration value of the extrinsic parameters of the binocular camera.
示例性地,多帧双目图像的重构误差最小可以为多帧双目图像的重构误差的总和最小。Exemplarily, the minimum reconstruction error of multiple frames of binocular images may be the minimum sum of reconstruction errors of multiple frames of binocular images.
例如,多帧双目图像的重构误差满足如下公式:For example, the reconstruction error of multi-frame binocular images satisfies the following formula:
F(yaw,pitch,roll)=∑ if i(yaw,pitch,roll); F(yaw, pitch, roll) = ∑ i f i (yaw, pitch, roll);
F(yaw,pitch,roll)表示多帧双目图像的重构误差。F(yaw,pitch,roll) represents the reconstruction error of multi-frame binocular images.
可替换地,多帧双目图像的重构误差最小也可以为多帧双目图像的重构误差的平均值最小。Alternatively, the smallest reconstruction error of multiple frames of binocular images may also be the smallest average value of reconstruction errors of multiple frames of binocular images.
在得到双目相机的外参标定值后,可以更新系统中的双目相机的外参。例如,提供给自动驾驶系统的其他功能模块。After obtaining the external parameter calibration value of the binocular camera, the external parameter of the binocular camera in the system can be updated. For example, other functional modules provided to the automatic driving system.
S450,控制车载显示器显示双目相机外参的标定情况。S450, controlling the vehicle-mounted display to display the calibration of the external parameters of the binocular camera.
示例性地,双目相机外参的标定情况包括当前的标定进度、当前的重构误差的情况或重构后的p条直线。Exemplarily, the calibration situation of the extrinsic parameters of the binocular camera includes the current calibration progress, the current reconstruction error situation or the reconstructed p straight lines.
图10中示出了一种双目相机外参的标定情况的示意图。如图10所示,双目相机外参的标定情况包括当前的标定进度、当前的重构误差的情况或重构后的12条直线。FIG. 10 shows a schematic diagram of calibration of extrinsic parameters of a binocular camera. As shown in Figure 10, the calibration of the external parameters of the binocular camera includes the current calibration progress, the current reconstruction error, or the 12 reconstructed straight lines.
当前的标定进度包括当前的标定完成度和当前的双目相机的外参。The current calibration progress includes the current calibration completion and the current extrinsic parameters of the binocular camera.
应理解,图10中的外参以欧拉角的形式表示仅为示例,还可以通过其他形式表示双目相机的外参。It should be understood that the representation of the external parameters in the form of Euler angles in FIG. 10 is only an example, and the external parameters of the binocular camera may also be represented in other forms.
当前的重构误差的情况包括当前的距离误差和当前的角度误差。在图10中,标定过程中选择重构后的L 1、L 5、l 1、l 4这四条直线计算重构误差。例如,如图10所示,角度误差包括:L 1和L 5之间的角度误差,l 1和l 4之间的角度误差,L 1和l 1之间的角度误差。距离误差包括:L 1和L 5之间的距离误差。 The current reconstruction error conditions include the current distance error and the current angle error. In FIG. 10 , four reconstructed straight lines L 1 , L 5 , l 1 , and l 4 are selected during the calibration process to calculate the reconstruction error. For example, as shown in Figure 10 , the angle error includes : the angle error between L1 and L5 , the angle error between L1 and L4 , and the angle error between L1 and L1 . The distance error includes: the distance error between L 1 and L 5 .
应理解,图10中的重构误差的情况仅为实例,当前的重构误差的情况还可以包括当前的重构误差,即根据当前的距离误差和当前的角度误差计算得到的重构误差,例如,f i(yaw,pitch,roll)的值。或者,还采用其他直线计算重构误差。或者,也可以采用其他角度误差或距离误差计算重构误差,本申请实施例对此不做限定。 It should be understood that the situation of the reconstruction error in FIG. 10 is only an example, and the situation of the current reconstruction error may also include the current reconstruction error, that is, the reconstruction error calculated according to the current distance error and the current angle error, For example, the value of f i (yaw, pitch, roll). Alternatively, other straight lines are also used to calculate the reconstruction error. Alternatively, other angle errors or distance errors may also be used to calculate the reconstruction error, which is not limited in this embodiment of the present application.
图10的(a)和(b)示出了两种标定情况。图10的(a)中,标定完成度为25%,此时的重构误差相对较大,基于当前的外参重构得到的12条直线相对扭曲,不符合现实 世界中的拍摄场景。图10的(b)中,标定完成度80%,此时的重构误差相对较小,基于当前的外参重构得到的12条直线比较符合现实世界中的拍摄场景。(a) and (b) of Fig. 10 show two calibration situations. In (a) of Figure 10, the calibration completion rate is 25%. At this time, the reconstruction error is relatively large, and the 12 straight lines obtained based on the current external parameter reconstruction are relatively distorted, which does not conform to the shooting scene in the real world. In (b) of Figure 10, the calibration completion is 80%, and the reconstruction error at this time is relatively small, and the 12 straight lines reconstructed based on the current extrinsic parameters are more in line with the shooting scene in the real world.
本申请实施例可以适用于摄像头动态标定,也可以适用于摄像头静态标定。The embodiment of the present application may be applicable to dynamic calibration of a camera, and may also be applicable to static calibration of a camera.
例如,本申请实施例中的摄像头为车载摄像头,且摄像头承载于的车辆处于移动状态。For example, the camera in the embodiment of the present application is a vehicle-mounted camera, and the vehicle on which the camera is carried is in a moving state.
在本申请提供的方案中,标定物可以为任何类型的道路特征物,并没有严格限制其为车道线。例如,本申请提供的方案中的标定参照物可以为下列车道特征物中的任一种:车道线、标识牌、杆类物体、路面标识、交通灯。其中,标识牌例如交通标识牌或杆牌,杆类物体例如为路灯杆等。In the solution provided by this application, the landmarks can be any type of road features, and are not strictly limited to lane lines. For example, the calibration reference object in the solution provided by the present application may be any of the following lane features: lane lines, signs, pole objects, road signs, and traffic lights. Wherein, the signboards are, for example, traffic signboards or pole plates, and the pole-like objects are, for example, street light poles.
此外,本申请提供的方案既可以适用于摄像头动态标定,也可以适用于摄像头静态标定。并且,本申请实施例可以在利用开放道路中的元素作为标定物。因此,本申请提供的方案具有很好的通用性。In addition, the solution provided in this application can be applied to both dynamic camera calibration and static camera calibration. Moreover, the embodiment of the present application may use elements in the open road as calibration objects. Therefore, the solution provided by this application has good versatility.
应理解,本申请提供的方案可以应用于自动驾驶车辆装配下线的摄像头参数标定环节,不必限于固定的标定车间。It should be understood that the solution provided by the present application can be applied to the camera parameter calibration link of the automatic driving vehicle assembly line, and need not be limited to a fixed calibration workshop.
还应理解,本申请提供的方案也可以应用于,车辆出厂后的初始标定场景以及在使用过程中导致外参变化、需要实时在线修正或定期校准的场景。It should also be understood that the solution provided in this application can also be applied to the initial calibration scene after the vehicle leaves the factory and the scene that causes external parameters to change during use and requires real-time online correction or regular calibration.
例如,双目相机的外参的初始标定值可能是物体装配过程中人工测量得到的,在车辆出厂后可以利用本申请实施例的方案调整双目相机的外参,并更新系统中的双目相机的外参,为上层业务提供高精度的外参,以提高上层业务的准确性,进而提高了驾驶的性能。For example, the initial calibration value of the external parameters of the binocular camera may be obtained by manual measurement during the object assembly process. After the vehicle leaves the factory, the solution of the embodiment of the application can be used to adjust the external parameters of the binocular camera and update the binocular camera in the system. The external parameters of the camera provide high-precision external parameters for the upper-level business to improve the accuracy of the upper-level business, thereby improving the driving performance.
还应理解,本申请提供的方案可以极大的降低对特定的标定场地的依赖,实现随时随地(即实时在线)的对车载摄像头外参的高精度标定。It should also be understood that the solution provided by the present application can greatly reduce the dependence on a specific calibration site, and realize high-precision calibration of the external parameters of the vehicle-mounted camera anytime, anywhere (ie real-time online).
本文中描述的各个实施例可以为独立的方案,也可以根据内在逻辑进行组合,这些方案都落入本申请的保护范围中。The various embodiments described herein may be independent solutions, or may be combined according to internal logic, and these solutions all fall within the protection scope of the present application.
上文描述了本申请提供的方法实施例,下文将描述本申请提供的装置实施例。应理解,装置实施例的描述与方法实施例的描述相互对应,因此,未详细描述的内容可以参见上文方法实施例,为了简洁,这里不再赘述。The method embodiments provided by the present application are described above, and the device embodiments provided by the present application will be described below. It should be understood that the descriptions of the device embodiments correspond to the descriptions of the method embodiments. Therefore, for details that are not described in detail, reference may be made to the method embodiments above. For brevity, details are not repeated here.
图11为本申请实施例提供的双目相机外参标定的装置600。装置600包括获取单元610与处理单元620。FIG. 11 is a device 600 for calibrating extrinsic parameters of a binocular camera provided by an embodiment of the present application. The device 600 includes an acquisition unit 610 and a processing unit 620 .
获取单元610,用于获取第一图像和第二图像,第一图像是由双目相机中的第一摄像头对拍摄场景拍摄得到的,第二图像是由双目相机中的第二摄像头对拍摄场景拍摄得到的。The acquiring unit 610 is configured to acquire a first image and a second image, the first image is captured by the first camera pair in the binocular camera, and the second image is captured by the second camera pair in the binocular camera The scene was shot.
处理单元620,用于分别在第一图像和第二图像中提取m条直线,m为大于1的整数,第一图像的m条直线和第二图像的m条直线之间具有对应关系;基于双目相机的外参将第一图像的m条直线中的n条直线和第二图像的m条直线中的n条直线重构到三维空间中,得到重构后的n条直线,第一图像的n条直线和第二图像的n条直线为拍摄场景中的n条直线的投影,1<n≤m,n为整数;根据重构误差调整双目相机的外参,重构误差是根据重构后的n条直线之间的位置关系和拍摄场景中的n条直线之间的位置关系确定的。The processing unit 620 is configured to extract m straight lines in the first image and the second image respectively, where m is an integer greater than 1, and there is a corresponding relationship between the m straight lines in the first image and the m straight lines in the second image; based on The extrinsic parameters of the binocular camera reconstruct n straight lines in the m straight lines of the first image and n straight lines in the m straight lines of the second image into three-dimensional space, and obtain n straight lines after reconstruction, the first The n straight lines of the image and the n straight lines of the second image are projections of n straight lines in the shooting scene, 1<n≤m, n is an integer; adjust the external parameters of the binocular camera according to the reconstruction error, and the reconstruction error is It is determined according to the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene.
可选地,作为一个实施例,重构误差包括以下至少一项:重构后的n条直线之间的角度误差或重构后的n条直线之间的距离误差,Optionally, as an embodiment, the reconstruction error includes at least one of the following: an angle error between the reconstructed n straight lines or a distance error between the reconstructed n straight lines,
重构后的n条直线之间的角度误差是根据重构后的n条直线中的至少两条直线之间的 角度与拍摄场景中的n条直线中的至少两条直线之间的角度之间的差值确定的;The angle error between the reconstructed n straight lines is based on the difference between the angle between at least two straight lines in the reconstructed n straight lines and the angle between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined;
重构后的n条直线之间的距离误差是根据重构后的n条直线中的至少两条直线之间的距离与拍摄场景中的n条直线中的至少两条直线之间的距离之间的差值确定的。The distance error between the reconstructed n straight lines is based on the distance between at least two straight lines in the reconstructed n straight lines and the distance between at least two straight lines in the n straight lines in the shooting scene. The difference between is determined.
可选地,作为一个实施例,拍摄场景中的至少两条直线包括至少两条相互平行的直线。Optionally, as an embodiment, the at least two straight lines in the shooting scene include at least two parallel straight lines.
可选地,作为一个实施例,处理单元620具体用于:Optionally, as an embodiment, the processing unit 620 is specifically configured to:
对第一图像和第二图像分别进行实例分割,得到第一图像中的实例和第二图像中的实例;performing instance segmentation on the first image and the second image respectively, to obtain an instance in the first image and an instance in the second image;
分别在第一图像中的实例和第二图像中的实例中提取m条直线,第一图像中的m条直线和第二图像中的m条直线之间的对应关系是根据第一图像中的实例和第二图像中的实例之间的对应关系确定的。Extract m straight lines from the instance in the first image and the instance in the second image respectively, and the correspondence between the m straight lines in the first image and the m straight lines in the second image is based on the The corresponding relationship between the instance and the instance in the second image is determined.
可选地,作为一个实施例,处理单元620具体用于:Optionally, as an embodiment, the processing unit 620 is specifically configured to:
对第一图像和第二图像分别进行语义分割,得到第一图像的语义分割结果和第二图像的语义分割结果,第一图像的语义分割结果包括第一图像中的水平物或竖直物,第二图像的语义分割结果包括第二图像中的水平物或竖直物;Semantic segmentation is performed on the first image and the second image respectively to obtain a semantic segmentation result of the first image and a semantic segmentation result of the second image, the semantic segmentation result of the first image includes horizontal objects or vertical objects in the first image, The semantic segmentation result of the second image includes horizontal objects or vertical objects in the second image;
基于第一图像的语义分割结果对第一图像进行实例分割,得到第一图像中的实例,基于第二图像的语义分割结果对第二图像进行实例分割,得到第二图像中的实例。Instance segmentation is performed on the first image based on the semantic segmentation result of the first image to obtain instances in the first image, and instance segmentation is performed on the second image based on the semantic segmentation results of the second image to obtain instances in the second image.
可选地,作为一个实施例,装置还包括:显示单元,用于显示双目相机外参的标定情况。Optionally, as an embodiment, the device further includes: a display unit, configured to display the calibration situation of the extrinsic parameters of the binocular camera.
可选地,作为一个实施例,双目相机外参的标定情况包括以下至少一项:当前的标定进度、当前的重构误差的情况或重构后的p条直线,重构后的p条直线是基于当前的双目相机的外参将第一图像的m条直线中的p条直线和第二图像的m条直线中的p条直线重构到三维空间中得到的,1<p≤m,p为整数。Optionally, as an embodiment, the calibration of the external parameters of the binocular camera includes at least one of the following: the current calibration progress, the current reconstruction error situation or the reconstructed p lines, the reconstructed p lines The straight line is obtained by reconstructing p straight lines out of the m straight lines in the first image and p straight lines in the m straight lines in the second image based on the extrinsic parameters of the current binocular camera, 1<p≤ m and p are integers.
可选地,作为一个实施例,当前的标定进度包括以下至少一项:Optionally, as an embodiment, the current calibration progress includes at least one of the following:
当前的双目相机的外参或当前的标定完成度。The extrinsic parameters of the current binocular camera or the current calibration completion.
可选地,作为一个实施例,当前的重构误差的情况包括以下至少一项:Optionally, as an embodiment, the current reconstruction error situation includes at least one of the following:
当前的重构误差、当前的距离误差或当前的角度误差。Current reconstruction error, current range error, or current angle error.
可选地,双目相机为车载摄像头,双目相机承载于的车辆可以处于静止状态,也可以处于移动状态。Optionally, the binocular camera is a vehicle-mounted camera, and the vehicle on which the binocular camera is carried may be in a stationary state or in a moving state.
如图12所示,该装置3000可以包括至少一个处理器3002和通信接口3003。As shown in FIG. 12 , the apparatus 3000 may include at least one processor 3002 and a communication interface 3003 .
可选地,该装置3000还可以包括存储器3001和总线3004中的至少一项。其中,存储器3001、处理器3002和通信接口3003中的任意两项之间或全部三项之间均可以通过总线3004实现彼此之间的通信连接。Optionally, the apparatus 3000 may further include at least one of a memory 3001 and a bus 3004 . Among them, any two or all three of the memory 3001 , the processor 3002 and the communication interface 3003 can be connected to each other through the bus 3004 .
可选地,存储器3001可以是只读存储器(read only memory,ROM),静态存储设备,动态存储设备或者随机存取存储器(random access memory,RAM)。存储器3001可以存储程序,当存储器3001中存储的程序被处理器3002执行时,处理器3002和通信接口3003用于执行本申请实施例的双目相机外参标定的方法的各个步骤。也就是说,处理器3002可以通过通信接口3003从存储器3001获取存储的指令,以执行本申请实施例的双目相机外参标定的方法的各个步骤。Optionally, the memory 3001 may be a read only memory (read only memory, ROM), a static storage device, a dynamic storage device or a random access memory (random access memory, RAM). The memory 3001 can store a program. When the program stored in the memory 3001 is executed by the processor 3002, the processor 3002 and the communication interface 3003 are used to execute each step of the method for calibrating the external parameters of the binocular camera according to the embodiment of the present application. That is to say, the processor 3002 can acquire stored instructions from the memory 3001 through the communication interface 3003, so as to execute each step of the method for calibrating the external parameters of the binocular camera according to the embodiment of the present application.
可选地,存储器3001可以实现上述存储程序的功能。可选地,处理器3002可以采用 通用的CPU,微处理器,ASIC,图形处理器(graphic processing unit,GPU)或者一个或多个集成电路,用于执行相关程序,以实现本申请实施例的装置中的处理单元所需执行的功能,或者执行本申请实施例的双目相机外参标定的方法的各个步骤。Optionally, the memory 3001 may implement the above function of storing programs. Optionally, the processor 3002 may adopt a general-purpose CPU, a microprocessor, an ASIC, a graphics processing unit (graphic processing unit, GPU) or one or more integrated circuits for executing related programs, so as to implement the embodiments of the present application. The functions to be performed by the processing unit in the device, or each step of the method for calibrating the extrinsic parameters of the binocular camera according to the embodiment of the present application.
可选地,处理器3002可以实现上述执行相关程序的功能。Optionally, the processor 3002 may implement the above-mentioned function of executing related programs.
可选地,处理器3002还可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,本申请实施例的控制方法的各个步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。Optionally, the processor 3002 may also be an integrated circuit chip, which has a signal processing capability. During implementation, each step of the control method in the embodiment of the present application may be completed by an integrated logic circuit of hardware in a processor or instructions in the form of software.
可选地,上述处理器3002还可以是通用处理器、数字信号处理器(digital signal processing,DSP)、专用集成电路(ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成本申请实施例的标定装置中包括的单元所需执行的功能,或者执行本申请实施例的双目相机外参标定的方法的各个步骤。Optionally, the above-mentioned processor 3002 can also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit (ASIC), a ready-made programmable gate array (field programmable gate array, FPGA) or other available Program logic devices, discrete gate or transistor logic devices, discrete hardware components. Various methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory, and the processor reads the information in the memory, and combines its hardware to complete the functions required by the units included in the calibration device of the embodiment of the application, or perform the external parameter calibration of the binocular camera in the embodiment of the application steps of the method.
可选地,通信接口3003可以使用例如但不限于收发器一类的收发装置,来实现装置与其他设备或通信网络之间的通信,例如,通信接口3003可以用于获取双目图像。该通信接口3003例如还可以是接口电路。Optionally, the communication interface 3003 can use a transceiver device such as but not limited to a transceiver to implement communication between the device and other devices or communication networks, for example, the communication interface 3003 can be used to acquire binocular images. The communication interface 3003 may also be an interface circuit, for example.
总线3004可包括在装置各个部件(例如,存储器、处理器、通信接口)之间传送信息的通路。Bus 3004 may include pathways for transferring information between various components of the device (eg, memory, processor, communication interface).
本申请实施例还提供一种包含指令的计算机程序产品,该指令被计算机执行时使得该计算机实现上述方法实施例中的方法。The embodiments of the present application also provide a computer program product including instructions, which, when executed by a computer, enable the computer to implement the methods in the above method embodiments.
本申请实施例还提供一种终端,该终端包括上述任意一种标定装置,例如图11或图12所示装置等。An embodiment of the present application also provides a terminal, which includes any of the above-mentioned calibration devices, such as the device shown in FIG. 11 or FIG. 12 .
示例性地,该终端可以为车辆、无人机或机器人等。Exemplarily, the terminal may be a vehicle, a drone, or a robot.
上述标定装置既可以是安装在终端上的,又可以是独立于终端。The above-mentioned calibration device can be installed on the terminal or be independent from the terminal.
本申请实施例还提供一种计算机可读介质,该计算机可读介质存储用于设备执行的程序代码,该程序代码包括用于执行上述实施例的方法。An embodiment of the present application further provides a computer-readable medium, where the computer-readable medium stores program code for execution by a device, where the program code includes the method for executing the above-mentioned embodiments.
本申请实施例还提供一种包含指令的计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述实施例的方法。The embodiment of the present application also provides a computer program product containing instructions, and when the computer program product is run on a computer, the computer is made to execute the method of the above embodiment.
本申请实施例还提供一种芯片,该芯片包括处理器与数据接口,处理器通过数据接口读取存储器上存储的指令,执行上述实施例的方法。The embodiment of the present application also provides a chip, the chip includes a processor and a data interface, and the processor reads the instructions stored in the memory through the data interface, and executes the method of the above embodiment.
可选地,作为一种实现方式,该芯片还可以包括存储器,存储器中存储有指令,处理器用于执行存储器上存储的指令,当指令被执行时,处理器用于执行上述实施例中的方法。Optionally, as an implementation manner, the chip may further include a memory, in which instructions are stored, and the processor is configured to execute the instructions stored in the memory, and when the instructions are executed, the processor is configured to execute the method in the foregoing embodiments.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this application belongs. The terms used herein in the specification of the application are only for the purpose of describing specific embodiments, and are not intended to limit the application.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (22)

  1. 一种双目相机外参标定的方法,其特征在于,包括:A method for calibrating external parameters of a binocular camera, comprising:
    获取第一图像和第二图像,所述第一图像是由双目相机中的第一摄像头对拍摄场景拍摄得到的,所述第二图像是由所述双目相机中的第二摄像头对所述拍摄场景拍摄得到的;Obtain a first image and a second image, the first image is captured by the first camera pair in the binocular camera, and the second image is captured by the second camera pair in the binocular camera obtained from shooting the above-mentioned shooting scene;
    分别在所述第一图像和所述第二图像中提取m条直线,m为大于1的整数,所述第一图像的m条直线和所述第二图像的m条直线之间具有对应关系;Extract m straight lines from the first image and the second image respectively, m is an integer greater than 1, and there is a corresponding relationship between the m straight lines in the first image and the m straight lines in the second image ;
    基于所述双目相机的外参将所述第一图像的m条直线中的n条直线和所述第二图像的m条直线中的n条直线重构到三维空间中,得到重构后的n条直线,所述第一图像的n条直线和所述第二图像的n条直线为所述拍摄场景中的n条直线的投影,1<n≤m,n为整数;Based on the extrinsic parameters of the binocular camera, reconstruct n straight lines among the m straight lines of the first image and n straight lines among the m straight lines of the second image into a three-dimensional space, and obtain the reconstructed n straight lines, the n straight lines of the first image and the n straight lines of the second image are projections of n straight lines in the shooting scene, 1<n≤m, n is an integer;
    根据重构误差调整所述双目相机的外参,所述重构误差是根据所述重构后的n条直线之间的位置关系和所述拍摄场景中的n条直线之间的位置关系确定的。Adjusting the extrinsic parameters of the binocular camera according to the reconstruction error, the reconstruction error is based on the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene definite.
  2. 根据权利要求1所述的方法,其特征在于,所述重构误差包括以下至少一项:所述重构后的n条直线之间的角度误差或所述重构后的n条直线之间的距离误差,The method according to claim 1, wherein the reconstruction error comprises at least one of the following: an angle error between the reconstructed n straight lines or an angle error between the reconstructed n straight lines the distance error,
    所述重构后的n条直线之间的角度误差是根据所述重构后的n条直线中的至少两条直线之间的角度与所述拍摄场景中的n条直线中的至少两条直线之间的角度之间的差值确定的;The angle error between the n straight lines after reconstruction is based on the angle between at least two straight lines among the n straight lines after reconstruction and at least two of the n straight lines in the shooting scene. determined by the difference between the angles between the straight lines;
    所述重构后的n条直线之间的距离误差是根据所述重构后的n条直线中的至少两条直线之间的距离与所述拍摄场景中的n条直线中的至少两条直线之间的距离之间的差值确定的。The distance error between the reconstructed n straight lines is based on the distance between at least two of the reconstructed n straight lines and at least two of the n straight lines in the shooting scene. The difference between the distances between the lines is determined.
  3. 根据权利要求2所述的方法,其特征在于,所述拍摄场景中的至少两条直线包括至少两条相互平行的直线。The method according to claim 2, wherein the at least two straight lines in the shooting scene include at least two parallel straight lines.
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述分别在所述第一图像和所述第二图像中提取m条直线包括:The method according to any one of claims 1 to 3, wherein said extracting m straight lines in said first image and said second image respectively comprises:
    对所述第一图像和所述第二图像分别进行实例分割,得到所述第一图像中的实例和所述第二图像中的实例;respectively performing instance segmentation on the first image and the second image to obtain instances in the first image and instances in the second image;
    分别在所述第一图像中的实例和所述第二图像中的实例中提取m条直线,所述第一图像中的m条直线和所述第二图像中的m条直线之间的对应关系是根据所述第一图像中的实例和所述第二图像中的实例之间的对应关系确定的。Extracting m straight lines from the instance in the first image and the instance in the second image respectively, the correspondence between the m straight lines in the first image and the m straight lines in the second image A relationship is determined from a correspondence between instances in the first image and instances in the second image.
  5. 根据权利要求4所述的方法,其特征在于,所述对所述第一图像和所述第二图像分别进行实例分割,得到所述第一图像中的实例和所述第二图像中的实例,包括:The method according to claim 4, wherein the instance segmentation is performed on the first image and the second image respectively to obtain the instance in the first image and the instance in the second image ,include:
    对所述第一图像和所述第二图像分别进行语义分割,得到所述第一图像的语义分割结果和所述第二图像的语义分割结果,所述第一图像的语义分割结果包括所述第一图像中的水平物或竖直物,所述第二图像的语义分割结果包括所述第二图像中的水平物或竖直物;Semantic segmentation is performed on the first image and the second image respectively to obtain a semantic segmentation result of the first image and a semantic segmentation result of the second image, and the semantic segmentation result of the first image includes the Horizontal objects or vertical objects in the first image, the semantic segmentation result of the second image includes horizontal objects or vertical objects in the second image;
    基于所述第一图像的语义分割结果对所述第一图像进行实例分割,得到所述第一图像中的实例,基于所述第二图像的语义分割结果对所述第二图像进行实例分割,得到所述第二图像中的实例。performing instance segmentation on the first image based on the semantic segmentation result of the first image to obtain instances in the first image, and performing instance segmentation on the second image based on the semantic segmentation result of the second image, Get the instance in the second image.
  6. 根据权利要求1至5中任一项所述的方法,其特征在于,所述方法还包括:控制显示器显示双目相机外参的标定情况。The method according to any one of claims 1 to 5, further comprising: controlling the display to display the calibration of the extrinsic parameters of the binocular camera.
  7. 根据权利要求6所述的方法,其特征在于,所述双目相机外参的标定情况包括以下至少一项:当前的标定进度、当前的重构误差的情况或重构后的p条直线,所述重构后的p条直线是基于当前的所述双目相机的外参将所述第一图像的m条直线中的p条直线和所述第二图像的m条直线中的p条直线重构到三维空间中得到的,1<p≤m,p为整数。The method according to claim 6, wherein the calibration conditions of the extrinsic parameters of the binocular camera include at least one of the following: current calibration progress, current reconstruction error conditions or reconstructed p straight lines, The reconstructed p straight lines are based on the current extrinsic parameters of the binocular camera, p lines among the m straight lines of the first image and p lines among the m straight lines of the second image Obtained by reconstructing a straight line into a three-dimensional space, 1<p≤m, p is an integer.
  8. 根据权利要求7所述的方法,其特征在于,所述当前的标定进度包括以下至少一项:The method according to claim 7, wherein the current calibration progress includes at least one of the following:
    当前的所述双目相机的外参或当前的标定完成度。The current extrinsic parameters of the binocular camera or the current calibration completion degree.
  9. 根据权利要求8所述的方法,其特征在于,所述当前的重构误差的情况包括以下至少一项:The method according to claim 8, wherein the current reconstruction error situation includes at least one of the following:
    当前的重构误差、当前的距离误差或当前的角度误差。Current reconstruction error, current range error, or current angle error.
  10. 一种双目相机外参标定的装置,其特征在于,包括:A device for calibrating external parameters of a binocular camera, characterized in that it comprises:
    获取单元,用于获取第一图像和第二图像,所述第一图像是由双目相机中的第一摄像头对拍摄场景拍摄得到的,所述第二图像是由所述双目相机中的第二摄像头对所述拍摄场景拍摄得到的;An acquisition unit, configured to acquire a first image and a second image, the first image is captured by the first camera in the binocular camera on the shooting scene, and the second image is obtained by the first camera in the binocular camera obtained by shooting the shooting scene by the second camera;
    处理单元,用于:processing unit for:
    分别在所述第一图像和所述第二图像中提取m条直线,m为大于1的整数,所述第一图像的m条直线和所述第二图像的m条直线之间具有对应关系;Extract m straight lines from the first image and the second image respectively, m is an integer greater than 1, and there is a corresponding relationship between the m straight lines in the first image and the m straight lines in the second image ;
    基于所述双目相机的外参将所述第一图像的m条直线中的n条直线和所述第二图像的m条直线中的n条直线重构到三维空间中,得到重构后的n条直线,所述第一图像的n条直线和所述第二图像的n条直线为所述拍摄场景中的n条直线的投影,1<n≤m,n为整数;Based on the extrinsic parameters of the binocular camera, reconstruct n straight lines among the m straight lines of the first image and n straight lines among the m straight lines of the second image into a three-dimensional space, and obtain the reconstructed n straight lines, the n straight lines of the first image and the n straight lines of the second image are projections of n straight lines in the shooting scene, 1<n≤m, n is an integer;
    根据重构误差调整所述双目相机的外参,所述重构误差是根据所述重构后的n条直线之间的位置关系和所述拍摄场景中的n条直线之间的位置关系确定的。Adjusting the extrinsic parameters of the binocular camera according to the reconstruction error, the reconstruction error is based on the positional relationship between the reconstructed n straight lines and the positional relationship between the n straight lines in the shooting scene definite.
  11. 根据权利要求10所述的装置,其特征在于,所述重构误差包括以下至少一项:所述重构后的n条直线之间的角度误差或所述重构后的n条直线之间的距离误差,The device according to claim 10, wherein the reconstruction error comprises at least one of the following: an angle error between the reconstructed n straight lines or an angle error between the reconstructed n straight lines the distance error,
    所述重构后的n条直线之间的角度误差是根据所述重构后的n条直线中的至少两条直线之间的角度与所述拍摄场景中的n条直线中的至少两条直线之间的角度之间的差值确定的;The angle error between the n straight lines after reconstruction is based on the angle between at least two straight lines among the n straight lines after reconstruction and at least two of the n straight lines in the shooting scene. determined by the difference between the angles between the straight lines;
    所述重构后的n条直线之间的距离误差是根据所述重构后的n条直线中的至少两条直线之间的距离与所述拍摄场景中的n条直线中的至少两条直线之间的距离之间的差值确定的。The distance error between the reconstructed n straight lines is based on the distance between at least two of the reconstructed n straight lines and at least two of the n straight lines in the shooting scene. The difference between the distances between the lines is determined.
  12. 根据权利要求11所述的装置,其特征在于,所述拍摄场景中的至少两条直线包括至少两条相互平行的直线。The device according to claim 11, wherein the at least two straight lines in the shooting scene include at least two parallel straight lines.
  13. 根据权利要求10至12中任一项所述的装置,其特征在于,所述处理单元具体用于:The device according to any one of claims 10 to 12, wherein the processing unit is specifically configured to:
    对所述第一图像和所述第二图像分别进行实例分割,得到所述第一图像中的实例和所述第二图像中的实例;respectively performing instance segmentation on the first image and the second image to obtain instances in the first image and instances in the second image;
    分别在所述第一图像中的实例和所述第二图像中的实例中提取m条直线,所述第一 图像中的m条直线和所述第二图像中的m条直线之间的对应关系是根据所述第一图像中的实例和所述第二图像中的实例之间的对应关系确定的。Extracting m straight lines from the instance in the first image and the instance in the second image respectively, the correspondence between the m straight lines in the first image and the m straight lines in the second image A relationship is determined from a correspondence between instances in the first image and instances in the second image.
  14. 根据权利要求13所述的装置,其特征在于,所述处理单元具体用于:The device according to claim 13, wherein the processing unit is specifically used for:
    对所述第一图像和所述第二图像分别进行语义分割,得到所述第一图像的语义分割结果和所述第二图像的语义分割结果,所述第一图像的语义分割结果包括所述第一图像中的水平物或竖直物,所述第二图像的语义分割结果包括所述第二图像中的水平物或竖直物;Semantic segmentation is performed on the first image and the second image respectively to obtain a semantic segmentation result of the first image and a semantic segmentation result of the second image, and the semantic segmentation result of the first image includes the Horizontal objects or vertical objects in the first image, the semantic segmentation result of the second image includes horizontal objects or vertical objects in the second image;
    基于所述第一图像的语义分割结果对所述第一图像进行实例分割,得到所述第一图像中的实例,基于所述第二图像的语义分割结果对所述第二图像进行实例分割,得到所述第二图像中的实例。performing instance segmentation on the first image based on the semantic segmentation result of the first image to obtain instances in the first image, and performing instance segmentation on the second image based on the semantic segmentation result of the second image, Get the instance in the second image.
  15. 根据权利要求10至14中任一项所述的装置,其特征在于,所述装置还包括:显示单元,用于显示双目相机外参的标定情况。The device according to any one of claims 10 to 14, characterized in that the device further comprises: a display unit for displaying the calibration of the extrinsic parameters of the binocular camera.
  16. 根据权利要求15所述的装置,其特征在于,所述双目相机外参的标定情况包括以下至少一项:当前的标定进度、当前的重构误差的情况或重构后的p条直线,所述重构后的p条直线是基于当前的所述双目相机的外参将所述第一图像的m条直线中的p条直线和所述第二图像的m条直线中的p条直线重构到三维空间中得到的,1<p≤m,p为整数。The device according to claim 15, wherein the calibration conditions of the extrinsic parameters of the binocular camera include at least one of the following: current calibration progress, current reconstruction error conditions or reconstructed p straight lines, The reconstructed p straight lines are based on the current extrinsic parameters of the binocular camera, p lines among the m straight lines of the first image and p lines among the m straight lines of the second image Obtained by reconstructing a straight line into a three-dimensional space, 1<p≤m, p is an integer.
  17. 根据权利要求16所述的装置,其特征在于,所述当前的标定进度包括以下至少一项:The device according to claim 16, wherein the current calibration progress includes at least one of the following:
    当前的所述双目相机的外参或当前的标定完成度。The current extrinsic parameters of the binocular camera or the current calibration completion degree.
  18. 根据权利要求17所述的装置,其特征在于,所述当前的重构误差的情况包括以下至少一项:The device according to claim 17, wherein the current reconstruction error situation includes at least one of the following:
    当前的重构误差、当前的距离误差或当前的角度误差。Current reconstruction error, current range error, or current angle error.
  19. 一种芯片,其特征在于,所述芯片包括至少一个处理器与接口电路,所述至少一个处理器通过所述接口电路获取存储器上存储的指令,以执行如权利要求1至9中任一项所述的方法。A chip, characterized in that the chip includes at least one processor and an interface circuit, and the at least one processor obtains instructions stored on the memory through the interface circuit to execute any one of claims 1 to 9. the method described.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读介质存储用于设备执行的程序代码,该程序代码包括用于执行如权利要求1至9中任一项所述的方法的指令。A computer-readable storage medium, characterized in that the computer-readable medium stores program code for execution by a device, and the program code includes instructions for performing the method according to any one of claims 1 to 9 .
  21. 一种终端,其特征在于,所述终端包括如权利要求10至18中任一项所述装置。A terminal, characterized in that the terminal comprises the device according to any one of claims 10-18.
  22. 根据权利要求21所述的终端,其特征在于,所述终端还包括双目相机。The terminal according to claim 21, further comprising a binocular camera.
PCT/CN2021/106747 2021-07-16 2021-07-16 Method and apparatus for calibrating external parameters of binocular camera WO2023283929A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2021/106747 WO2023283929A1 (en) 2021-07-16 2021-07-16 Method and apparatus for calibrating external parameters of binocular camera
CN202180094173.2A CN116917936A (en) 2021-07-16 2021-07-16 External parameter calibration method and device for binocular camera

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/106747 WO2023283929A1 (en) 2021-07-16 2021-07-16 Method and apparatus for calibrating external parameters of binocular camera

Publications (1)

Publication Number Publication Date
WO2023283929A1 true WO2023283929A1 (en) 2023-01-19

Family

ID=84919002

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/106747 WO2023283929A1 (en) 2021-07-16 2021-07-16 Method and apparatus for calibrating external parameters of binocular camera

Country Status (2)

Country Link
CN (1) CN116917936A (en)
WO (1) WO2023283929A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117173257A (en) * 2023-11-02 2023-12-05 安徽蔚来智驾科技有限公司 3D target detection and calibration parameter enhancement method, electronic equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103745452A (en) * 2013-11-26 2014-04-23 理光软件研究所(北京)有限公司 Camera external parameter assessment method and device, and camera external parameter calibration method and device
US20150103147A1 (en) * 2013-10-14 2015-04-16 Etron Technology, Inc. Image calibration system and calibration method of a stereo camera
US20180316906A1 (en) * 2017-05-01 2018-11-01 Panasonic Intellectual Property Management Co., Ltd. Camera parameter set calculation apparatus, camera parameter set calculation method, and recording medium
CN111462249A (en) * 2020-04-02 2020-07-28 北京迈格威科技有限公司 Calibration data acquisition method, calibration method and device for traffic camera
CN112184830A (en) * 2020-09-22 2021-01-05 深研人工智能技术(深圳)有限公司 Camera internal parameter and external parameter calibration method and device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150103147A1 (en) * 2013-10-14 2015-04-16 Etron Technology, Inc. Image calibration system and calibration method of a stereo camera
CN103745452A (en) * 2013-11-26 2014-04-23 理光软件研究所(北京)有限公司 Camera external parameter assessment method and device, and camera external parameter calibration method and device
US20180316906A1 (en) * 2017-05-01 2018-11-01 Panasonic Intellectual Property Management Co., Ltd. Camera parameter set calculation apparatus, camera parameter set calculation method, and recording medium
CN111462249A (en) * 2020-04-02 2020-07-28 北京迈格威科技有限公司 Calibration data acquisition method, calibration method and device for traffic camera
CN112184830A (en) * 2020-09-22 2021-01-05 深研人工智能技术(深圳)有限公司 Camera internal parameter and external parameter calibration method and device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117173257A (en) * 2023-11-02 2023-12-05 安徽蔚来智驾科技有限公司 3D target detection and calibration parameter enhancement method, electronic equipment and medium

Also Published As

Publication number Publication date
CN116917936A (en) 2023-10-20

Similar Documents

Publication Publication Date Title
WO2021233029A1 (en) Simultaneous localization and mapping method, device, system and storage medium
WO2021073656A1 (en) Method for automatically labeling image data and device
Berrio et al. Camera-LIDAR integration: Probabilistic sensor fusion for semantic mapping
WO2020043081A1 (en) Positioning technique
CN111830953A (en) Vehicle self-positioning method, device and system
US20220051425A1 (en) Scale-aware monocular localization and mapping
US11430199B2 (en) Feature recognition assisted super-resolution method
CN111060924A (en) SLAM and target tracking method
Chen et al. Milestones in autonomous driving and intelligent vehicles—part ii: Perception and planning
WO2022062480A1 (en) Positioning method and positioning apparatus of mobile device
CN113989450A (en) Image processing method, image processing apparatus, electronic device, and medium
EP4307219A1 (en) Three-dimensional target detection method and apparatus
Florea et al. Enhanced perception for autonomous driving using semantic and geometric data fusion
Geiger et al. Object flow: A descriptor for classifying traffic motion
CN114662587A (en) Three-dimensional target sensing method, device and system based on laser radar
Saleem et al. Neural network-based recent research developments in SLAM for autonomous ground vehicles: A review
WO2022048493A1 (en) Camera extrinsic parameter calibration method and apparatus
CN111833443A (en) Landmark position reconstruction in autonomous machine applications
WO2023283929A1 (en) Method and apparatus for calibrating external parameters of binocular camera
Bao et al. Robust tightly-coupled visual-inertial odometry with pre-built maps in high latency situations
CN112800822A (en) 3D automatic tagging with structural and physical constraints
CN114648639B (en) Target vehicle detection method, system and device
Ouyang et al. Semantic slam for mobile robot with human-in-the-loop
Liu et al. The robust semantic slam system for texture-less underground parking lot
Dekkiche et al. Vehicles detection in stereo vision based on disparity map segmentation and objects classification

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21949713

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180094173.2

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE