Camera parameter calibration method, device, electronic device and computer readable medium
By constructing camera calibration scene information and optimization algorithms, the problem of insufficient high-precision sensors and Sky Eagle Optimizer algorithms is solved, low-cost and efficient camera parameter calibration is achieved, and calibration accuracy and versatility is improved.
Patent Information
- Application Number
- CN202410629799.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-05-21
AI Technical Summary
The existing camera parameter calibration methods require high-precision sensors, resulting in increased cost and time, and the local search capability of the Skyhawk Optimizer algorithm is insufficient, resulting in low calibration accuracy.
By obtaining the parameter set of the camera to be calibrated, the camera calibration scene information is constructed, the feature point extraction and coordinate matching is used to use the QR code calibration plate and the fixed device, and the corner point reprojection target fitness function and adaptive update strategy are combined to optimize the camera's internals. and external parameters.
The cost and time of camera calibration is reduced, the versatility and accuracy of calibration is improved, local optimal solutions are avoided, and optimization efficiency and accuracy are improved.
Smart Images

Figure CN118411426B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a camera parameter calibration method, device, electronic device, and computer-readable medium. Background Art
[0002] Camera parameter calibration is the process of solving the parameters of the camera imaging geometric model. The internal parameters of the camera are determined before leaving the factory, but since the subsequent use of the camera will cause changes in the camera's internal parameters and changes in the camera's external parameters in different shooting scenes, it is necessary to calibrate the camera parameters when using the camera. For the calibration of camera parameters, the usual method is to determine the position information set of the camera to be calibrated and the calibrated high-precision sensor, and generate a calibration system. Secondly, by presetting the QR code calibration plate, the camera to be calibrated and the high-precision sensor in the calibration system are controlled to collect the calibration plate image set and the sensor data set. Then, feature point matching is performed on the calibration plate image set and the sensor data set to obtain a matching result set. Finally, the internal and external parameter set of the camera to be calibrated is generated by characterizing the successfully matched feature points in the matching result set to complete the parameter calibration of the camera to be calibrated.
[0003] However, it is found in practice that when the above method is used to calibrate camera parameters, the following technical problems often occur: Since joint calibration requires additional high-precision sensors, the calibration cost of the camera calibration will increase, and the data synchronization between the calibrated high-precision sensor and the camera to be calibrated will increase the amount of calculation and the calibration system is not universal, resulting in increased calibration cost and time, low calibration efficiency and waste of computing resources.
[0004] In the process of adopting technical solutions to solve the above-mentioned technical problem one, the following technical problem two is often accompanied: since the internal and external parameters obtained through feature matching points may have certain errors, directly using the internal and external parameters as the calibrated internal and external parameters will result in low accuracy of camera calibration. In response to the above-mentioned technical problem two, the conventional solution is generally: using the Eagle optimizer algorithm to optimize the obtained internal and external parameters to obtain optimized internal and external parameters. However, the above-mentioned conventional solution still has the following problems: due to the insufficient local search capability of the Eagle optimizer algorithm, it is easy to fall into the local optimal solution, resulting in low algorithm search efficiency, long internal and external parameter optimization time and low optimization accuracy, which leads to low accuracy of camera parameter calibration.
[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention
[0006] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0007] Some embodiments of the present disclosure propose a camera parameter calibration method, an apparatus, an electronic device, and a computer-readable medium to solve one or more of the technical problems mentioned in the above background technology section.
[0008] In a first aspect, some embodiments of the present disclosure provide a camera parameter calibration method, comprising: obtaining a parameter set to be calibrated of a camera to be calibrated; constructing camera calibration scene information according to the parameter set to be calibrated, a preset two-dimensional code calibration plate set and a camera fixture, wherein the camera fixture is a device composed of the camera to be calibrated and a camera fixing base assembly; controlling the camera fixture to move to each preset shooting angle in a preset shooting angle set to perform calibration plate image acquisition on the preset two-dimensional code calibration plate set to obtain a two-dimensional code image group set; based on the two-dimensional code image group set, executing the following camera calibration steps: performing feature point extraction processing on each two-dimensional code image in the two-dimensional code image group set to generate an image feature point group to obtain multiple image feature point group sets; determining multiple image feature point groups The two-dimensional pixel coordinates and three-dimensional space coordinates of each image feature point in the set are obtained to obtain multiple two-dimensional pixel coordinate sets and multiple three-dimensional space coordinate sets; based on the multiple two-dimensional pixel coordinate sets and multiple three-dimensional space coordinate sets, the camera internal parameter set of the camera to be calibrated and the camera external parameter set under the camera calibration scene information are generated; based on the camera internal parameter set and the camera external parameter set, the three-dimensional coordinate set of the corner points corresponding to the corner point set of the target two-dimensional code image is determined, wherein the target two-dimensional code image is an image acquired by controlling the camera to be calibrated to move to a preset shooting angle excluding the preset shooting angle set; the coordinate error of the corner point three-dimensional coordinate set and the preset corner point three-dimensional coordinate set is determined; in response to determining that the coordinate error is within the preset coordinate error range, the parameter calibration of the camera to be calibrated is completed.
[0009] In a second aspect, some embodiments of the present disclosure provide a camera parameter calibration device, comprising: an acquisition unit, configured to acquire a set of parameters to be calibrated of a camera to be calibrated; a construction unit, configured to construct camera calibration scene information according to the above-mentioned set of parameters to be calibrated, a preset two-dimensional code calibration plate set and a camera fixing device, wherein the above-mentioned camera fixing device is a device composed of the above-mentioned camera to be calibrated and a camera fixing base assembly; a control unit, configured to control the above-mentioned camera fixing device to move to each preset shooting angle in a preset shooting angle set, so as to perform calibration plate image acquisition on the above-mentioned preset two-dimensional code calibration plate set, and obtain a two-dimensional code image group set; an execution unit, configured to execute the following camera calibration steps based on the two-dimensional code image group set: perform feature point extraction processing on each two-dimensional code image in the two-dimensional code image group set, so as to generate an image feature point group, and obtain multiple A set of image feature points; determining the two-dimensional pixel coordinates and the three-dimensional space coordinates of each image feature point in a plurality of image feature point sets to obtain a plurality of two-dimensional pixel coordinate sets and a plurality of three-dimensional space coordinate sets; generating a camera internal parameter set of the camera to be calibrated and a camera external parameter set under the camera calibration scene information according to the plurality of two-dimensional pixel coordinate sets and the plurality of three-dimensional space coordinate sets; determining a three-dimensional coordinate set of corner points corresponding to a corner point set of a target two-dimensional code image according to the camera internal parameter set and the camera external parameter set, wherein the target two-dimensional code image is an image acquired by controlling the camera to be calibrated to move to a preset shooting angle excluding the preset shooting angle set; determining the coordinate errors of the three-dimensional coordinate set of corner points and the preset three-dimensional coordinate set of corner points; in response to determining that the coordinate error is within a preset coordinate error range, completing the parameter calibration of the camera to be calibrated.
[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.
[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method described in any implementation manner in the first aspect is implemented.
[0012] The above-mentioned embodiments of the present disclosure have the following beneficial effects: the camera parameter calibration method of some embodiments of the present disclosure can reduce the cost and time of camera calibration, and improve the versatility and accuracy of camera calibration. Specifically, the reasons for the increase in relevant calibration costs and time, low calibration efficiency and waste of computing resources are: since joint calibration requires additional high-precision sensors, the calibration cost of camera calibration will be increased, and the data synchronization of the calibration high-precision sensor and the camera to be calibrated will increase a large amount of computing and the calibration system is not universal, resulting in an increase in calibration costs and time, low calibration efficiency and waste of computing resources. Based on this, the camera parameter calibration method of some embodiments of the present disclosure can first obtain the parameter set to be calibrated of the camera to be calibrated. Here, the parameter set to be calibrated is convenient for the subsequent construction of camera calibration scene information. Secondly, according to the above-mentioned parameter set to be calibrated, the preset two-dimensional code calibration plate set and the camera fixing device, the camera calibration scene information is constructed, wherein the above-mentioned camera fixing device is a device composed of the above-mentioned camera to be calibrated and the camera fixing base assembly. Here, the versatility of the calibration scenes of different types of cameras can be improved, and the camera calibration efficiency can be improved. Then, the camera fixing device is controlled to move to each preset shooting angle in the preset shooting angle set, so as to collect the calibration plate image of the preset two-dimensional code calibration plate set, and obtain a two-dimensional code image set. Here, the two-dimensional code image set is used for the subsequent calibration of the camera through two-dimensional pixel coordinates and three-dimensional space coordinates. Finally, based on the two-dimensional code image set, the following camera calibration steps are performed: the first step is to perform feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group and obtain multiple image feature point sets. Here, since the two-dimensional code image set is an image with binary coding and numbering information, the world coordinate system can be directly established, and the calibration of the camera can be completed when the preset two-dimensional code calibration plate is partially blocked, and the information stored in the two-dimensional code image and the coding information can be accurately extracted, so as to improve the integrity of the information included in the image feature points. The second step is to determine the two-dimensional pixel coordinates and three-dimensional space coordinates of each image feature point in the multiple image feature point sets, and obtain multiple two-dimensional pixel coordinate sets and multiple three-dimensional space coordinate sets. Here, multiple two-dimensional code pixel coordinate sets and multiple three-dimensional space coordinate sets are convenient for subsequent calibration of internal and external parameters of the camera. The third step is to generate the camera internal parameter set of the camera to be calibrated and the camera external parameter set under the camera calibration scene information according to the multiple two-dimensional pixel coordinate sets and the multiple three-dimensional space coordinate sets. Here, the camera internal parameter set can improve the accuracy and precision of camera imaging, and can eliminate the distortion in camera imaging, thereby improving the accuracy of camera calibration. The camera external parameter set can realize the geometric transformation of two-dimensional pixel coordinates and three-dimensional space coordinates, which is convenient for subsequent camera calibration.The fourth step is to determine the three-dimensional coordinate set of the corner points corresponding to the corner point set of the target two-dimensional code image according to the internal parameter set of the camera and the external parameter set of the camera, wherein the above-mentioned target two-dimensional code image is an image collected by controlling the above-mentioned camera to be calibrated to move to a preset shooting angle other than the above-mentioned preset shooting angle set. Here, it is convenient to determine the coordinate error between the three-dimensional coordinates of the corner points and the three-dimensional coordinates of the real corner points by the calibrated camera in the future. The fifth step is to determine the coordinate error between the three-dimensional coordinate set of the corner points and the three-dimensional coordinate set of the preset corner points. Here, determining the coordinate error is convenient to improve the accuracy of camera calibration. The sixth step is to complete the parameter calibration of the above-mentioned camera to be calibrated in response to determining that the coordinate error is within the preset coordinate error range. It can be obtained that the camera parameter calibration method can reduce the cost and efficiency of camera calibration and improve the versatility of camera calibration through the calibration iteration cycle and the camera fixing device. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0014] Figure 1 is a flow chart of some embodiments of the camera parameter calibration method according to the present disclosure;
[0015] Figure 2 It is a schematic diagram of camera calibration scene information according to some embodiments of the camera parameter calibration method disclosed in the present invention.
[0016] Figure 3 is a schematic structural diagram of some embodiments of the camera parameter calibration device according to the present disclosure;
[0017] Figure 4 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0020] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0021] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0022] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0023] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0024] Figure 1 The process 100 of some embodiments of the camera parameter calibration method according to the present disclosure is shown. The camera parameter calibration method comprises the following steps:
[0025] Step 101, obtaining a set of parameters to be calibrated of a camera to be calibrated.
[0026] In some embodiments, the execution subject of the above-mentioned camera parameter calibration method can obtain the parameter set to be calibrated of the camera to be calibrated through a wired connection or a wireless connection. Among them, the camera to be calibrated can be a camera with external parameters waiting for calibration and internal parameters calibrated when the camera leaves the factory. The above-mentioned parameter set to be calibrated can be a camera internal parameter set and a camera external parameter set. The above-mentioned camera internal parameter set can be a parameter describing the internal properties of the camera. The above-mentioned camera internal parameter set may include: camera focal length, camera principal point coordinates, coordinate axis tilt coefficient, physical size of pixel, radial distortion coefficient and tangential distortion parameter. The above-mentioned camera external parameter set may be a parameter set describing the position and posture of the camera in the world coordinate system. The above-mentioned camera external parameter set may include: rotation matrix and translation vector.
[0027] Step 102, constructing camera calibration scene information according to the parameter set to be calibrated, the preset two-dimensional code calibration plate set and the camera fixing device.
[0028] In some embodiments, the execution subject may construct the camera calibration scene information according to the parameter set to be calibrated, the preset two-dimensional code calibration plate set and the camera fixing device. The camera fixing device is a device composed of the camera to be calibrated and the camera fixing base assembly. The camera fixing base assembly may be a component for fixing the camera to be calibrated and adapting to different types of cameras to be calibrated. The preset two-dimensional code calibration plate in the preset two-dimensional code calibration plate set may be a calibration plate composed of multiple ArUco (Augmented Reality University of Cordoba) two-dimensional codes designed and generated in advance and placed at a preset interval. The ArUco two-dimensional code may be a two-dimensional code composed of a black border and an internal Hamming code matrix. The camera calibration scene information may be information describing the scene of calibrating the camera to be calibrated. The camera calibration scene information may include at least one of the following: the position information set and calibration plate size of the preset two-dimensional code calibration plate set, the interval distance between the preset two-dimensional code calibration plates, the position information of the camera fixing device and the shooting rotation information. For example, the size of the calibration plate may be 7*7 mm. The interval distance may be 35 mm. The schematic diagram of the camera calibration scene corresponding to the above camera calibration scene information is as follows Figure 2 shown. Figure 2 The middle circle is the location of the camera fixture. Figure 2 The middle rectangular part is the location where the preset two-dimensional code calibration plate is placed. The location where the preset two-dimensional code calibration plate is placed can be a location where the camera to be calibrated with the same focal length is at equal distances from the camera fixing device in three directions of 0 degrees, 90 degrees and 225 degrees. Figure 2 The direction indicated by the middle arrow is the direction in which the above-mentioned camera fixing base assembly is installed.
[0029] As an example, the execution subject may determine the distance position information set of the preset two-dimensional code calibration plate set in the camera calibration scene information through the internal parameter set of the camera at the factory in the parameter set to be calibrated. The distance position information in the distance position information set may be a position obtained when the image of the preset two-dimensional code calibration plate taken at the distance position occupies one quarter of the entire captured image. The distance position information may be a distance position that changes dynamically according to the focal length of the camera to be calibrated. Then, the distance position information set, the calibration plate size and preset spacing distance of the preset two-dimensional code calibration plate, and the preset distance and preset fixing direction of the camera fixing device are determined as the camera calibration scene information.
[0030] In some optional implementations of some embodiments, the camera fixing device includes: the camera to be calibrated, a camera fixing base, a camera adjustment component and a camera adaptation intermediate component.
[0031] In response to determining that the camera to be calibrated is a dynamic camera to be calibrated, the camera to be calibrated is fixed to the camera adaptation middle component by a protruding buckle, and the camera adaptation middle component is used to adapt to different types of cameras to be calibrated. The dynamic camera to be calibrated can be a camera that shoots motion scenes by global exposure.
[0032] The camera fixing base and the camera adapter intermediate component are fixed via a raised buckle, and the camera fixing base is used to fix the camera to be calibrated.
[0033] In response to determining that the camera to be calibrated is a static camera to be calibrated, the camera adapter intermediate component is fixed to the camera motor by threads, the camera to be calibrated is installed on the rotating shaft of the camera motor, and the camera motor is used to drive the camera to be calibrated to adjust the shooting angle. The static camera to be calibrated can be a camera that shoots static images by a rolling exposure method. For example, the static camera to be calibrated can be a digital SLR camera.
[0034] The camera adjustment component is installed inside the camera fixing base, and the camera adjustment component is used to control the camera to be calibrated to perform rotation adjustment.
[0035] Step 103, controlling the camera fixing device to move to each preset shooting angle in the preset shooting angle set, so as to collect calibration plate images of the preset two-dimensional code calibration plate set, and obtain a two-dimensional code image group set.
[0036] In some embodiments, the execution subject may control the camera fixing device to move to each preset shooting angle in the preset shooting angle set, so as to collect the calibration plate image of the preset two-dimensional code calibration plate set, and obtain a two-dimensional code image group set. Among them, the two-dimensional code image in the two-dimensional code image group set may be an image obtained by shooting the preset two-dimensional code calibration plate. Each preset shooting angle in the preset shooting angle set may be a preset shooting angle of the camera to be calibrated shooting the preset two-dimensional code calibration plate. For example, the preset shooting angle set may include: 0 degrees, 90 degrees and 225 degrees.
[0037] Step 104, based on the QR code image set, perform the following camera calibration steps:
[0038] Step 1041 , performing feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group, thereby obtaining a plurality of image feature point group sets.
[0039] In some embodiments, the execution subject may perform feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group and obtain multiple image feature point group sets. The image feature points in the image feature point group may be vertices in the two-dimensional code image with numbering information and Hamming code matrix encoding information. In practice, the execution subject may use a corner point detection algorithm to perform corner point detection on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group and obtain multiple image feature point group sets. The corner point detection algorithm may be an ORB (Oriented FAST and Rotated BRIEF) algorithm.
[0040] In some optional implementations of some embodiments, the above-mentioned feature point extraction process is performed on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group to obtain multiple image feature point groups, which may include the following steps:
[0041] In the first step, for each of the two-dimensional code images in the two-dimensional code image set, the following feature point recognition steps are performed:
[0042] Sub-step 1, grayscale processing is performed on the above-mentioned two-dimensional code image to obtain a two-dimensional code grayscale image. The above-mentioned two-dimensional code grayscale image can be an image in which each pixel included in the two-dimensional code grayscale image is represented by a sampled color. In practice, the above-mentioned execution subject can determine the average value of the three-component brightness of the pixel for each pixel in the pixel set included in the above-mentioned two-dimensional code image as the grayscale value of the pixel. Then, the grayscale pixel set corresponding to the obtained grayscale value set is replaced with the pixel set in the above-mentioned two-dimensional code image to obtain the two-dimensional code grayscale image.
[0043] Sub-step 2, binarizing the two-dimensional code grayscale image to obtain a two-dimensional code binary image. The two-dimensional code binary image may be an image in which each pixel in the pixel set is represented by black or white. In practice, the execution subject may use an adaptive threshold binarization algorithm to binarize the two-dimensional code grayscale image to obtain a two-dimensional code binary image. The adaptive threshold binarization algorithm may be a large law.
[0044] Sub-step 3, denoising the two-dimensional code binary image to obtain a denoised two-dimensional code binary image. In practice, the execution subject may use a nonlinear filtering algorithm to denoise the two-dimensional code binary image to obtain a denoised two-dimensional code binary image. The nonlinear filtering algorithm may be one of the following: extended Kalman algorithm, untraceable Kalman algorithm, and volumetric Kalman algorithm.
[0045] Sub-step 4, performing contour extraction processing on the above-mentioned denoised two-dimensional code binary image to obtain a two-dimensional code edge contour image. The above-mentioned two-dimensional code contour image can be an image of the outer contour that distinguishes black polygons and white polygons. In practice, the above-mentioned execution subject can use the Hough transform algorithm to perform contour extraction processing on the above-mentioned denoised two-dimensional code binary image to obtain a two-dimensional code edge contour image.
[0046] Sub-step 5, polygon simplification processing is performed on the edge contour set included in the above-mentioned two-dimensional code edge contour image to obtain a two-dimensional code contour compression image. The above-mentioned two-dimensional code contour compression image can be an image after smoothing the edge contours in the edge contour set. In practice, the above-mentioned execution subject can use Douglas-Peucker algorithm to perform polygon simplification processing on the edge contour set included in the above-mentioned two-dimensional code edge contour image to obtain a two-dimensional code contour compression image.
[0047] Sub-step 6, performing perspective transformation processing on the above-mentioned two-dimensional code outline compressed image to obtain the two-dimensional code image after perspective transformation. In practice, the above-mentioned execution subject can first determine the homography matrix of the above-mentioned two-dimensional code outline compressed image. Among them, the above-mentioned homography matrix can be a matrix that describes the image plane projection transformation of the above-mentioned two-dimensional code outline compressed image. Then, the above-mentioned two-dimensional code outline compressed image is perspective transformed through the above-mentioned homography matrix to obtain the two-dimensional code image after perspective transformation.
[0048] Sub-step 7, performing feature point recognition processing on the perspective transformed two-dimensional code image to obtain an image feature point group. In practice, the execution subject may first use the Ostu (Otsu method) algorithm to perform threshold processing on the perspective transformed two-dimensional code image to obtain a thresholded image. Then, the thresholded image is divided into regular grids to obtain a grid-divided image. Finally, the grid-divided image is identified by Hamming code numbering to obtain an image feature point group.
[0049] In some optional implementations of some embodiments, the binarization of the two-dimensional code grayscale image to obtain a two-dimensional code binary image may include the following steps:
[0050] The first step is to determine the pixel grayscale extreme difference of the pixel grayscale value set in each preset window in the two-dimensional code grayscale image to obtain the pixel extreme difference set. The preset window can be a pre-set window. For example, the preset window can be a window of 7*7 pixels. The pixel extreme difference can be the difference between the maximum pixel grayscale value and the minimum pixel grayscale value in the pixel grayscale set included in the preset window.
[0051] In the second step, at least one pixel extreme difference greater than or equal to a first preset pixel threshold is selected from the above pixel extreme difference set to obtain a first target pixel extreme difference set. The above first preset pixel threshold may be a preset threshold for distinguishing different ways of binarization of a preset window. For example, the above first preset pixel threshold may be 25 gray levels.
[0052] In the third step, for each first target pixel extreme difference in the first target pixel extreme difference set, the following binarization processing steps are performed:
[0053] Sub-step 1: for each preset pixel segmentation threshold in the preset pixel segmentation threshold set, perform the following determination steps:
[0054] In the first sub-step, according to the above-mentioned preset pixel segmentation threshold, the two-dimensional code grayscale local image corresponding to the preset window corresponding to the above-mentioned first target pixel extreme difference is segmented into foreground and background to obtain a two-dimensional code foreground local image and a two-dimensional code background local image. Among them, the above-mentioned preset pixel segmentation threshold set can be an integer type of pixel grayscale within the preset pixel segmentation threshold range. For example, the above-mentioned preset pixel segmentation threshold set can be an integer pixel grayscale value within [0,255]. The above-mentioned two-dimensional code foreground image can be an image composed of the grayscale values of each pixel in the two-dimensional code grayscale local image whose pixel grayscale value is greater than or equal to the preset pixel segmentation threshold. The above-mentioned two-dimensional code background image can be an image composed of the grayscale values of each pixel in the two-dimensional code grayscale local image whose pixel grayscale value is less than the preset pixel segmentation threshold.
[0055] As an example, the execution subject may determine the grayscale values of each pixel in the grayscale partial image of the two-dimensional code that is greater than or equal to the preset pixel segmentation threshold as the grayscale values of each pixel in the foreground partial image of the two-dimensional code. The grayscale values of each pixel in the grayscale partial image of the two-dimensional code that is less than the preset pixel segmentation threshold as the grayscale values of each pixel in the background partial image of the two-dimensional code.
[0056] The second sub-step is to determine the average grayscale value of the foreground partial image of the two-dimensional code and the background partial image of the two-dimensional code to obtain the foreground grayscale value of the two-dimensional code and the background grayscale value of the two-dimensional code.
[0057] In a third sub-step, the average of the foreground grayscale value of the two-dimensional code and the background grayscale value of the two-dimensional code is determined as the image average grayscale value of the grayscale image of the two-dimensional code.
[0058] The fourth sub-step is to determine the inter-class variance value of the grayscale image of the two-dimensional code according to the grayscale value of the two-dimensional code foreground, the grayscale value of the two-dimensional code background and the average grayscale value of the image. The inter-class variance value can represent the greater the difference between the local image of the two-dimensional code foreground and the local image of the two-dimensional code background.
[0059] As an example, the execution entity may first determine the square of the difference between the grayscale value of the foreground of the two-dimensional code and the average grayscale value of the image as the first pixel value. Secondly, determine the square of the difference between the grayscale value of the background of the two-dimensional code and the average grayscale value of the image as the second pixel value. Then, the sum of the product of the first pixel value and the first pixel weight coefficient and the product of the second pixel value and the second pixel weight coefficient is determined as the inter-class variance value. Among them, the first pixel weight coefficient may be the ratio of the number of pixel grayscale values included in the local image of the foreground of the two-dimensional code and the number of pixel grayscale values included in the grayscale image of the two-dimensional code. The second pixel weight coefficient may be the ratio of the number of pixel grayscale values included in the local image of the background of the two-dimensional code and the number of pixel grayscale values included in the grayscale image of the two-dimensional code.
[0060] Sub-step 2: Screen the obtained inter-class variance value set to obtain a target inter-class variance value, wherein the target inter-class variance value may be the inter-class variance value with the largest value in the inter-class variance value set.
[0061] Sub-step 3, binarizing the grayscale local image of the two-dimensional code according to the preset pixel segmentation threshold corresponding to the target inter-class variance value to obtain a binary local image of the two-dimensional code. The binary local image of the two-dimensional code may be an image composed of pixel grayscale values of 0 or 255.
[0062] As an example, the execution subject may set the grayscale value of each pixel in the local pixel set in the two-dimensional code grayscale local image that is less than the preset pixel segmentation threshold corresponding to the target inter-class variance value to 0. For the local pixel set in the two-dimensional code grayscale local image that is greater than or equal to the preset pixel segmentation threshold corresponding to the target inter-class variance value, the grayscale value of each pixel in the local pixel set is set to 255 to obtain a two-dimensional code binary local image.
[0063] In the fourth step, at least one pixel extreme difference that is less than a first preset pixel threshold is screened out from the above pixel extreme difference set to obtain a second target pixel extreme difference set.
[0064] The fifth step is to generate a two-dimensional code binary image based on the second target pixel extreme difference set and the obtained two-dimensional code binary local image set.
[0065] As an example, the execution subject may use an adaptive global binarization algorithm to perform binarization processing on the binarized image corresponding to the preset window corresponding to each second target pixel extreme difference in the second target pixel extreme difference set to obtain a two-dimensional code extreme difference binarized image set. Then, the two-dimensional code extreme difference binarized image set and the two-dimensional code binarized local image set are spliced to obtain a two-dimensional code binarized image.
[0066] In some optional implementations of some embodiments, the generating of the two-dimensional code binary image according to the second target pixel extreme difference set and the obtained two-dimensional code binary local image set may include the following steps:
[0067] In the first step, for each second target pixel extreme difference in the second target pixel extreme difference set, the following replacement steps are performed:
[0068] Sub-step 1: determine the mean value of the pixel grayscale values of the pixel grayscale value set included in the preset window corresponding to the second target pixel extreme difference, and obtain the window pixel mean value.
[0069] Sub-step 2, in response to determining that the above-mentioned window pixel mean is greater than or equal to the second preset pixel threshold, each pixel grayscale value in the pixel grayscale value set included in the preset window corresponding to the above-mentioned second target pixel extreme difference is set to a first preset replacement pixel value, and a first replacement binary local image is obtained. Wherein, the above-mentioned second preset pixel threshold can be a preset threshold for determining whether a pixel is a foreground pixel or a background pixel. For example, the above-mentioned second preset pixel threshold can be 100. The above-mentioned first preset replacement pixel grayscale value can be a preset pixel grayscale value for replacing each pixel grayscale value in the pixel grayscale value set included in the preset window. For example, the above-mentioned first preset replacement pixel grayscale value can be 255.
[0070] Sub-step 3, in response to determining that the above-mentioned window pixel mean is less than the above-mentioned second preset pixel threshold, each pixel grayscale value in the pixel grayscale value set included in the preset window corresponding to the above-mentioned second target pixel extreme difference is set to a second preset replacement pixel grayscale value, and a second replacement binary local image is obtained. The above-mentioned second preset replacement pixel grayscale value can be a pre-set pixel grayscale value for replacing each pixel grayscale value in the pixel grayscale value set included in the preset window. For example, the above-mentioned second preset replacement pixel grayscale value can be 0.
[0071] In the second step, the obtained first replacement binarized partial image set, the obtained second replacement binarized partial image set and the above two-dimensional code binarized partial image set are spliced to obtain a two-dimensional code binarized image.
[0072] In some optional implementations of some embodiments, the above-mentioned contour extraction processing is performed on the above-mentioned denoised two-dimensional code binary image to obtain the two-dimensional code edge contour image, which may include the following steps:
[0073] The first step is to perform smoothing filtering on the denoised two-dimensional code binary image to obtain a filtered two-dimensional code image. The smoothing filtering may be filtering performed by taking the grayscale value mean of the denoised two-dimensional code binary image.
[0074] The second step is to generate a two-dimensional code gradient image of the filtered two-dimensional code image, wherein the two-dimensional code gradient image may be an image representing the grayscale change rate and change direction of the filtered two-dimensional code image.
[0075] The third step is to determine the local maximum pixel point set in the two-dimensional code gradient image. In practice, the execution subject can use the Laplace operator to determine the local maximum pixel point set in the two-dimensional code gradient image.
[0076] The fourth step is to perform candidate point sampling on the above local maximum pixel point set to obtain a sampled candidate point set. The above subsequent point sampling can be random sampling.
[0077] The fifth step is to perform interpolation processing on the above-mentioned sampling candidate point set to obtain a pixel threshold surface. The above-mentioned pixel threshold surface can be a surface formed by a continuous pixel threshold set. The above-mentioned interpolation processing can be an interpolation processing performed using a bilinear interpolation algorithm.
[0078] In the sixth step, according to the pixel threshold surface, the denoised two-dimensional code binary image is subjected to image segmentation processing to obtain a set of segmented regions of the two-dimensional code image. The set of segmented regions of the two-dimensional code image can be a set of regions obtained by performing pixel grayscale value segmentation on the denoised two-dimensional code binary image using a pixel threshold set corresponding to the pixel threshold surface.
[0079] As an example, the execution subject may use a watershed segmentation algorithm to perform image segmentation processing on the denoised two-dimensional code binary image according to the pixel threshold surface to obtain a set of two-dimensional code image segmentation regions.
[0080] In the seventh step, the above two-dimensional code image segmentation region set is subjected to regional fusion processing to obtain a regional fusion region set. In practice, the above execution subject uses the RAG (Region Adjacency Graph) algorithm to perform regional fusion processing on the above two-dimensional code image segmentation region set to obtain a regional fusion region set.
[0081] In the eighth step, edge contour extraction is performed on each region fusion region in the region fusion region set to generate a region edge contour, thereby obtaining a region edge contour set.
[0082] In the ninth step, the two-dimensional code image corresponding to the above-mentioned area edge contour set is determined as the two-dimensional code edge contour image.
[0083] Step 1042 , determining the two-dimensional pixel coordinates and the three-dimensional space coordinates of each image feature point in the plurality of image feature point sets, and obtaining a plurality of two-dimensional pixel coordinate sets and a plurality of three-dimensional space coordinate sets.
[0084] In some embodiments, the execution subject may determine the two-dimensional pixel coordinates and three-dimensional space coordinates of each image feature point in a plurality of image feature point sets, and obtain a plurality of two-dimensional pixel coordinate sets and a plurality of three-dimensional space coordinate sets. Among them, the two-dimensional pixel coordinates in the plurality of two-dimensional pixel coordinate sets may be the pixel coordinates of the image feature point in the pixel coordinate system. The three-dimensional space coordinates in the plurality of three-dimensional space coordinate sets may be the position coordinates of the image feature point in the world coordinates. The coordinate origin of the pixel coordinate system is the pixel point corresponding to the upper left corner of the two-dimensional code image. The three-dimensional space coordinates may be coordinates obtained by the size information and spacing distance of the preset world coordinate system and the preset two-dimensional code calibration plate. For example, the origin of the world coordinate system is the vertex of the upper left corner of the preset two-dimensional code calibration plate. Then the three-dimensional space coordinates of the upper right corner of the preset two-dimensional code calibration plate are: determine the distance quantity of the spacing distance included between the upper left corner and the upper right corner and the number of two-dimensional codes of the two-dimensional code image. The sum of the product of the spacing quantity and the spacing distance and the product of the number of two-dimensional codes and the size corresponding to the size information is determined as the horizontal coordinate value of the upper right corner. Then the three-dimensional coordinates of the upper right corner are (horizontal coordinate value, 0, 0).
[0085] Step 1043, generating a camera internal parameter set of the camera to be calibrated and a camera external parameter set under the camera calibration scene information according to the multiple two-dimensional pixel coordinate sets and the multiple three-dimensional space coordinate sets.
[0086] In some embodiments, the execution entity may generate a camera internal parameter set of the camera to be calibrated and a camera external parameter set under the camera calibration scene information according to a plurality of two-dimensional pixel coordinate sets and a plurality of three-dimensional space coordinate sets. The camera internal parameters in the camera internal parameter set may be parameters for converting the coordinates of points in the two-dimensional code image from the camera coordinate system to the pixel coordinate system. The camera external parameters in the camera external parameter set may be parameters for converting the coordinates of points in the two-dimensional code image from the world coordinate system to the camera coordinate system. The camera coordinate system may be a coordinate system with the optical center of the camera as the origin, the vertical axis coincident with the optical axis, and the positive directions of the horizontal and vertical axes parallel to the world coordinate system. The pixel coordinate system may be a coordinate system with the center of the two-dimensional code image as the origin, and the positive directions of the horizontal and vertical axes consistent with the world coordinate system.
[0087] As an example, the above-mentioned execution entity can use the coordinate system conversion formula of camera imaging in Zhang Zhengyou's calibration method to generate the camera internal parameter set of the camera to be calibrated and the camera external parameter set under the above-mentioned camera calibration scene information according to multiple two-dimensional pixel coordinate sets and multiple three-dimensional space coordinate sets.
[0088] Step 1044, determining a set of three-dimensional coordinates of corner points corresponding to a set of corner points of the target two-dimensional code image according to the camera internal parameter set and the camera external parameter set.
[0089] In some embodiments, the execution subject may determine the three-dimensional coordinate set of corner points corresponding to the corner point set of the target two-dimensional code image according to the internal parameter set of the camera and the external parameter set of the camera, wherein the target two-dimensional code image is an image acquired by controlling the camera to be calibrated to move to a preset shooting angle other than the preset shooting angle set. The corner points in the corner point set may be vertices of the two-dimensional code image. The three-dimensional coordinates of the corner points in the three-dimensional coordinate set of the corner points may be the three-dimensional coordinates of the vertices in the two-dimensional code image. The preset shooting angle other than the preset shooting angle set may be one of the following: 45 degrees, 270 degrees, 315 degrees.
[0090] As an example, the execution subject may first decode each corner point in the corner point set of the target two-dimensional code image to generate corner point pixel coordinates and obtain a corner point pixel coordinate set. Then, the corner point pixel coordinate set is input into the target coordinate system conversion formula to obtain a corner point three-dimensional coordinate set. The target coordinate system conversion formula may be a formula obtained by substituting the obtained camera internal parameter set and camera external parameter set into the coordinate system conversion formula.
[0091] Considering that the conventional solution above adopts the Eagle optimizer algorithm to optimize the internal and external parameters obtained to obtain the optimized internal and external parameters, facing the above technical problem 2: due to the insufficient local search ability of the Eagle optimizer algorithm, it is easy to fall into the local optimal solution, resulting in low algorithm search efficiency, long internal and external parameter optimization time and low optimization accuracy, which leads to low accuracy of camera parameter calibration. Combined with the advantages / technical status, it can be decided to adopt the following solution.
[0092] In some optional implementations of some embodiments, the above-mentioned determining the three-dimensional coordinate set of the corner points corresponding to the corner point set of the target two-dimensional code image according to the camera internal parameter set and the camera external parameter set may include the following steps:
[0093] The first step is to construct a corner point reprojection target fitness function. The above corner point reprojection target fitness function can be to reproject each corner point in the above corner point set and average the reprojection error between the reprojected corner point coordinates and the actual corner point coordinates. The above corner point reprojection target fitness function can be expressed as:
[0094]
[0095] Where E represents the fitness function of the corner point reprojection target. s represents the number of target two-dimensional code images. h represents the number of corner points included in the corner point set. pij represents the real pixel coordinates of the i-th corner point on the j-th target QR code image. ij Indicates p ij The corresponding reprojected pixel coordinates. f1, f2, u0, v0 represent the camera internal parameter set. k1, k2, k3 represent the radial distortion parameters included in the camera internal parameter set. p1, p2 represent the tangential distortion parameters included in the camera internal parameter set. R represents the rotation moment included in the camera external parameters. T represents the translation matrix included in the camera external parameters.
[0096] The second step is to generate an initial population according to the camera internal parameter set and the camera external parameter set, wherein each initial individual in the initial population can be an individual formed by combining a set of camera internal parameter sets and a set of camera external parameter sets.
[0097] As an example, the execution subject may first determine the internal optimization interval and the external optimization interval of the camera internal parameter set and the camera external parameter set. The internal optimization interval may be a numerical interval of adding or subtracting [0, 80] based on the camera internal parameters. The external optimization interval may be a numerical interval of adding or subtracting [0, 10] based on the camera external parameters. Then, the camera internal parameter set is added with the internal optimization interval to obtain an optimized internal parameter set. The camera external parameters are added with the external optimization interval to obtain an optimized external parameter set. The optimized internal parameter set and the optimized external parameter set are determined as the initial population.
[0098] The third step is to perform the following population update steps based on the initial population:
[0099] Sub-step 1, inputting the initial individuals included in the initial population into the above-mentioned corner point reprojection target fitness function to obtain an initial reprojection fitness value set. The initial reprojection fitness value in the above-mentioned initial reprojection fitness value set can characterize the quality of the image taken by the camera to be calibrated under the initial individual.
[0100] Sub-step 2, screening the initial reprojection fitness value set to obtain the screened initial reprojection fitness value. The screened initial reprojection fitness value may be the initial reprojection fitness value with the largest value.
[0101] Sub-step 3, determining the average value of the initial reprojection fitness value set to obtain the initial reprojection fitness mean.
[0102] Sub-step 4, for each initial individual included in the initial population, generate an adaptive update allocation parameter according to the initial reprojection fitness value corresponding to the initial individual, the initial reprojection fitness value after screening, the initial reprojection fitness mean and the preset tuning parameter set. The above-mentioned adaptive update allocation parameter can represent the probability value of the initial individual selecting different update strategies in the subsequent update process. The above-mentioned preset tuning parameter can be a pre-set parameter that represents the optimization of the population. The above-mentioned adaptive update allocation parameter can be expressed as:
[0103]
[0104] Wherein, M(t) represents the adaptive update allocation parameter. represents the local optimization adjustment parameter included in the preset tuning parameter set, and its value range is (0, 0.5). φ represents the global optimization adjustment parameter included in the preset tuning parameter set, and its value range is (0.25, 0.75). F(t) represents the initial reprojection fitness value corresponding to the initial individual. F B (t) represents the initial reprojection fitness value after screening. F N (t) represents the initial reprojection fitness mean. t represents the number of executions.
[0105] Sub-step 5, determining the number of times the above population update step has been executed.
[0106] Sub-step 6, for each adaptive update allocation parameter in the adaptive update allocation parameter set, perform the following update steps:
[0107] The first sub-step is to determine the position dynamic update parameter in response to determining that the number of executions is less than or equal to the product of the preset execution threshold and the first preset threshold, and the preset random threshold is less than or equal to the adaptive update allocation parameter. The preset execution threshold may be a preset maximum number of executions. For example, the preset execution threshold may be 100. The first preset threshold may be a preset value. For example, the first preset threshold may be two-thirds. The preset random threshold may be a random number generated by a random function. The position dynamic update parameter may be characterized as assigning a weight value to the position of the initial individual to avoid falling into a local extreme value. The position dynamic update parameter may be expressed as:
[0108]
[0109] Where C(t) represents the dynamic update parameter of the position. N represents the number of initial individuals included in the initial population. i (t) represents the i-th initial individual in the initial population. i (t) represents X i (t) The corresponding initial reprojection fitness value.
[0110] The second sub-step is to perform a first position update process on the initial individual corresponding to the adaptive update allocation parameter according to the position dynamic update parameter and the adaptive update allocation parameter, and obtain a first updated individual as the updated individual. The updated individual can be expressed as:
[0111]
[0112] Among them, X new (t+1) represents the updated individual. best (t) represents the individual with the largest initial reprojection fitness value obtained in the tth cycle. T0 represents the preset execution threshold. M (t) represents the mean of the initial reprojected fitness value set corresponding to the population obtained in the tth cycle. r represents any random number in the range of [0, 1].
[0113] The third sub-step is to determine the spiral tidal fluctuation parameter in response to determining that the preset random threshold is greater than the adaptive update allocation parameter. The spiral tidal fluctuation parameter can represent the adjustment of the search step size of the initial individual. The spiral tidal fluctuation parameter can be expressed as:
[0114]
[0115] Where W(t) represents the spiral tidal fluctuation parameter. ε0 represents the wavelength constant, which represents the amplitude of tidal fluctuation and has a value of 1.5.
[0116] The fourth sub-step is to perform a second position update process on the initial individual corresponding to the adaptive update allocation parameter according to the spiral tidal fluctuation parameter to obtain a second updated individual as the updated individual. The updated individual can be expressed as:
[0117] X new (t+1)=X best (t)×G levy +W(t)×r+X R (t).
[0118] Among them, G levy represents the Levy branch distribution function. X R (t) represents the random individual obtained in the tth cycle.
[0119] In a fifth sub-step, in response to determining that the number of executions is greater than the product of the above-mentioned preset execution threshold and the above-mentioned first preset threshold, and the preset random threshold is less than or equal to the adaptive update allocation parameter, a third position update process is performed on the initial individual corresponding to the adaptive update allocation parameter according to the preset search area range to obtain a third updated individual as the updated individual. The above-mentioned preset search area range may be a preset optimization range of the camera internal parameters and the camera external parameters. The above-mentioned updated individual may be expressed as:
[0120] X new (t+1)=|X best (t)-X M (t)|×ζ-r+[(UB-LB)×r+LB]×η.
[0121] Wherein, ξ represents the first development adjustment parameter, and its value is 0.1. UB represents the upper limit of the preset search area range. LB represents the lower limit of the preset search area range. η represents the second development adjustment parameter, and its value is 0.1.
[0122] The sixth sub-step is, in response to determining that the preset random threshold is greater than the adaptive update allocation parameter, performing a fourth position update process on the initial individual corresponding to the adaptive update allocation parameter as an updated individual. The updated individual can be represented as:
[0123]
[0124] Among them, Q F represents the equilibrium function used for equilibrium search. G1 represents the flight search movement of the individual. G2 represents the flight slope value of the individual in linear decreasing, and the value range is [0, 2]. X(t) represents the individual obtained in the tth cycle.
[0125] Sub-step 7, inputting the obtained updated population into the above corner point reprojection target fitness function to obtain an updated reprojection fitness value set.
[0126] Sub-step 8, screening the updated reprojection fitness value set to obtain a target updated reprojection fitness value, wherein the target updated reprojection fitness value may be the updated reprojection fitness value with the largest value.
[0127] Sub-step 9, in response to determining that the target updated reprojection fitness value is less than the screened initial reprojection fitness value, determining the updated population as the initial population, and performing the above population updating step again.
[0128] Sub-step 10, in response to determining that the number of executions is greater than or equal to the above-mentioned preset execution threshold, the camera internal parameter set and the camera external parameter set included in the updated individual corresponding to the target updated reprojection fitness value are determined as the target camera internal parameter set and the target camera external parameter set.
[0129] In step 4, in response to determining that the number of executions is less than or equal to the preset execution threshold, the updated population is determined as the initial population, and the sum of the number of executions and the second preset threshold is determined as the number of executions, so as to perform the population update step again. The second preset threshold may be a preset value. For example, the second preset threshold may be 1.
[0130] Step 5: According to the target camera internal parameter set and the target camera external parameter set, determine the corner point three-dimensional coordinate set corresponding to the corner point set of the target two-dimensional code image. The three-dimensional coordinates of the corner points in the three-dimensional coordinate set of the corner points can be the coordinates of the corner points in the world coordinate system obtained by substituting the pixel coordinates of the corner points into the coordinate system conversion formula determined by the calibrated camera internal parameter set and the camera external parameter set.
[0131] As an example, the execution entity may input the corner point pixel coordinate set into a target coordinate system conversion formula to obtain a corner point three-dimensional coordinate set.
[0132] The above-mentioned first to fifth steps and their related contents, combined with step "step 1047", as an inventive point of an embodiment of the present disclosure, solve the technical problem 2 mentioned in the background technology "Due to the insufficient local search capability of the Eagle optimizer algorithm, it is easy to fall into the local optimal solution, resulting in low algorithm search efficiency, long internal and external parameter optimization time and low optimization accuracy, thereby resulting in low accuracy of camera parameter calibration. The factors that lead to low accuracy of camera parameter calibration are often as follows: Due to the insufficient local search capability of the Eagle optimizer algorithm, it is easy to fall into the local optimal solution, resulting in low algorithm search efficiency, long internal and external parameter optimization time and low optimization accuracy. If the above factors are solved, the effect of improving the accuracy of camera calibration can be achieved. In order to achieve this effect, the present disclosure first constructs a corner reprojection target fitness function to determine the optimization effect and improve the camera calibration accuracy. Secondly, the adaptive update allocation parameters are generated by the initial reprojection fitness value corresponding to the initial individual, the initial reprojection fitness value after screening, the initial reprojection fitness mean and the preset tuning parameter set. Through the adaptive Updating allocation parameters can flexibly select individual position update strategies, enhance global exploration capabilities, improve search capabilities and search efficiency, and shorten optimization time. Again, position dynamic update parameters and spiral tidal fluctuation parameters are introduced into the position update strategy. Position dynamic update parameters can avoid falling into local extreme values and improve the accuracy of parameter optimization; spiral tidal fluctuation parameters give individuals a larger random search step in the early stage of loop iteration, which can increase the global search ability of the population; in the middle and late stages of loop iteration, the search step of the individual slowly weakens with tidal fluctuations, which can improve local search capabilities. At the same time, tidal fluctuations have nonlinear effects, which can avoid falling into local optimal values to a certain extent. Then, the third position update processing and the fourth position update processing in the position update can further narrow the population search range and improve the parameter optimization efficiency. Finally, through the above-mentioned target camera internal parameter set and target camera external parameter set, the corner point three-dimensional coordinate set corresponding to the corner point set of the target two-dimensional code image is determined, and the camera to be calibrated is calibrated through the corner point three-dimensional coordinate set, which can improve the accuracy of camera calibration.
[0133] Step 1045, determining the coordinate error between the corner point three-dimensional coordinate set and the preset corner point three-dimensional coordinate set.
[0134] In some embodiments, the execution subject may determine a coordinate error between a corner point three-dimensional coordinate set and a preset corner point three-dimensional coordinate set. The preset corner point three-dimensional coordinates in the preset corner point three-dimensional coordinate set may be coordinates of the corner point set in a real world coordinate system. The coordinate error may be a root mean square error.
[0135] Step 1046 , in response to determining that the coordinate error is within the preset coordinate error range, completing the parameter calibration of the camera to be calibrated.
[0136] In some embodiments, the execution subject may complete the parameter calibration of the camera to be calibrated in response to determining that the coordinate error is within a preset coordinate error range, wherein the preset coordinate error range may be a preset coordinate error range.
[0137] Optionally, after step 104, the execution subject may further perform the following steps:
[0138] In response to determining that the coordinate error is not within the above-mentioned preset coordinate error range, the above-mentioned camera fixing device is controlled to move to the above-mentioned preset shooting angle set, so as to re-capture the calibration plate image of the above-mentioned preset two-dimensional code calibration plate, and obtain a two-dimensional code re-captured image set as a two-dimensional code image group set, so as to execute the above-mentioned camera calibration step again.
[0139] The above-mentioned embodiments of the present disclosure have the following beneficial effects: the camera parameter calibration method of some embodiments of the present disclosure can reduce the cost and time of camera calibration, and improve the versatility and accuracy of camera calibration. Specifically, the reasons for the increase in relevant calibration costs and time, low calibration efficiency and waste of computing resources are: since joint calibration requires additional high-precision sensors, the calibration cost of camera calibration will be increased, and the data synchronization of the calibration high-precision sensor and the camera to be calibrated will increase a large amount of computing and the calibration system is not universal, resulting in an increase in calibration costs and time, low calibration efficiency and waste of computing resources. Based on this, the camera parameter calibration method of some embodiments of the present disclosure can first obtain the parameter set to be calibrated of the camera to be calibrated. Here, the parameter set to be calibrated is convenient for the subsequent construction of camera calibration scene information. Secondly, according to the above-mentioned parameter set to be calibrated, the preset two-dimensional code calibration plate set and the camera fixing device, the camera calibration scene information is constructed, wherein the above-mentioned camera fixing device is a device composed of the above-mentioned camera to be calibrated and the camera fixing base assembly. Here, the versatility of the calibration scenes of different types of cameras can be improved, and the camera calibration efficiency can be improved. Then, the camera fixing device is controlled to move to each preset shooting angle in the preset shooting angle set, so as to collect the calibration plate image of the preset two-dimensional code calibration plate set, and obtain a two-dimensional code image set. Here, the two-dimensional code image set is used for the subsequent calibration of the camera through two-dimensional pixel coordinates and three-dimensional space coordinates. Finally, based on the two-dimensional code image set, the following camera calibration steps are performed: the first step is to perform feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group and obtain multiple image feature point sets. Here, since the two-dimensional code image set is an image with binary coding and numbering information, the world coordinate system can be directly established, and the calibration of the camera can be completed when the preset two-dimensional code calibration plate is partially blocked, and the information stored in the two-dimensional code image and the coding information can be accurately extracted, so as to improve the integrity of the information included in the image feature points. The second step is to determine the two-dimensional pixel coordinates and three-dimensional space coordinates of each image feature point in the multiple image feature point sets, and obtain multiple two-dimensional pixel coordinate sets and multiple three-dimensional space coordinate sets. Here, multiple two-dimensional code pixel coordinate sets and multiple three-dimensional space coordinate sets are convenient for subsequent calibration of internal and external parameters of the camera. The third step is to generate the camera internal parameter set of the camera to be calibrated and the camera external parameter set under the camera calibration scene information according to the multiple two-dimensional pixel coordinate sets and the multiple three-dimensional space coordinate sets. Here, the camera internal parameter set can improve the accuracy and precision of camera imaging, and can eliminate the distortion in camera imaging, thereby improving the accuracy of camera calibration. The camera external parameter set can realize the geometric transformation of two-dimensional pixel coordinates and three-dimensional space coordinates, which is convenient for subsequent camera calibration.The fourth step is to determine the three-dimensional coordinate set of the corner points corresponding to the corner point set of the target two-dimensional code image according to the internal parameter set of the camera and the external parameter set of the camera, wherein the above-mentioned target two-dimensional code image is an image collected by controlling the above-mentioned camera to be calibrated to move to a preset shooting angle other than the above-mentioned preset shooting angle set. Here, it is convenient to determine the coordinate error between the three-dimensional coordinates of the corner points and the three-dimensional coordinates of the real corner points by the calibrated camera in the future. The fifth step is to determine the coordinate error between the three-dimensional coordinate set of the corner points and the three-dimensional coordinate set of the preset corner points. Here, determining the coordinate error is convenient to improve the accuracy of camera calibration. The sixth step is to complete the parameter calibration of the above-mentioned camera to be calibrated in response to determining that the coordinate error is within the preset coordinate error range. It can be obtained that the camera parameter calibration method can reduce the cost and efficiency of camera calibration and improve the versatility of camera calibration through the calibration iteration cycle and the camera fixing device.
[0140] Further references Figure 3 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a camera parameter calibration device. These device embodiments are similar to Figure 1 Corresponding to the method embodiments shown, the camera parameter calibration device can be specifically applied to various electronic devices.
[0141] like Figure 3As shown, a camera parameter calibration device 300 includes: an acquisition unit 301, a construction unit 302, a control unit 303 and an execution unit 304. The acquisition unit 301 is configured to: acquire a set of parameters to be calibrated of the camera to be calibrated. The construction unit 302 is configured to: construct camera calibration scene information according to the above-mentioned set of parameters to be calibrated, a preset two-dimensional code calibration plate set and a camera fixing device, wherein the above-mentioned camera fixing device is a device composed of the above-mentioned camera to be calibrated and a camera fixing base assembly. The control unit 303 is configured to: control the above-mentioned camera fixing device to move to each preset shooting angle in the preset shooting angle set, so as to perform calibration plate image acquisition on the above-mentioned preset two-dimensional code calibration plate set to obtain a two-dimensional code image group set. The execution unit 304 is configured to: perform the following camera calibration steps based on the two-dimensional code image set: perform feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group and obtain multiple image feature point groups; determine the two-dimensional pixel coordinates and three-dimensional space coordinates of each image feature point in the multiple image feature point groups to obtain multiple two-dimensional pixel coordinate groups and multiple three-dimensional space coordinate groups; generate the camera internal parameter set of the above-mentioned camera to be calibrated and the camera external parameter set under the above-mentioned camera calibration scene information according to the multiple two-dimensional pixel coordinate groups and the multiple three-dimensional space coordinate groups; determine the corner point three-dimensional coordinate set corresponding to the corner point set of the target two-dimensional code image according to the camera internal parameter set and the camera external parameter set, wherein the above-mentioned target two-dimensional code image is an image collected by controlling the above-mentioned camera to be calibrated to move to a preset shooting angle other than the above-mentioned preset shooting angle set; determine the coordinate error of the corner point three-dimensional coordinate set and the preset corner point three-dimensional coordinate set; in response to determining that the coordinate error is within the preset coordinate error range, complete the parameter calibration of the above-mentioned camera to be calibrated.
[0142] It can be understood that the various units recorded in the camera parameter calibration device 300 and the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the camera parameter calibration device 300 and the units included therein, and will not be described in detail here.
[0143] Reference below Figure 4 , which shows a structural schematic diagram of an electronic device (eg, an electronic device) 400 suitable for implementing some embodiments of the present disclosure. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0144] like Figure 4As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 304.
[0145] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 4 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0146] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0147] It should be noted that the computer-readable medium in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0148] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0149] The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist independently without being assembled into the electronic device. The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains the parameter set to be calibrated of the camera to be calibrated; constructs the camera calibration scene information according to the above-mentioned parameter set to be calibrated, the preset two-dimensional code calibration plate set and the camera fixing device, wherein the above-mentioned camera fixing device is a device composed of the above-mentioned camera to be calibrated and the camera fixing base assembly; controls the above-mentioned camera fixing device to move to each preset shooting angle in the preset shooting angle set, so as to perform calibration plate image acquisition on the above-mentioned preset two-dimensional code calibration plate set, and obtain a two-dimensional code image group set; based on the two-dimensional code image group set, performs the following camera calibration steps: performs feature point extraction processing on each two-dimensional code image in the two-dimensional code image group set, so as to generate an image feature point group, and obtain multiple image feature point groups; confirms Determine the two-dimensional pixel coordinates and three-dimensional space coordinates of each image feature point in a plurality of image feature point sets to obtain a plurality of two-dimensional pixel coordinate sets and a plurality of three-dimensional space coordinate sets; generate a camera internal parameter set of the camera to be calibrated and a camera external parameter set under the camera calibration scene information according to the plurality of two-dimensional pixel coordinate sets and the plurality of three-dimensional space coordinate sets; determine a three-dimensional coordinate set of corner points corresponding to a corner point set of a target two-dimensional code image according to the camera internal parameter set and the camera external parameter set, wherein the target two-dimensional code image is an image acquired by controlling the camera to be calibrated to move to a preset shooting angle excluding the preset shooting angle set; determine the coordinate errors of the three-dimensional coordinate set of corner points and the three-dimensional coordinate set of preset corner points; in response to determining that the coordinate error is within a preset coordinate error range, complete the parameter calibration of the camera to be calibrated.
[0150] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0151] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0152] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor includes an acquisition unit, a construction unit, a control unit, and an execution unit. The names of these units do not, in some cases, constitute limitations on the units themselves, for example, the acquisition unit may also be described as a "unit for acquiring a set of parameters to be calibrated of a camera to be calibrated".
[0153] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0154] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A camera parameter calibration method, comprising: Get the calibration parameter set of the camera to be calibrated; Constructing camera calibration scene information according to the parameter set to be calibrated, the preset two-dimensional code calibration plate set and the camera fixing device, wherein the camera fixing device is a device composed of the camera to be calibrated and a camera fixing base assembly; Controlling the camera fixing device to move to each preset shooting angle in the preset shooting angle set, so as to collect the calibration plate image of the preset two-dimensional code calibration plate set, and obtain a two-dimensional code image group set; Based on the QR code image set, perform the following camera calibration steps: Performing feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group, and obtaining multiple image feature point group sets, wherein performing feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group, and obtaining multiple image feature point group sets, includes: For each two-dimensional code image in the two-dimensional code image set, the following feature point recognition steps are performed: Performing grayscale processing on the two-dimensional code image to obtain a two-dimensional code grayscale image; The two-dimensional code grayscale image is binarized to obtain a two-dimensional code binary image, wherein the two-dimensional code grayscale image is binarized to obtain a two-dimensional code binary image, including: Determine the pixel grayscale extreme difference of the pixel grayscale value set in each preset window in the two-dimensional code grayscale image to obtain a pixel extreme difference set; Screening out at least one pixel extreme difference greater than or equal to a first preset pixel threshold from the pixel extreme difference set to obtain a first target pixel extreme difference set; For each first target pixel extreme difference in the first target pixel extreme difference set, the following binarization processing steps are performed: For each preset pixel segmentation threshold in the preset pixel segmentation threshold set, the following determination steps are performed: According to the preset pixel segmentation threshold, the foreground and background segmentation is performed on the two-dimensional code grayscale local image corresponding to the preset window corresponding to the first target pixel extreme difference to obtain a two-dimensional code foreground local image and a two-dimensional code background local image; Determine the average grayscale value of the two-dimensional code foreground partial image and the two-dimensional code background partial image to obtain the two-dimensional code foreground grayscale value and the two-dimensional code background grayscale value; Determine the average of the two-dimensional code foreground grayscale value and the two-dimensional code background grayscale value as the image average grayscale value of the two-dimensional code grayscale image; Determine the inter-class variance value of the two-dimensional code grayscale image according to the two-dimensional code foreground grayscale value, the two-dimensional code background grayscale value and the image average grayscale value; The obtained inter-class variance value set is screened to obtain the target inter-class variance value; According to a preset pixel segmentation threshold corresponding to the target inter-class variance value, binarizing the grayscale local image of the two-dimensional code to obtain a binary local image of the two-dimensional code; Screening out at least one pixel extreme difference less than a first preset pixel threshold from the pixel extreme difference set to obtain a second target pixel extreme difference set; Generate a two-dimensional code binary image according to the second target pixel extreme difference set and the obtained two-dimensional code binary local image set; Performing denoising on the two-dimensional code binary image to obtain a denoised two-dimensional code binary image; Performing contour extraction processing on the denoised two-dimensional code binary image to obtain a two-dimensional code edge contour image; Performing polygon simplification processing on the edge contour set included in the two-dimensional code edge contour image to obtain a two-dimensional code contour compression image; Performing perspective transformation processing on the compressed image of the two-dimensional code outline to obtain a two-dimensional code image after perspective transformation; Performing feature point recognition processing on the perspective-transformed two-dimensional code image to obtain an image feature point group; Determine the two-dimensional pixel coordinates and the three-dimensional space coordinates of each image feature point in the plurality of image feature point sets to obtain a plurality of two-dimensional pixel coordinate sets and a plurality of three-dimensional space coordinate sets; Generate a camera internal parameter set of the camera to be calibrated and a camera external parameter set under the camera calibration scene information according to the multiple two-dimensional pixel coordinate sets and the multiple three-dimensional space coordinate sets; Determine a set of three-dimensional coordinates of corner points corresponding to a set of corner points of a target two-dimensional code image according to a camera internal parameter set and a camera external parameter set, wherein the target two-dimensional code image is an image acquired by controlling the camera to be calibrated to move to a preset shooting angle excluding the preset shooting angle set; Determine the coordinate error between the three-dimensional coordinate set of the corner point and the three-dimensional coordinate set of the preset corner point; In response to determining that the coordinate error is within a preset coordinate error range, parameter calibration of the camera to be calibrated is completed.
2. The method according to claim 1, wherein: The method further comprises: In response to determining that the coordinate error is not within the preset coordinate error range, the camera fixing device is controlled to move to the preset shooting angle set to re-capture the calibration plate image of the preset two-dimensional code calibration plate, and obtain a two-dimensional code re-captured image set as a two-dimensional code image group set to execute the camera calibration step again.
3. The method according to claim 1, wherein: The step of generating a two-dimensional code binary image according to the second target pixel extreme difference set and the obtained two-dimensional code binary local image set comprises: For each second target pixel extreme difference in the second target pixel extreme difference set, the following replacement steps are performed: Determine the pixel gray value mean of the pixel gray value set included in the preset window corresponding to the second target pixel extreme difference, and obtain the window pixel mean; In response to determining that the window pixel mean is greater than or equal to a second preset pixel threshold, setting each pixel grayscale value in a pixel grayscale value set included in a preset window corresponding to the second target pixel extreme difference to a first preset replacement pixel value, to obtain a first replacement binary local image; In response to determining that the window pixel mean is less than the second preset pixel threshold, setting each pixel gray value in the pixel gray value set included in the preset window corresponding to the second target pixel extreme difference to a second preset replacement pixel gray value, to obtain a second replacement binary local image; The obtained first replacement binarized partial image set, the obtained second replacement binarized partial image set and the two-dimensional code binarized partial image set are spliced to obtain a two-dimensional code binarized image.
4. The method according to claim 1, wherein: The performing contour extraction processing on the denoised two-dimensional code binary image to obtain a two-dimensional code edge contour image includes: Performing smoothing filtering on the denoised two-dimensional code binary image to obtain a filtered two-dimensional code image; Generating a two-dimensional code gradient image of the filtered two-dimensional code image; Determine a local maximum pixel point set in the two-dimensional code gradient image; Performing candidate point sampling on the local maximum pixel point set to obtain a sampled candidate point set; Performing interpolation processing on the sampling candidate point set to obtain a pixel threshold surface; According to the pixel threshold surface, performing image segmentation processing on the denoised two-dimensional code binary image to obtain a set of two-dimensional code image segmentation regions; Performing region fusion processing on the two-dimensional code image segmentation region set to obtain a region fusion region set; Extracting edge contours of each region fusion region in the region fusion region set to generate region edge contours, thereby obtaining a region edge contour set; The two-dimensional code image corresponding to the area edge contour set is determined as the two-dimensional code edge contour image.
5. The method according to claim 1, wherein: The camera fixing device comprises: the camera to be calibrated, a camera fixing base assembly, a camera adjustment assembly and a camera adaptation intermediate assembly, In response to determining that the camera to be calibrated is a dynamic camera to be calibrated, the camera to be calibrated and the camera adaptation middle component are fixed by a raised buckle, and the camera adaptation middle component is used to adapt to different types of cameras to be calibrated; The camera fixing base assembly and the camera adapting intermediate assembly are fixed by a raised buckle, and the camera fixing base assembly is used to fix the camera to be calibrated; In response to determining that the camera to be calibrated is a static camera to be calibrated, the camera adapter intermediate component is fixed to the camera motor through threads, the camera to be calibrated is installed on the rotating shaft of the camera motor, and the camera motor is used to drive the camera to be calibrated to adjust the shooting angle; The camera adjustment component is installed inside the camera fixing base component, and the camera adjustment component is used to control the camera to be calibrated to perform rotation adjustment.
6. A camera parameter calibration device, comprising: An acquisition unit is configured to acquire a parameter set to be calibrated of the camera to be calibrated; A construction unit is configured to construct camera calibration scene information according to the parameter set to be calibrated, the preset two-dimensional code calibration plate set and the camera fixing device, wherein the camera fixing device is a device composed of the camera to be calibrated and a camera fixing base assembly; A control unit is configured to control the camera fixing device to move to each preset shooting angle in the preset shooting angle set, so as to collect calibration plate images of the preset two-dimensional code calibration plate set to obtain a two-dimensional code image group set; The execution unit is configured to perform the following camera calibration steps based on the two-dimensional code image set: performing feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group and obtain multiple image feature point groups, wherein the feature point extraction processing on each two-dimensional code image in the two-dimensional code image set to generate an image feature point group and obtain multiple image feature point groups includes: for each two-dimensional code image in the two-dimensional code image set, performing the following feature point recognition steps: performing grayscale processing on the two-dimensional code image to obtain a two-dimensional code grayscale image; performing binarization processing on the two-dimensional code grayscale image to obtain a two-dimensional code binary image, wherein the binarization processing on the two-dimensional code grayscale image , obtaining a two-dimensional code binary image, including: determining the pixel grayscale extreme difference of the pixel grayscale value set in each preset window in the two-dimensional code grayscale image to obtain a pixel extreme difference set; screening out at least one pixel extreme difference greater than or equal to a first preset pixel threshold from the pixel extreme difference set to obtain a first target pixel extreme difference set; for each first target pixel extreme difference in the first target pixel extreme difference set, performing the following binarization processing steps: for each preset pixel segmentation threshold in the preset pixel segmentation threshold set, performing the following determination steps: according to the preset pixel segmentation threshold, performing foreground and background segmentation on the two-dimensional code grayscale local image corresponding to the preset window corresponding to the first target pixel extreme difference to obtain a two-dimensional code foreground local image and a two-dimensional code background local image; Determine the average grayscale value of the two-dimensional code foreground local image and the two-dimensional code background local image to obtain the two-dimensional code foreground grayscale value and the two-dimensional code background grayscale value; determine the average of the two-dimensional code foreground grayscale value and the two-dimensional code background grayscale value as the image average grayscale value of the two-dimensional code grayscale image; determine the inter-class variance value of the two-dimensional code grayscale image according to the two-dimensional code foreground grayscale value, the two-dimensional code background grayscale value and the image average grayscale value; screen the obtained inter-class variance value set to obtain the target inter-class variance value; binarize the two-dimensional code grayscale local image according to the preset pixel segmentation threshold corresponding to the target inter-class variance value to obtain the two-dimensional code binarized local image; screen out small pixels from the pixel extreme difference set at least one pixel extreme difference of a first preset pixel threshold value is obtained to obtain a second target pixel extreme difference set; a two-dimensional code binary image is generated according to the second target pixel extreme difference set and the obtained two-dimensional code binary local image set; the two-dimensional code binary image is denoised to obtain a denoised two-dimensional code binary image; the denoised two-dimensional code binary image is subjected to contour extraction to obtain a two-dimensional code edge contour image; the edge contour set included in the two-dimensional code edge contour image is subjected to polygon simplification to obtain a two-dimensional code contour compression image; the two-dimensional code contour compression image is subjected to perspective transformation to obtain a two-dimensional code image after perspective transformation; the two-dimensional code image after perspective transformation is subjected to feature point recognition to obtain an image feature point group;Determine the two-dimensional pixel coordinates and three-dimensional space coordinates of each image feature point in a plurality of image feature point sets, and obtain a plurality of two-dimensional pixel coordinate sets and a plurality of three-dimensional space coordinate sets; generate a camera internal parameter set of the camera to be calibrated and a camera external parameter set under the camera calibration scene information according to the plurality of two-dimensional pixel coordinate sets and the plurality of three-dimensional space coordinate sets; determine a corner point three-dimensional coordinate set corresponding to a corner point set of a target two-dimensional code image according to the camera internal parameter set and the camera external parameter set, wherein the target two-dimensional code image is an image acquired by controlling the camera to be calibrated to move to a preset shooting angle other than the preset shooting angle set; determine the coordinate error of the corner point three-dimensional coordinate set and the preset corner point three-dimensional coordinate set; in response to determining that the coordinate error is within the preset coordinate error range, complete the parameter calibration of the camera to be calibrated. ; 7. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
8. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Camera calibration method, device, equipment and storage medium
CN112419422A
Calibration and coordinate unification method for multiple cameras in non-overlapping area
CN114299156A
Camera internal reference calibration method and automatic driving equipment
CN117911520A