Camera array calibration method, device, electronic device and storage medium
Through light source detection and feature matching of multiple sets of images, combined with distance error optimization and singular value decomposition, the low accuracy problem of camera array calibration in the existing technology is solved, and the accuracy of the internal and external parameter matrices and the restoration of the three-dimensional model are significantly improved. Effect.
Patent Information
- Application Number
- CN202210422544.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-04-21
AI Technical Summary
The existing technology does not perform well in calibrating the camera array using a checkerboard calibration board, resulting in low accuracy of the three-dimensional model restored by the internal parameter matrix and the external parameter matrix.
By acquiring multiple sets of images, perform light source detection and feature matching, calculate the initial internal and external parameter matrices, and obtain optimized internal and external parameter matrices through distance error optimization, delete matching coordinate point groups that do not satisfy epipolar constraints, and use singular values Decomposition and random sampling consensus algorithms calculate fundamental and essential matrices, and perform scale registration to improve matrix accuracy.
It improves the accuracy of camera array internal parameter and external parameter matrix calibration, enhances the restoration accuracy of the three-dimensional model, and improves the calibration effect.
Smart Images

Figure CN115018920B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical fields of camera arrays, camera calibration and image processing, and in particular to a camera array calibration method, device, electronic device and storage medium. Background Art
[0002] At present, most of the calibration of camera arrays is done using a chessboard calibration board (a plate-shaped object similar to a black and white chessboard) or a logo development board (for example, a polygonal object including multiple colors). First, the intrinsic parameter matrix of one camera in the camera array is calibrated, that is, the intrinsic parameter matrix of one camera in the camera array (i.e., the internal parameter matrix of the camera) is calculated first; then, the extrinsic parameter matrix of the camera array (i.e., the external parameter matrix of the camera) is solved by calibrating the cameras pairwise; finally, the intrinsic parameter matrix of the remaining cameras in the camera array is calibrated.
[0003] In the specific practice, it was found that the effect of using the chessboard calibration board to calibrate the intrinsic parameter matrix and the extrinsic parameter matrix of the camera array was not good, that is, the accuracy of the three-dimensional model restored using the intrinsic parameter matrix and the extrinsic parameter matrix was low. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a camera array calibration method, device, electronic device and storage medium, which are used to improve the problem of poor calibration effect of the intrinsic parameter matrix and the extrinsic parameter matrix of the camera array.
[0005] The embodiment of the present application provides a camera array calibration method, including: acquiring multiple groups of images, and performing light source detection on each group of images in the multiple groups of images to obtain image coordinate points of a target light source in each group of images, wherein each group of images in the multiple groups of images is an image obtained by using all cameras in the camera array to shoot the target light source in motion at the same time; performing feature matching on the image coordinate points in each group of images according to the image features of the target light source to obtain multiple matching coordinate point groups corresponding to each group of images; calculating the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, and calculating the mapping coordinate points of the target light source projected in each group of images according to the initial internal parameter matrix and the initial external parameter matrix; optimizing the initial internal parameter matrix and the initial external parameter matrix of all cameras according to the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images to obtain an optimized internal parameter matrix and an optimized external parameter matrix; and calibrating the optimized internal parameter matrix and the optimized external parameter matrix in all cameras in the camera array. In the implementation process of the above scheme, by performing light source point detection and feature matching on multiple groups of images, and according to the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images, the initial internal parameter matrices and the initial external parameter matrices of all cameras are optimized, thereby reducing the distance error between the image coordinate points and the mapping coordinate points of the target light source projection, effectively improving the accuracy of the three-dimensional model restored using the internal parameter matrix and the external parameter matrix, and also effectively improving the effect of calibrating the internal parameter matrix and the external parameter matrix of the camera array.
[0006] Optionally, in an embodiment of the present application, before calculating the initial internal parameter matrices and initial external parameter matrices of all cameras in the camera array based on the multiple matching coordinate point groups corresponding to each group of images, it also includes: for each group of images in the multiple groups of images, deleting the matching coordinate point groups that do not satisfy the epipolar constraints from the multiple matching coordinate point groups corresponding to each group of images.
[0007] In the implementation process of the above scheme, by deleting the matching coordinate point groups that do not satisfy the epipolar constraints from the multiple matching coordinate point groups corresponding to each group of images, thereby deleting the mismatched coordinate point groups, the error caused by the mismatch can be effectively reduced, and the accuracy of the three-dimensional model restored using the intrinsic parameter matrix and the extrinsic parameter matrix can be effectively improved, and the effect of calibrating the intrinsic parameter matrix and the extrinsic parameter matrix of the camera array can be effectively improved.
[0008] Optionally, in an embodiment of the present application, an initial internal parameter matrix and an initial external parameter matrix of all cameras in the camera array are calculated based on multiple matching coordinate point groups corresponding to each group of images, including: calculating an initial basic matrix of all cameras in the camera array based on multiple matching coordinate point groups corresponding to each group of images, the initial basic matrix representing the conversion information between the camera coordinate system and the pixel coordinate system; calculating an initial internal parameter matrix based on the width value and height value of each group of images, and calculating an initial essential matrix based on the initial internal parameter matrix and the initial basic matrix, the initial essential matrix representing the conversion information between the camera coordinate system and the world coordinate system; performing singular value decomposition on the initial essential matrix to obtain an initial external parameter matrix.
[0009] In the implementation process of the above scheme, the initial fundamental matrices of all cameras in the camera array are calculated by adopting a random sampling consensus algorithm, and the initial essential matrix is calculated based on the initial internal parameter matrix and the initial fundamental matrix, thereby avoiding the direct use of the least squares method to calculate the initial fundamental matrix and the initial essential matrix, and effectively improving the accuracy of the calculated initial fundamental matrix and initial essential matrix.
[0010] Optionally, in an embodiment of the present application, the initial internal parameter matrix includes: camera focal length and image principal point coordinates; the initial internal parameter matrix is calculated based on the width value and height value of each group of images, including: determining the camera focal length in the initial internal parameter matrix based on the maximum value of the width value and the height value; determining half of the width value as the horizontal coordinate length value of the image principal point coordinates, and determining half of the height value as the vertical coordinate length value of the image principal point coordinates.
[0011] Optionally, in an embodiment of the present application, the initial internal parameter matrices and the initial external parameter matrices of all cameras are optimized to obtain an optimized internal parameter matrix and an optimized external parameter matrix, including: adjusting the initial internal parameter matrix and the initial external parameter matrix to change the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images; determining the initial internal parameter matrix when the distance error is less than a preset threshold as the optimized internal parameter matrix, and determining the initial external parameter matrix when the distance error is less than the preset threshold as the optimized external parameter matrix.
[0012] In the implementation process of the above scheme, the initial internal parameter matrix when the distance error is less than the preset threshold is determined as the optimized internal parameter matrix, and the initial external parameter matrix when the distance error is less than the preset threshold is determined as the optimized external parameter matrix, thereby reducing the distance error between the image coordinate point and the mapping coordinate point of the target light source projection, effectively improving the accuracy of the three-dimensional model restored using the internal parameter matrix and the external parameter matrix, and effectively improving the effect of calibrating the internal parameter matrix and the external parameter matrix of the camera array.
[0013] Optionally, in an embodiment of the present application, the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix are calibrated in all cameras in the camera array, including: performing scale alignment on the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix to obtain a registration intrinsic parameter matrix and a registration extrinsic parameter matrix; and calibrating the registration intrinsic parameter matrix and the registration extrinsic parameter matrix in all cameras in the camera array.
[0014] In the implementation process of the above scheme, by performing scale alignment on the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix, and calibrating the aligned intrinsic parameter matrix and the aligned extrinsic parameter matrix in all cameras in the camera array, the size of the three-dimensional real world can be better reconstructed into a predictable three-dimensional object size, which effectively improves the accuracy of the three-dimensional model restored using the intrinsic parameter matrix and the extrinsic parameter matrix, and also effectively improves the effect of calibrating the intrinsic parameter matrix and the extrinsic parameter matrix of the camera array.
[0015] Optionally, in an embodiment of the present application, the target light source is a single light source point that moves continuously.
[0016] The embodiment of the present application also provides a camera array calibration device, including: an image light source detection module, used to obtain multiple groups of images, and perform light source detection on each group of images in the multiple groups of images to obtain image coordinate points of a target light source in each group of images, wherein each group of images in the multiple groups of images is an image of a target light source in motion captured by all cameras in the camera array at the same time; an image feature matching module, used to perform feature matching on image coordinate points in each group of images according to image features of the target light source, and obtain multiple matching coordinate point groups corresponding to each group of images; a mapping coordinate calculation module, used to calculate an initial internal parameter matrix and an initial external parameter matrix of all cameras in the camera array according to multiple matching coordinate point groups corresponding to each group of images, and calculate the mapping coordinate points of the target light source projected in each group of images according to the initial internal parameter matrix and the initial external parameter matrix; a distance error optimization module, used to optimize the initial internal parameter matrix and the initial external parameter matrix of all cameras according to the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images, and obtain an optimized internal parameter matrix and an optimized external parameter matrix; a camera array calibration module, used to calibrate the optimized internal parameter matrix and the optimized external parameter matrix in all cameras in the camera array.
[0017] Optionally, in an embodiment of the present application, the camera array calibration device further includes: a coordinate point group deletion module, which is used to delete the matching coordinate point groups that do not satisfy the epipolar constraint from the multiple matching coordinate point groups corresponding to each group of images in the multiple groups of images.
[0018] Optionally, in an embodiment of the present application, the mapping coordinate calculation module includes: a basic matrix calculation module, which is used to calculate the initial basic matrix of all cameras in the camera array according to multiple matching coordinate point groups corresponding to each group of images, and the initial basic matrix represents the conversion information between the camera coordinate system and the pixel coordinate system; an essential matrix calculation module, which is used to calculate the initial internal parameter matrix according to the width value and height value of each group of images, and calculate the initial essential matrix according to the initial internal parameter matrix and the initial basic matrix, and the initial essential matrix represents the conversion information between the camera coordinate system and the world coordinate system; an essential matrix decomposition module, which is used to perform singular value decomposition on the initial essential matrix to obtain an initial external parameter matrix.
[0019] Optionally, in an embodiment of the present application, the initial internal parameter matrix includes: camera focal length and image principal point coordinates; the intrinsic matrix calculation module includes: a camera focal length determination module, used to determine the camera focal length in the initial internal parameter matrix according to the maximum value of the width value and the height value; a principal point coordinate determination module, used to determine half of the width value as the horizontal coordinate length value of the image principal point coordinates, and half of the height value as the vertical coordinate length value of the image principal point coordinates.
[0020] Optionally, in an embodiment of the present application, the distance error optimization module includes: a parameter matrix adjustment module, used to adjust the initial internal parameter matrix and the initial external parameter matrix to change the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images; a parameter matrix determination module, used to determine the initial internal parameter matrix when the distance error is less than a preset threshold as the optimized internal parameter matrix, and determine the initial external parameter matrix when the distance error is less than the preset threshold as the optimized external parameter matrix.
[0021] Optionally, in an embodiment of the present application, the camera array calibration module includes: a matrix scale alignment module, used to perform scale alignment on the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix to obtain a registration intrinsic parameter matrix and a registration extrinsic parameter matrix; a parameter matrix calibration module, used to calibrate the registration intrinsic parameter matrix and the registration extrinsic parameter matrix in all cameras in the camera array.
[0022] Optionally, in an embodiment of the present application, the target light source is a single light source point that moves continuously.
[0023] An embodiment of the present application further provides an electronic device, including: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method described above is performed.
[0024] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described above is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 A schematic diagram of the process flow of a camera array calibration method provided in an embodiment of the present application is shown;
[0027] Figure 2 A schematic diagram of shooting using a camera matrix provided in an embodiment of the present application is shown;
[0028] Figure 3 A schematic diagram of a calibration rod of a single light source provided in an embodiment of the present application is shown;
[0029] Figure 4 A schematic diagram of the structure of a camera array calibration device provided in an embodiment of the present application is shown;
[0030] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments in the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the embodiments of the present application claimed for protection, but merely represents the selected embodiments in the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the embodiments of the present application.
[0032] It is understandable that the "first" and "second" in the embodiments of the present application are used to distinguish similar objects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit the difference.
[0033] Before introducing the camera array calibration method provided in the embodiment of the present application, some concepts involved in the embodiment of the present application are first introduced:
[0034] The epipolar constraint means that the point projected by the same spatial point in the images taken by different cameras should be on the epipolar line of the image, which means that the spatial point satisfies the epipolar constraint. On the contrary, if the point projected by the same spatial point in the camera image is not on the epipolar line, it means that the spatial point does not satisfy the epipolar constraint.
[0035] It should be noted that the camera array calibration method provided in the embodiment of the present application can be executed by an electronic device, where the electronic device refers to a device terminal or server with the function of executing a computer program, such as a smart phone, a personal computer, a tablet computer, a personal digital assistant or a mobile Internet device. A server refers to a device that provides computing services through a network, such as an x86 server and a non-x86 server, and a non-x86 server includes a mainframe, a minicomputer and a UNIX server.
[0036] The following introduces application scenarios applicable to the camera array calibration method. The application scenarios here include but are not limited to: using the camera array calibration method to calibrate all cameras in a camera array, that is, setting internal parameters and external parameters of all cameras in the camera array.
[0037] See also Figure 1 The flowchart of the camera array calibration method provided in the embodiment of the present application is shown; the camera array calibration method may mainly include:
[0038] Step S110: Acquire multiple groups of images, and perform light source detection on each group of images in the multiple groups of images to obtain image coordinate points of the target light source in each group of images. Each group of images in the multiple groups of images is an image of the target light source in motion captured at the same time using all cameras in the camera array.
[0039] Step S120: performing feature matching on the image coordinate points in each group of images according to the image features of the target light source, and obtaining a plurality of matching coordinate point groups corresponding to each group of images.
[0040] Step S130: Calculate the initial internal parameter matrix and initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, and calculate the mapping coordinate points of the target light source projected in each group of images according to the initial internal parameter matrix and the initial external parameter matrix.
[0041] Optionally, before calculating the initial internal parameter matrix and the initial external parameter matrix, the matching coordinate point group that does not satisfy the epipolar constraint can also be deleted. This implementation may include: for each group of images in the multiple groups of images, deleting the matching coordinate point group that does not satisfy the epipolar constraint from the multiple matching coordinate point groups corresponding to each group of images. Then, the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array are calculated based on the multiple matching coordinate point groups corresponding to each group of images, and the mapping coordinate points of the target light source projected in each group of images are calculated based on the initial internal parameter matrix and the initial external parameter matrix.
[0042] Step S140: Optimize the initial internal parameter matrix and the initial external parameter matrix of all cameras according to the distance error between the mapping coordinate point in each group of images and the image coordinate point in each group of images to obtain the optimized internal parameter matrix and the optimized external parameter matrix.
[0043] Step S150: calibrating the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix in all cameras in the camera array.
[0044] Optionally, in the specific implementation process, the process from step S120 to step S150 above can be iterated multiple times, that is, the intrinsic parameter matrix and extrinsic parameter matrix of the camera can be made more accurate through multiple iterative optimization. The process is similar to the above steps S120 to step S150, and will not be repeated here.
[0045] In the implementation process of the above scheme, by performing light source point detection and feature matching on multiple groups of images, and according to the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images, the initial internal parameter matrices and the initial external parameter matrices of all cameras are optimized, thereby reducing the distance error between the image coordinate points and the mapping coordinate points of the target light source projection, effectively improving the accuracy of the three-dimensional model restored using the internal parameter matrix and the external parameter matrix, and also effectively improving the effect of calibrating the internal parameter matrix and the external parameter matrix of the camera array.
[0046] See also Figure 2The schematic diagram of shooting using a camera matrix provided by the embodiment of the present application is shown; the camera matrix (Camera Matrix), also known as a camera array, refers to a frame on which multiple cameras are fixed to form a calibrated camera matrix to collect images and videos of the target light source from different angles to the greatest extent. The camera matrix can include multiple cameras at different angles, etc. All cameras in the camera array can use a waveform generator to synchronize the shooting time, that is, try to make all cameras in the camera array shoot at the same time. In the specific implementation process, the camera matrix here can be set to a certain shape according to the specific actual situation. The shapes here include: cube, cuboid and sphere. The number of cameras can also be set according to the specific situation, for example, 30 cameras or 50 cameras are set in the camera matrix, etc.
[0047] The target light source refers to the light source object used to be photographed by the camera array. The image obtained after the camera array is photographed can be used to extract the image coordinate points of the light source image features (i.e., light source detection). There is no restriction on the generation of the light source. An easily identifiable light source can be used. Specifically, a red point light source of a light-emitting diode (LED) can be used. Specifically, an object with a single light source point or an object with multiple light sources points can be used. For ease of understanding and explanation, the embodiment of the present application is described in detail using an object with a single light source point of the target light source as an example.
[0048] See also Figure 3 The schematic diagram of the calibration rod of a single light source provided by an embodiment of the present application is shown; the calibration rod can be set on a robot or a vehicle, and the robot or vehicle is moved up and down, left and right in the camera matrix (the principle of movement is to make as many points as possible fall evenly on different cameras) until all cameras capture a preset number of light source images. Of course, a person can also hold the calibration rod and wave it up and down, left and right in the camera matrix until all cameras capture a preset number of light source images.
[0049] The implementation method of extracting the image coordinate points in the above step S110 includes: after photographing the calibration rod of a single light source using a camera matrix, obtaining multiple groups of images of the single light source point, and performing feature extraction on each group of images in the multiple groups of images to obtain a light source feature map; and then extracting the image coordinate points in the light source feature map. In the specific practice process, there are many implementation methods for extracting image coordinate points, which are difficult to list exhaustively. The following only uses one example to illustrate the above specific process.
[0050] The specific process of extracting features from each of the multiple groups of images may include: if the target light source is a red point light source of an LED, then the formula Extract the light source image features of each pixel from the image of a single light source point. It can be understood that by performing the above calculations on each pixel, an image composed of the light source image features of the entire image, i.e., a light source feature map, can be obtained. Among them, F is the light source image feature extracted from the image of a single light source point, R, G, and B represent the pixel values of the red channel, green channel, and blue channel in the color image, respectively, and ε is a minimum value, which is used to avoid division by 0. It can be set according to the specific situation, for example, 10 -6 , relu stands for the Rectified Linear Unit function, Represents the ratio of red pixels in the image. (0.3R+0.59G+0.11B) is a general formula for converting color RGB images to grayscale images. It can effectively adapt to the different brightness levels of the scene, thereby increasing the robustness of the feature extraction algorithm. In practice, it is found that the accuracy of extracting image coordinate points based on the image features of a single light source point is relatively high.
[0051] The specific process of extracting the image coordinate points in the light source feature map may include: using the Gaussian kernel function formula Gaussian difference function formula D (x,y,σ) =(G (x,y,σ+δ) -G (x,y,σ-δ) )*F (x,y) Calculate the light source feature map to obtain the Gaussian difference value of each pixel in the light source feature map, and then use the formula The Gaussian difference value of each pixel in the light source feature map is calculated to obtain the image coordinate point in the light source feature map. (x,y,σ) is the calculation result of the Gaussian kernel function, x and y represent the horizontal and vertical coordinates of the pixel points in the light source feature map, respectively, σ represents the variance value of all pixels in the light source feature map, and the variance value specifically represents the scale of the light source point (such as the red spot); D (x,y,σ) represents the use of Gaussian difference function to calculate the Gaussian difference value of each pixel. δ is a very small parameter, which is used to construct the scale difference operation. It can be set according to the situation. For example, 10 -2 or 10 -3 , * represents convolution operation, F (x,y) Represents the light source image feature of each pixel in the above light source feature map, that is, the light source image feature of the pixel corresponding to the horizontal coordinate x and the vertical coordinate y; threshold represents the preset threshold, which can be set according to the specific situation.
[0052] The implementation method of the above step S120 is, for example: after the image coordinate point extraction is completed, since there may be multiple image coordinate points extracted from the image taken by the same camera at the same time (for example, there are other similar light source noises in the environment) or no image coordinate points are extracted (for example, the target light source is not captured), it is necessary to perform feature matching on the image coordinate points in each group of images according to the image features of the target light source. Specifically, if multiple image coordinate points are extracted from the image or no image coordinate points are extracted, the image is deleted to obtain a valid image frame after deletion. Then, the image coordinate points corresponding to the deleted valid image frame are matched to obtain multiple matching coordinate point groups corresponding to each group of images (representing the matching relationship between the camera image and the feature image coordinate points). Among them, the specific matching method can be pairwise matching, and the role of feature matching is to associate the image coordinate points of the same target light source captured by different cameras, so as to facilitate the use of associated image coordinate points to delete according to epipolar constraints, as well as the initial internal parameter matrix and the initial external parameter matrix.
[0053] After obtaining multiple matching coordinate point groups corresponding to each group of images, the matching coordinate point groups that do not satisfy the epipolar constraints can be deleted from the multiple matching coordinate point groups by means of geometric verification, that is, the coordinate point groups that are incorrectly matched from the multiple matching coordinate point groups are removed. This implementation may include: for each group of images in the multiple groups of images, the matching coordinate point groups that do not satisfy the epipolar constraints are deleted from the multiple matching coordinate point groups corresponding to each group of images, and multiple matching coordinate point groups that satisfy the constraints are obtained.
[0054] As an optional implementation of step S130, the implementation of calculating the initial internal parameter matrix and the initial external parameter matrix may include:
[0055] Step S131: calculating the initial basic matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, where the initial basic matrix represents the conversion information between the camera coordinate system and the pixel coordinate system.
[0056] The implementation method of the above step S131 is, for example: using the random sample consensus (RANSAC) algorithm to calculate the initial basic matrix, specifically, 8 matching coordinate point groups are selected from multiple matching coordinate point groups that meet the constraints, and the 8 matching coordinate point groups are calculated using the eight-point method to obtain the first estimated basic matrix, and then, based on the first estimated basic matrix, the distance from the corresponding coordinate point of the remaining matching coordinate point group to the epipolar line is calculated. If the distance is less than a preset threshold (which can be set according to the specific situation, such as 16), the coordinate point is considered to be a qualified point, otherwise the coordinate point is considered to be an unqualified point. The above process is iterated for a preset number of times (which can be set according to the specific situation, such as 1024 times) in sequence to obtain the qualified points calculated multiple times. The estimated basic matrix with the largest number of qualified points is selected from the qualified points calculated multiple times, and the estimated basic matrix with the largest number of qualified points is determined as the initial basic matrix.
[0057] Step S132: Calculate an initial internal parameter matrix according to the width and height values of each group of images, and calculate an initial intrinsic matrix according to the initial internal parameter matrix and the initial basic matrix. The initial intrinsic matrix represents the conversion information between the camera coordinate system and the world coordinate system.
[0058] The above initial internal parameter matrix includes: camera focal length and image principal point coordinates. The initial internal parameter matrix can be expressed as Where f represents the focal length of the camera, f x and f y represent the normalized focal length on the x-axis and y-axis respectively, c represents the coordinate of the image principal point, c x and c y They represent the coordinates of the principal point on the x-axis and on the y-axis respectively.
[0059] As an optional implementation of the above step S132, the initial internal parameter matrix is calculated according to the width value and the height value of each group of images, including:
[0060] Step S132a: Determine the camera focal length in the initial internal parameter matrix according to the maximum value of the width value and the height value.
[0061] The implementation of the above step S132a is, for example: multiplying the maximum value of the width value and the height value by a preset value to determine the camera focal length in the initial internal parameter matrix; this process can be expressed as f x =f y =max(w,h)*b; where f x and f yRepresent the normalized focal length on the x-axis and y-axis respectively, w represents the width value of the image, h represents the height value of the image, and b represents a preset value. The preset value here can adopt the ratio of the estimated camera focal length to the sensor aperture. For example, the preset value here is set to 1.2 or 1.3, etc.
[0062] Step S132b: half of the width value is determined as the length value of the abscissa of the image principal point coordinates, and half of the height value is determined as the length value of the ordinate of the image principal point coordinates.
[0063] The implementation method of the above step S132b is, for example: according to the formula Determine the length of the horizontal and vertical coordinates of the image principal point coordinates; where c x and c y They represent the coordinates of the principal point on the x-axis and the y-axis respectively, w represents the width of the image, and h represents the height of the image.
[0064] Step S133: Perform singular value decomposition on the initial essential matrix to obtain an initial external parameter matrix.
[0065] The implementation method of the above step S133 is, for example: using a singular value decomposition (SVD) algorithm to perform singular value decomposition on the initial essential matrix, obtain the rotation matrix and translation vector of the camera, and determine the initial external parameter matrix according to the rotation matrix and translation vector of the camera. The initial external parameter matrix here can be expressed as Among them, R represents the rotation matrix and t represents the translation vector.
[0066] As an optional implementation of step S140, it is understandable that as the number of images to be calculated increases, errors will continue to accumulate. Therefore, it is necessary to optimize the initial internal parameter matrix and the initial external parameter matrix of the camera. The optimization method here may include:
[0067] Step S141: adjusting the initial internal parameter matrix and the initial external parameter matrix to change the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images.
[0068] The implementation method of the above step S141 is, for example: using a stochastic gradient descent (SGD), a stochastic parallel gradient descent (SPGD) algorithm or a Gauss-Newton iteration method to adjust the initial internal parameter matrix and the initial external parameter matrix to change the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images. The above distance error can be expressed by the formula: Among them, g(C,X) represents the distance error between the mapping coordinate point and the image coordinate point, C represents the internal parameter matrix and external parameter matrix in the camera, and C i represents the internal parameter matrix and external parameter matrix in the i-th camera, X represents the mapping coordinate point of the target light source projected in each set of images, and X j represents the jth mapping coordinate point, q ij represents the image coordinate points extracted from the image (i.e., light source detection), w ij Represents the weight parameter of the observation trajectory (the image coordinate point in the trajectory). When camera i observes the image coordinate point j in the trajectory, w ij Take 1. On the contrary, when camera i does not observe the image coordinate point j in the trajectory, w ij Take 0.
[0069] Step S142: determining the initial internal parameter matrix when the distance error is less than the preset threshold as the optimized internal parameter matrix, and determining the initial external parameter matrix when the distance error is less than the preset threshold as the optimized external parameter matrix.
[0070] An implementation example of the above-mentioned step S142 is as follows: after adjusting the initial internal parameter matrix and the initial external parameter matrix by adopting stochastic gradient descent or Gauss-Newton iteration, the initial internal parameter matrix when the distance error is less than a preset threshold can be determined as the optimized internal parameter matrix, and the initial external parameter matrix when the distance error is less than the preset threshold can be determined as the optimized external parameter matrix.
[0071] As an optional implementation of step S150, calibrating the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix in all cameras in the camera array includes:
[0072] Step S151: performing scale registration on the optimized internal parameter matrix and the optimized external parameter matrix to obtain a registration internal parameter matrix and a registration external parameter matrix.
[0073] Step S152: calibrate the registration intrinsic parameter matrix and the registration extrinsic parameter matrix in all cameras in the camera array.
[0074] An implementation example of the above-mentioned steps S151 to S152 is as follows: during the calibration process of all cameras in the camera array, since the three-dimensional reconstruction staff does not know the size of the three-dimensional object after the three-dimensional reconstruction (i.e., the spatial length), it is necessary to scale the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix to obtain the registered intrinsic parameter matrix and the registered extrinsic parameter matrix. Then, the registered intrinsic parameter matrix and the registered extrinsic parameter matrix are calibrated in all cameras in the camera array, so that the size of the three-dimensional real world can be better reconstructed into a predictable three-dimensional object size, effectively improving the accuracy of the three-dimensional model restored using the intrinsic parameter matrix and the extrinsic parameter matrix, and also effectively improving the effect of calibrating the intrinsic parameter matrix and the extrinsic parameter matrix of the camera array.
[0075] Specifically, a calibration rod of a plane shape of any multi-point light source can be used, and the plane shapes here include: Z-shaped, polygonal, circular, T-shaped and Y-shaped. For ease of understanding and explanation, the T-shaped calibration rod is used as an example for explanation. For example: place the T-shaped calibration rod on a horizontal ground, turn on all cameras in the camera array to shoot an image of the T-shaped calibration rod, and obtain multiple images taken by all cameras; then, perform feature extraction on each of the multiple images to obtain a light source feature map, and determine the camera's internal parameter matrix and external parameter matrix based on the image coordinate points in the extracted light source feature map. Then, perform three-dimensional reconstruction based on the camera's internal parameter matrix and external parameter matrix, that is, reconstruct the three-dimensional coordinate points of the T-shaped calibration rod to obtain the reconstructed coordinate points of the T-shaped.
[0076] Since there is a difference between the reconstructed coordinate points of the T-shape and the real three-dimensional coordinate points of the T-shape by a transformation matrix A, and the transformation matrix A includes a scale matrix S and a rotation matrix R, then we can use the formula A=RS calculates the transformation matrix; wherein A represents the transformation matrix, S represents the scale matrix, R represents the rotation matrix, and θ represents the degree of clockwise rotation.
[0077] Finally, the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix are scale-aligned according to the transformation matrix to obtain the registered intrinsic parameter matrix and the registered extrinsic parameter matrix, and the registered intrinsic parameter matrix and the registered extrinsic parameter matrix are calibrated in all cameras in the camera array, so that the size of the three-dimensional real world can be better reconstructed into a predictable three-dimensional object size.
[0078] As an optional implementation, the target light source in the embodiment of the present application is a single light source point that moves continuously. For example, the target light source above can be a handheld single light source point calibration rod that is waved and shaken in front of the camera array until the camera captures all the three-dimensional space points that need to be collected.
[0079] See also Figure 4The structure diagram of the camera array calibration device provided in the embodiment of the present application is shown; the embodiment of the present application provides a camera array calibration device 200, including:
[0080] The image light source detection module 210 is used to acquire multiple groups of images and perform light source detection on each group of images in the multiple groups of images to obtain the image coordinate points of the target light source in each group of images. Each group of images in the multiple groups of images is an image of the target light source in motion captured at the same time using all cameras in the camera array.
[0081] The image feature matching module 220 is used to perform feature matching on the image coordinate points in each group of images according to the image features of the target light source, and obtain a plurality of matching coordinate point groups corresponding to each group of images.
[0082] The mapping coordinate calculation module 230 is used to calculate the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, and calculate the mapping coordinate points of the target light source projected in each group of images according to the initial internal parameter matrix and the initial external parameter matrix.
[0083] The distance error optimization module 240 is used to optimize the initial internal parameter matrix and the initial external parameter matrix of all cameras according to the distance error between the mapping coordinate point in each group of images and the image coordinate point in each group of images to obtain the optimized internal parameter matrix and the optimized external parameter matrix.
[0084] The camera array calibration module 250 is used to calibrate the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix in all cameras in the camera array.
[0085] Optionally, in the embodiment of the present application, the camera array calibration device further includes:
[0086] The coordinate point group deletion module is used to delete the matching coordinate point groups that do not meet the epipolar constraint from the multiple matching coordinate point groups corresponding to each group of images in the multiple groups of images.
[0087] Optionally, in an embodiment of the present application, the mapping coordinate calculation module includes:
[0088] The basic matrix calculation module is used to calculate the initial basic matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images. The initial basic matrix represents the conversion information between the camera coordinate system and the pixel coordinate system.
[0089] The essential matrix calculation module is used to calculate the initial internal parameter matrix according to the width and height values of each group of images, and calculate the initial essential matrix according to the initial internal parameter matrix and the initial basic matrix. The initial essential matrix represents the conversion information between the camera coordinate system and the world coordinate system.
[0090] The essential matrix decomposition module is used to perform singular value decomposition on the initial essential matrix to obtain the initial external parameter matrix.
[0091] Optionally, in an embodiment of the present application, the initial internal parameter matrix includes: camera focal length and image principal point coordinates; the essential matrix calculation module includes:
[0092] The camera focal length determination module is used to determine the camera focal length in the initial internal parameter matrix according to the maximum value of the width value and the height value.
[0093] The principal point coordinate determination module is used to determine half of the width value as the length value of the abscissa of the principal point coordinate, and to determine half of the height value as the length value of the ordinate of the principal point coordinate.
[0094] Optionally, in an embodiment of the present application, the distance error optimization module includes:
[0095] The parameter matrix adjustment module is used to adjust the initial internal parameter matrix and the initial external parameter matrix to change the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images.
[0096] The parameter matrix determination module is used to determine the initial internal parameter matrix when the distance error is less than a preset threshold as the optimized internal parameter matrix, and to determine the initial external parameter matrix when the distance error is less than a preset threshold as the optimized external parameter matrix.
[0097] Optionally, in an embodiment of the present application, a camera array calibration module includes:
[0098] The matrix scale registration module is used to perform scale registration on the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix to obtain the registration intrinsic parameter matrix and the registration extrinsic parameter matrix.
[0099] The parameter matrix calibration module is used to calibrate the registration intrinsic parameter matrix and the registration extrinsic parameter matrix in all cameras in the camera array.
[0100] Optionally, in an embodiment of the present application, the target light source is a single light source point that moves continuously.
[0101] It should be understood that the device corresponds to the above-mentioned camera array calibration method embodiment and can execute the various steps involved in the above-mentioned method embodiment. The specific functions of the device can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device.
[0102] See also Figure 5The electronic device 300 provided in the embodiment of the present application includes: a processor 310 and a memory 320, wherein the memory 320 stores machine-readable instructions executable by the processor 310, and when the machine-readable instructions are executed by the processor 310, the above method is executed.
[0103] The embodiment of the present application further provides a computer-readable storage medium 330 , on which a computer program is stored. When the computer program is executed by the processor 310 , the above method is executed.
[0104] Among them, the computer-readable storage medium 330 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0105] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0106] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device embodiments described above are only schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a part of a module, a program segment or a code, and a part of a module, a program segment or a code includes one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also be different from the order of occurrence marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which is mainly determined by the functions involved.
[0107] In addition, each functional module of each embodiment in the embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. In addition, in the description of this specification, the description of reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present application. In this specification, the schematic representation of the above terms does not necessarily have to be directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples without contradicting each other.
[0108] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0109] The above description is only an optional implementation manner of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiments of the present application, which should be covered within the protection scope of the embodiments of the present application.
Claims
1. A camera array calibration method, characterized in that: include: Acquire multiple groups of images, and perform light source detection on each group of images in the multiple groups of images to obtain image coordinate points of a target light source in each group of images, wherein each group of images in the multiple groups of images is an image of a target light source in motion captured at the same time by all cameras in a camera array; Performing feature matching on the image coordinate points in each group of images according to the image features of the target light source to obtain a plurality of matching coordinate point groups corresponding to each group of images; Calculate the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, and calculate the mapping coordinate points of the target light source projected in each group of images according to the initial internal parameter matrix and the initial external parameter matrix; According to the distance error between the mapping coordinate point in each group of images and the image coordinate point in each group of images, the initial internal parameter matrix and the initial external parameter matrix of all cameras are optimized to obtain the optimized internal parameter matrix and the optimized external parameter matrix; Calibrate the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix in all cameras in the camera array; The step of calculating the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images includes: calculating the initial basic matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, wherein the initial basic matrix represents the conversion information between the camera coordinate system and the pixel coordinate system; calculating the initial internal parameter matrix according to the width value and the height value of each group of images, and calculating the initial essential matrix according to the initial internal parameter matrix and the initial basic matrix, wherein the initial essential matrix represents the conversion information between the camera coordinate system and the world coordinate system; and performing singular value decomposition on the initial essential matrix to obtain the initial external parameter matrix.
2. The method according to claim 1, characterized in that Before calculating the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, the method further includes: For each group of images in the plurality of groups of images, a matching coordinate point group that does not satisfy the epipolar constraint is deleted from a plurality of matching coordinate point groups corresponding to each group of images.
3. The method according to claim 1, characterized in that: The initial internal parameter matrix includes: camera focal length and image principal point coordinates; the initial internal parameter matrix is calculated according to the width value and height value of each group of images, including: Determine the camera focal length in the initial internal parameter matrix according to the maximum value of the width value and the height value; Half of the width value is determined as the length value of the abscissa of the image principal point coordinates, and half of the height value is determined as the length value of the ordinate of the image principal point coordinates.
4. The method according to claim 1, characterized in that: The initial internal parameter matrix and the initial external parameter matrix of all cameras are optimized to obtain the optimized internal parameter matrix and the optimized external parameter matrix, including: Adjusting the initial internal parameter matrix and the initial external parameter matrix to change the distance error between the mapping coordinate points in each group of images and the image coordinate points in each group of images; The initial internal parameter matrix when the distance error is less than a preset threshold is determined as the optimized internal parameter matrix, and the initial external parameter matrix when the distance error is less than a preset threshold is determined as the optimized external parameter matrix.
5. The method according to claim 1, characterized in that The step of calibrating the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix in all cameras in the camera array includes: Performing scale registration on the optimized internal parameter matrix and the optimized external parameter matrix to obtain a registration internal parameter matrix and a registration external parameter matrix; The registration intrinsic parameter matrix and the registration extrinsic parameter matrix are calibrated in all cameras in the camera array.
6. The method according to any one of claims 1 to 5, characterized in that: The target light source is a single light source point that moves continuously.
7. A camera array calibration device, characterized in that: include: An image light source detection module is used to acquire multiple groups of images, and perform light source detection on each group of images in the multiple groups of images to obtain image coordinate points of a target light source in each group of images, wherein each group of images in the multiple groups of images is an image of a target light source in motion captured at the same time by all cameras in a camera array; An image feature matching module, used to perform feature matching on the image coordinate points in each group of images according to the image features of the target light source, to obtain a plurality of matching coordinate point groups corresponding to each group of images; A mapping coordinate calculation module, used to calculate the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, and calculate the mapping coordinate points of the target light source projected in each group of images according to the initial internal parameter matrix and the initial external parameter matrix; A distance error optimization module is used to optimize the initial internal parameter matrix and the initial external parameter matrix of all cameras according to the distance error between the mapping coordinate point in each group of images and the image coordinate point in each group of images, so as to obtain an optimized internal parameter matrix and an optimized external parameter matrix; A camera array calibration module, used to calibrate the optimized intrinsic parameter matrix and the optimized extrinsic parameter matrix in all cameras in the camera array; The step of calculating the initial internal parameter matrix and the initial external parameter matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images includes: calculating the initial basic matrix of all cameras in the camera array according to the multiple matching coordinate point groups corresponding to each group of images, wherein the initial basic matrix represents the conversion information between the camera coordinate system and the pixel coordinate system; calculating the initial internal parameter matrix according to the width value and the height value of each group of images, and calculating the initial essential matrix according to the initial internal parameter matrix and the initial basic matrix, wherein the initial essential matrix represents the conversion information between the camera coordinate system and the world coordinate system; and performing singular value decomposition on the initial essential matrix to obtain the initial external parameter matrix.
8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method according to any one of claims 1 to 6 is performed.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is executed.
Citation Information
Patent Citations
Calibration phantom, calibration device and calibration method for calibrating geometric parameters in CT (Computed Tomography) system
CN103006251A
Multi-camera calibration method in large space environment based on optical motion capture and related equipment
CN113592950A
