Camera calibration method and device, equipment and medium
By acquiring scanned image sequences for initial calibration and Bézier curve fitting, the problem of low camera calibration accuracy in existing technologies is solved, achieving higher precision and lower complexity in camera calibration.
Patent Information
- Application Number
- CN202511402835.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2026-01-30
AI Technical Summary
Existing camera calibration methods use planar mesh models, resulting in low calibration accuracy and an inability to guarantee precision.
By acquiring the scanned image sequence, the first calibration is performed. After stitching, the linear distortion model of the Bézier curve is used for fitting, adjusting the local distortion shape, reducing computational complexity, adapting to non-uniform distortion, and forming more accurate calibration parameters.
It improves the accuracy and precision of camera calibration, adapts to non-uniform distortion, and reduces computational complexity.
Smart Images

Figure CN121437643A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of camera calibration, and in particular to a camera calibration method, device, equipment and medium. BACKGROUND
[0002] With the development of computer science and technology, machine vision has become one of the research hotspots in the field of image processing. The human visual system can perceive the three-dimensional world from two-dimensional images and obtain information about the three-dimensional world. The research goal of machine vision is to enable computers to recognize environmental information through one or more images. With the continuous development of machine vision theory, its application field is also rapidly widening and has been widely used in traffic navigation, field survey, automation production and virtual reality fields.
[0003] To recover the three-dimensional information of an object from a two-dimensional image, it is necessary to know the corresponding relationship between the object point in the spatial coordinate system and its image point on the image plane, and this corresponding relationship is determined by the imaging geometric model of the camera. These geometric model parameters are the parameters of the camera. The process of determining these parameters is called camera calibration. Camera calibration is an important part of machine vision.
[0004] Currently, the commonly used camera calibration uses a planar grid model to realize distortion correction. However, since the solution of ideal points in the planar grid model relies on the diffusion of the central part, the accuracy cannot be guaranteed, resulting in low accuracy of camera calibration. SUMMARY
[0005] The present application provides a camera calibration method, device, computer equipment and medium to solve the technical problem of low accuracy of camera calibration.
[0006] In a first aspect, a camera calibration method is provided, comprising: obtaining a scan image sequence of a first image; based on the scan image sequence, performing first calibration on the parameters of the camera corresponding to the scan image sequence to obtain first calibration parameters of the camera; according to the first calibration parameters, performing stitching processing on the scan image sequence to obtain a distortion stitching image; according to the distortion stitching image, performing fitting processing on the first calibration parameters through a line sweep distortion model based on a Bezier curve to obtain second calibration parameters of the camera.
[0007] In a second aspect, a camera calibration device is provided, comprising: an acquisition module configured to obtain a scan image sequence of a first image; The calibration module is used to perform a first calibration on the parameters of the camera corresponding to the scanned image sequence based on the scanned image sequence, so as to obtain the first calibration parameters of the camera; The stitching module is used to stitch the scanned image sequence according to the first calibration parameters to obtain a distorted stitched image; The fitting module is used to fit the first calibration parameters to the distorted stitched image using a line scan distortion model based on Bézier curves, thereby obtaining the second calibration parameters of the camera.
[0008] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described camera calibration method.
[0009] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the above-described camera calibration method.
[0010] In the above-described camera calibration method, apparatus, computer equipment, and storage medium, a scanned image sequence of a first image is acquired. Based on the scanned image sequence, the camera parameters corresponding to the scanned image sequence are calibrated for the first time to obtain the camera's first calibration parameters. Further, based on the first calibration parameters, the scanned image sequence is stitched together to obtain a distorted stitched image. The first calibration parameters unify the coordinate system and improve stitching consistency. Based on the distorted stitched image, the first calibration parameters are fitted using a line scan distortion model based on Bézier curves to obtain the camera's second calibration parameters. By flexibly adjusting the local distortion shape using the control points of the Bézier curves, computational complexity is reduced, non-uniform distortion is adapted, and more accurate calibration parameters are formed, thereby improving the accuracy of camera calibration. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic flowchart of a camera calibration method according to an embodiment of the present invention; Figure 2 yes Figure 1 A schematic diagram of a specific implementation method for step S20; Figure 3 yes Figure 1A specific implementation flowchart of step S30 is shown in the figure; Figure 4 is Figure 1 A specific implementation flowchart of step S40 is shown in the figure; Figure 5 is another flowchart of the camera calibration method in an embodiment of the present application; Figure 6 is a structural diagram of the camera calibration device in an embodiment of the present application; Figure 7 is a structural diagram of the computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0013] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0014] The camera calibration method provided by the embodiments of the present application can be applied in a computer device. The computer device can obtain a scanning image sequence of a first image. The parameters of a camera corresponding to the scanning image sequence are calibrated for the first time based on the scanning image sequence, and the first calibration parameters of the camera are obtained. Further, the scanning image sequence is spliced according to the first calibration parameters, and a distortion spliced image is obtained. Through the first calibration parameters, the coordinate system can be unified, and the splicing consistency can be improved. According to the distortion spliced image, the first calibration parameters are fitted through a line scanning distortion model based on a Bezier curve, and the second calibration parameters of the camera are obtained. Through the control points of the Bezier curve, the local distortion shape can be flexibly adjusted, the calculation complexity can be reduced, the non-uniform distortion can be adapted, and more accurate calibration parameters can be formed, thereby improving the accuracy of camera calibration. The computer device can include a terminal device or a server. The terminal device can include a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, a wearable device, and the like. The server can be a standalone server or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0015] The present application will be described in detail through specific embodiments.
[0016] Please refer to Figure 1 As Figure 1 shown,Figure 1 A flowchart of a camera calibration method provided by an embodiment of the present application includes the following steps: S10: Obtain a scan image sequence of a first image.
[0017] The first image can be scanned by a camera to obtain a scan image sequence of the first image.
[0018] The camera can be a line scan camera; the first image can be an image of a calibration board containing a two-dimensional code printed on the calibration board; and the scan image sequence can be composed of a plurality of continuous scan images.
[0019] The line scan camera can be used to continuously scan the calibration board with the first image, and the resolution of the line scan camera needs to match the details of the calibration board, such as the minimum chessboard width being greater than or equal to 3 pixels. The calibration board can be selected to have high-contrast chessboards to ensure that the scan image sequence is clear and the feature points of the scan images are easy to extract.
[0020] The scanning process can include: ①initializing the line scan camera, setting the line scan camera to a hardware trigger mode (such as External Exposure Control), and zeroing the line scan platform, placing the calibration board at the starting position, and setting the zoom ratio to 100%, so that the size of the scanned image is the same as the original image, that is, each scan image in the scan image sequence obtained by scanning is the same size as the first image. ②Control the line scan platform to move at a constant speed, and trigger the line scan camera to capture a row (line scan) or a frame (area array) every time the encoder moves a fixed distance, such as 0.2 mm. ③Synchronous signal processing: record the accurate position of each scan image, including the timestamp or encoder value, through FPGA or real-time controller. ④Store the captured scan images according to time or position number, and save the position metadata synchronously. Thus, the scan image sequence of the first image is obtained.
[0021] S20: Based on the scan image sequence, the parameters of the camera corresponding to the scan image sequence are calibrated for the first time to obtain the first calibration parameters of the camera.
[0022] The corner points of the two-dimensional code in the scan image sequence can be extracted, such as using the EdgesSubPix algorithm to extract the edges of the two-dimensional code in the scan image sequence and return the original contour point coordinates with sub-pixel accuracy. The physical world coordinates of the two-dimensional code are obtained, and thus the first calibration parameters of the camera are obtained based on the original contour point coordinates and the physical world coordinates.
[0023] In some embodiments, referring to Figure 2 Step S20 can include the following steps: Step S21: Identify the two-dimensional code in the scan image sequence and obtain the first position of the two-dimensional code. Step S22: Obtain the physical world coordinates of the QR code as the second location of the QR code; Step S23: Based on the first position and the second position, perform the first calibration of the camera parameters to obtain the first calibration parameters of the camera.
[0024] For step S21, identify the position of the QR code in the scanned image sequence, that is, extract the corner points of the QR code in the scanned image sequence, extract the edges of the QR code in the scanned image sequence and return the original contour point coordinates with sub-pixel precision.
[0025] After obtaining the original contour point coordinates, iterative closest point (ICP) registration is performed on the original contour point coordinates to further determine the sub-pixel edges, thereby obtaining accurate contour point coordinates, which are then used as the first position of the QR code.
[0026] For step S22, the physical world coordinates of the QR code are obtained as the second position of the QR code. The physical world coordinates of the QR code refer to the three-dimensional coordinates of the QR code in physical space, that is, the actual three-dimensional coordinates of the QR code printed on the calibration plate or the actual three-dimensional coordinates of the QR code in the first image.
[0027] Specifically, a motion capture system, such as Vicon's DataStream, can be used to identify the rows and columns of the QR code in the first image, and then calculate the actual three-dimensional coordinates of the QR code in the first image based on the rows and columns.
[0028] For step S23, establish the correspondence between the contour point coordinates and the physical world coordinates, that is, establish a one-to-one correspondence between the contour point coordinates and the physical world coordinates (3D, assuming the calibration plate is on the Z=0 plane).
[0029] For example: world coordinates are (0,0,0),(2,0,0),(4,0,0),…(0,0,0),(2,0,0),(4,0,0),… (unit: cm), contour point coordinates are (u1,v1),(u2,v2),(u3,v3),…(u1,v1),(u2,v2),(u3,v3),…(u1,v1),(u2,v2),(u3,v3),… (unit: pixels), assuming the… The desired location of the QR code, i.e., the coordinates of its outline point, is: The actual location, i.e., the physical world coordinates, is The position of the camera can be described by a 3×3 homography transformation matrix H with 8 degrees of freedom, where:
[0030] That is, the first calibration parameter is solved by minimizing the difference between the expected position and the actual position. .
[0031] H is the first calibration parameter, that is, the camera's intrinsic parameter, which contains the camera's rotation, translation, perspective transformation and distortion coefficient, and each photographing point has an independent .
[0032] S30: Splice the scanning image sequence according to the first calibration parameter to obtain a distortion spliced image.
[0033] After obtaining the first calibration parameter, the scanning image sequence can be spliced according to the first calibration parameter to obtain a distortion spliced image.
[0034] In some embodiments, referring to Figure 3 , step S30 can include the following steps: S31: Generating a second image according to the image size of the scanning image sequence; S32: Calculating the first coordinate of the second image according to the image size of the scanning image sequence; S33: Calculating the second coordinate of the second image based on the first calibration parameter and the first coordinate; S34: Splicing the scanning image sequence based on the second coordinate to obtain a distortion spliced image.
[0035] For steps S31-S34, first, a canvas is generated, wherein the size of the canvas can be determined according to the fixed physical size of any scanning image in the scanning image sequence, so the physical size of any scanning image in the scanning image sequence is obtained as the image size of the scanning image sequence, thereby generating a canvas with the same image size as the scanning image sequence as the second image, for example, the physical size of any scanning image in the scanning image sequence is 200mmx150mm, and a canvas with a size of 200mmx150mm is generated.
[0036] Then, the physical coordinates of the second image are calculated according to the image size of the scanning image sequence as the first coordinate of the second image. Since the physical size of the calibration board is known, that is, the positions of the corner points or feature points of the first image in the physical space are known, the positions of the corner points or feature points of the scanning image in the physical space are also known, for example, the chessboard grid spacing is 10mm, and the physical coordinates of the second image can be calculated, such as the physical coordinates of the origin [0, 0, 0], the physical coordinates of the first row second corner point [10, 0, 0], and the physical coordinates of the first column second corner point [0, 10, 0].
[0037] After obtaining the first coordinates, the first coordinates are mapped to the pixel coordinates of the camera based on the first calibration parameters, i.e., the second coordinates are obtained. The specific execution code can be: param H: 3x3 homography matrix, i.e., the first calibration parameter; param x_p: physical coordinate x (mm / m); param y_p: physical coordinate y (mm / m); return: camera pixel coordinates (x_cam, y_cam).
[0038] Thus, based on the first calibration parameter and the first coordinates, the returned second coordinates are obtained.
[0039] Then, the resolution of the canvas is calculated. Specifically, the target pixel size can be determined first, wherein the target pixel size can be determined according to the display device requirements such as the resolution of the display screen. For example, assuming that a 200mmx150mm calibration board needs to be completely displayed on a 4K screen (3840x2160), the target pixel size R=19.2pixel / mm. Then, based on the target pixel size , the resolution of the canvas is calculated, wherein .
[0040] After obtaining the resolution of the canvas, it can be verified whether the pixel coordinates of the camera are valid according to the resolution of the canvas. That is, the pixel coordinates of the camera must be valid image pixel coordinates, that is, it needs to meet the following formula:
[0041] wherein and are the resolutions of the scan images in the scan image sequence, such as 1920x1080.
[0042] If the pixel coordinates of the camera are valid, the pixel values are sampled from the original image, i.e., the pixel values are sampled from the scan image sequence. And based on the sampled pixel values, bilinear interpolation is performed on the canvas, i.e., the scan images in the scan image sequence are spliced through the canvas, so as to obtain the distortion splicing image.
[0043] S40: According to the distortion splicing image, the first calibration parameter is fitted by a line scanning distortion model based on a Bezier curve, to obtain the second calibration parameter of the camera.
[0044] Firstly, by analyzing the geometric distortion characteristics in the distorted stitching image, a line-scan distortion model is constructed using a Bezier curve to optimize the first calibration parameters, i.e., to perform fitting processing on the first calibration parameters to obtain more accurate second calibration parameters, including improved distortion coefficients and camera intrinsic parameters. The first calibration may result in inaccurate parameters due to environmental interference (such as being affected by light, placement of the calibration board), insufficient data, or algorithm limitations, and the accuracy is improved through the second calibration.
[0045] In some embodiments, referring to Figure 3 , step S40 can include the following steps: Step S41: Extracting the distortion feature points of the distorted stitching image, and the actual coordinate points corresponding to the distortion coordinate points.
[0046] The feature extraction process includes: detecting straight line features such as checkerboard edges in the distorted stitching image, and marking the distortion coordinate points of the distorted stitching image according to the detected straight line features. Further, the actual coordinate points are obtained according to the corner points of the calibration board.
[0047] Step S42: Constructing a line-scan distortion model of a Bezier curve according to the distortion coordinate points and the actual coordinate points.
[0048] Specifically, the distortion offset is calculated according to the distortion coordinate points and the actual coordinate points, and the line-scan distortion model is constructed according to the distortion offset.
[0049] Wherein, the distortion offset is divided into horizontal offset and vertical offset , and the calculation formula is:
[0050]
[0051] Wherein, represents the distortion coordinate point, represents the actual coordinate point.
[0052] Suppose there is an edge in the image that should be a horizontal straight line, but due to lens distortion, it actually appears as a curve. The actual coordinates of the points on the curve are detected: The theoretical coordinates of the ideal horizontal straight line (the value of is constant): .
[0053] The formula for calculating the vertical offset includes: The horizontal offset is 0 because the ideal straight line is horizontal.
[0054] Step S43: Fit the first calibration parameters according to the line scan distortion model to obtain the second calibration parameters of the camera.
[0055] The fitting process specifically includes: (1) Sampling Distortion Displacement: Within the range of the distorted stitched image, uniform sampling is performed based on the Bézier curve to obtain sampling points. Control points are then initialized based on the coordinates of the distorted stitched image and the distortion offset. Specifically, control points of the Bézier curve are initialized using known distortion observation points (pixel coordinates and offsets) in the distorted stitched image, laying the foundation for accurate fitting of the distortion model. Proper initialization of control points can significantly improve the convergence speed and final accuracy of the optimization algorithm. For example, suppose the input data is: x-coordinate of observation point : Type: One-dimensional array, representing the horizontal pixel coordinates of feature points in the image.
[0056] Example: x-axis [50, 150, 250, 350] represents the positions of the four feature points from left to right.
[0057] Vertical offset : Type: One-dimensional array, vertical distortion variables (pixels) corresponding one-to-one with the horizontal coordinate.
[0058] Example: Assuming vertical offset The values [5, 8, 3, 10] represent the longitudinal offset values of each point relative to the ideal position. The physical meaning of the longitudinal offset is: positive values indicate a downward offset, and negative values indicate an upward offset.
[0059] Cubic Bézier curve: With 4 control points, the curve equation is: .
[0060] The process of initializing the x-coordinate includes: First, define the horizontal coordinates of the control points to uniformly cover the observation point range as follows: .
[0061] Assuming the x-coordinate At that time, the x-coordinates of the four control points were [50, 133, 266, 350].
[0062] The process of initializing the y-axis includes: Define a linear relationship between the vertical coordinates of the control points and the extreme values of the observed offsets: .
[0063] Assumption The ordinates of the four control points are [3, 5.3, 7.6, 10].
[0064] The horizontal and vertical coordinates of the control points are combined to form two-dimensional coordinate points, which are the initial control points of the Bézier curve.
[0065] (2) Fitting curve: The initial control points of the Bézier curve are optimized using the least squares method to make it approximate the observed distortion offset.
[0066] (3) Optimize calibration parameters: convert the distortion model fitted by the Bézier curve into improved distortion coefficients.
[0067] The specific process includes: obtaining the distortion offset described by the Bézier curve through step S42, and then... Mapping to the polynomial radial distortion model, the mapping formula is:
[0068] Then the distortion coefficients are solved using the least squares method. That is, the second calibration parameter.
[0069] In some embodiments, please refer to Figure 4 After obtaining the second calibration parameters, the fitting ability of the line scan distortion model can be further evaluated. That is, after step S40, it may also include: Step S50: Calculate the reprojection error based on the first image and the distorted stitched image; Step S60: Evaluate the fitting ability of the line scan distortion model based on the reprojection error.
[0070] Specifically, the coordinates of the pixels in the first image and the reprojection coordinates of the corresponding points in the distorted stitched image are obtained. The reprojection error can be obtained by calculating the Euclidean distance between the coordinates of the pixels in the first image and the reprojection coordinates.
[0071] After obtaining the reprojection error, the fitting ability of the line scan distortion model can be evaluated based on the reprojection error. Specifically, the evaluation of the line scan distortion model can be summarized into three dimensions: mean, extreme values, and standard deviation. Therefore, (1) the mean of the reprojection error, i.e., the arithmetic mean of the reprojection errors of all feature points, can be calculated. The fitting ability of the line scan distortion model can be evaluated based on the mean result. The specific mean range and the corresponding ability evaluation can be found in Table 1.
[0072]
[0073] Table 1 (2) The extreme value, i.e., the maximum reprojection error, is a key indicator for evaluating the fitting capability of the distortion model, reflecting the performance of the model in the worst case. Therefore, the extreme value of the reprojection error can be calculated to determine the fitting capability of the line-scan distortion model. The specific extreme value range and the corresponding capability evaluation can be referred to Table 2.
[0074]
[0075] Table 2 The reprojection error is also an important indicator for evaluating the fitting capability of the line-scan distortion model, so the fitting capability of the line-scan distortion model can be evaluated by calculating the standard deviation of the reprojection. The specific standard deviation value range and the corresponding capability evaluation can be referred to Table 3.
[0076]
[0077] Table 3 Among them, the distribution heat map can be used to display each capability error index. Specifically, (1) first process the feature point coordinates of the first image, stack all image feature point coordinates into a two-dimensional array, and convert to integer pixel coordinates, separate x and y coordinates and store them in arrays x and y respectively.
[0078] (2) Then initialize the canvas, create a full zero float matrix canvas (height x width) with the same size as the first image, which will be used to store the error value of each pixel position.
[0079] (3) Error value mapping, traverse all feature points and their corresponding reprojection error values, fill the error value of each feature point to the corresponding position of the canvas, at this time it is necessary to check whether the coordinates are within the image range, and finally obtain the discrete error distribution matrix.
[0080] (4) Finally, the error distribution matrix can be smoothed, specifically, a 15x15 pixel Gaussian blur is applied to the discrete error matrix to make the heat map present a continuous transition effect, which is convenient for observing the regional trend.
[0081] (5) According to the error distribution matrix, a 10x8 inch graphic window is created, and the error matrix is displayed using jet color mapping, with the color gradually changing from blue (low error) to red (high error), that is, the low error area (blue) indicates that the model fitting is good, and the high error area (red) usually appears at the image edge or the severely distorted part. Set the upper limit of the color scale to 98% of the error value, add a color bar to mark the error pixel value, and mark the original feature point position with a semi-transparent white color. Thus, the user can intuitively locate the problem area and reduce the time spent on locating the problem area. At the same time, the user can understand without understanding the mathematical formula, and can understand the specific error value through the color.
[0082] In some embodiments, after obtaining the second calibration parameter, the fitting capability of the line scan distortion model can be further evaluated. That is, after step S40, the second calibration parameter can be used to perform stitching processing on the scan image sequence to obtain a non-distortion stitched image, and the accuracy of the second calibration parameter can be evaluated according to the non-distortion stitched image.
[0083] Specifically, the scan image sequence can be processed according to the process of processing the image according to the first calibration parameter. Since the second calibration parameter obtained by the second calibration has higher precision, the scan image sequence can be stitched by using the second calibration parameter to obtain a non-distortion image, so that the non-distortion image is stitched to obtain a non-distortion stitched image with higher precision. The stitching process can also refer to step S30, which will not be repeated here.
[0084] The non-distortion stitched image can be used to further verify the second calibration parameter. The specific verification dimensions can include: (1) geometric consistency verification; (2) re-projection error analysis; (3) actual task verification. The specific verification steps are as follows: (1) Geometric consistency verification: ① Straight line preservation verification: In the non-distortion stitched image, select straight line features in the scene, such as building edges and calibration board grid lines, and use Hough transform or least squares fitting to detect straightness.
[0085] The specific evaluation criteria include: the straight line fitting residual (pixel level deviation) should be ≤ 1 pixel. If the straight line is curved, that is, the pixel is greater than 1, it indicates that the distortion correction is not complete or the calibration parameter is not accurate.
[0086] ② Overlapping area alignment: Check whether there is misalignment or ghosting in the overlapping area of the non-distortion stitched image, such as the joint of adjacent images.
[0087] The evaluation criteria include: the feature point alignment error (SIFT / ORB matching point distance) should be ≤ 1 pixel.
[0088] (2) Reprojection error analysis: Specifically, the reprojection error is first calculated by obtaining the coordinates of the pixels in the first image and the reprojection coordinates of the corresponding points in the distortion-free stitched image. The reprojection error is then obtained by calculating the Euclidean distance between the coordinates of the pixels in the first image and the reprojection coordinates.
[0089] The accuracy of the second calibration parameter can be evaluated by calculating the mean reprojection error, which is the arithmetic mean of the reprojection errors of all feature points. The specific range of the mean and the corresponding accuracy can be found in Table 4.
[0090]
[0091] Table 4 (3) Verification through actual tasks: This could be a measurement task verification, specifically measuring objects of known dimensions, such as the side length of a calibration board grid, within a distortion-free stitched image. The proportional error between the measured value and the true value is calculated. Evaluation criteria: The proportional error should be ≤ 1% (e.g., measurement error of a 1m object ≤ 1cm).
[0092] As can be seen, in the above scheme, the scanned image sequence of the first image is first obtained; based on the scanned image sequence, the parameters of the camera corresponding to the scanned image sequence are calibrated for the first time to obtain the first calibration parameters of the camera; further, according to the first calibration parameters, the scanned image sequence is stitched together to obtain a distorted stitched image. The first calibration parameters can unify the coordinate system and improve the stitching consistency; according to the distorted stitched image, the first calibration parameters are fitted by a line scan distortion model based on Bézier curves to obtain the second calibration parameters of the camera. By flexibly adjusting the local distortion shape through the control points of the Bézier curves, the computational complexity is reduced, non-uniform distortion is adapted, and more accurate calibration parameters are formed, thereby improving the accuracy of camera calibration.
[0093] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0094] In one embodiment, a camera calibration device is provided, which corresponds one-to-one with the camera calibration methods described in the above embodiments. For example... Figure 5 As shown, the camera calibration device includes an acquisition module 101, a calibration module 102, a stitching module 103, and a fitting module 104. Detailed descriptions of each functional module are as follows: The acquisition module 101 is used to acquire the scanned image sequence of the first image; The calibration module 102 is configured to perform first calibration on the parameters of the camera corresponding to the scan image sequence based on the scan image sequence, to obtain first calibration parameters of the camera. The splicing module 103 is configured to perform splicing processing on the scan image sequence according to the first calibration parameters, to obtain a distortion spliced image. The fitting module 104 is configured to perform fitting processing on the first calibration parameters based on a line-scan distortion model of a Bezier curve according to the distortion spliced image, to obtain second calibration parameters of the camera.
[0095] In an embodiment, the acquisition module 101 is specifically configured to: perform continuous scanning on the first image by the camera, to obtain a scan image sequence of the first image.
[0096] In an embodiment, the calibration module 102 is specifically configured to: identify a two-dimensional code in the scan image sequence, to obtain a first position of the two-dimensional code; obtain a physical world coordinate of the two-dimensional code as a second position of the two-dimensional code; perform first calibration on the parameters of the camera according to the first position and the second position, to obtain the first calibration parameters of the camera.
[0097] In an embodiment, the splicing module 103 is specifically configured to: generate a second image according to the image size of the scan image sequence; calculate a first coordinate of the second image according to the image size of the scan image sequence; calculate a second coordinate of the second image based on the first calibration parameters and the first coordinate; perform splicing processing on the scan image sequence based on the second coordinate, to obtain a distortion spliced image.
[0098] In an embodiment, the fitting module 104 is specifically configured to: extract distortion feature points of the distortion spliced image and actual coordinate points corresponding to the distortion coordinate points; construct a line-scan distortion model of a Bezier curve according to the distortion coordinate points and the actual coordinate points; perform fitting processing on the first calibration parameters according to the line-scan distortion model, to obtain the second calibration parameters of the camera.
[0099] In an embodiment, the camera calibration apparatus is further configured to: calculate a re-projection error according to the first image and the second image; According to the re-projection error, the fitting capability of the line-scan distortion model is evaluated.
[0100] In an embodiment, the camera calibration apparatus is further configured to: According to the second calibration parameter, the scan image sequence is stitched to obtain a non-distortion stitched image. According to the non-distortion stitched image, the accuracy of the second calibration parameter is evaluated.
[0101] The present application provides a camera calibration apparatus, which obtains a scan image sequence of a first image; based on the scan image sequence, a first calibration parameter of a camera corresponding to the scan image sequence is obtained by performing a first calibration on the scan image sequence; further, according to the first calibration parameter, a distortion stitched image is obtained by stitching the scan image sequence; by using the first calibration parameter, a coordinate system can be unified, and the stitching consistency is improved; according to the distortion stitched image, a second calibration parameter of the camera is obtained by performing a fitting process on the first calibration parameter based on a line-scan distortion model of a Bezier curve; by using the control points of the Bezier curve, the local distortion shape can be flexibly adjusted, the calculation complexity is reduced, the non-uniform distortion is adapted, and more accurate calibration parameters are formed, thereby improving the accuracy of the camera calibration. The specific limitations of the camera calibration apparatus can be referred to the limitations of the camera calibration method described above, which will not be repeated here. The above-mentioned various modules in the camera calibration apparatus can be realized by software, hardware and combinations thereof, in whole or in part. The above-mentioned various modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to the above-mentioned various modules.
[0102] In one embodiment, a computer device is provided, and an internal structure diagram of the computer device can be as shown in Figure 6 The computer device includes a processor, a memory, a network interface and a database connected by a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with an external client through a network connection. The computer program is executed by the processor to implement the steps of a camera calibration method.
[0103] In one embodiment, a computer device is provided, and an internal structure diagram of the computer device can be as shown in obtain a scan image sequence of a first image; based on the scan image sequence, perform first calibration on parameters of a camera corresponding to the scan image sequence, to obtain first calibration parameters of the camera; according to the first calibration parameters, perform stitching processing on the scan image sequence, to obtain a distortion stitching image; according to the distortion stitching image, perform fitting processing on the first calibration parameters through a line-scan distortion model based on a Bezier curve, to obtain second calibration parameters of the camera.
[0104] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented: obtain a scan image sequence of a first image; based on the scan image sequence, perform first calibration on parameters of a camera corresponding to the scan image sequence, to obtain first calibration parameters of the camera; according to the first calibration parameters, perform stitching processing on the scan image sequence, to obtain a distortion stitching image; according to the distortion stitching image, perform fitting processing on the first calibration parameters through a line-scan distortion model based on a Bezier curve, to obtain second calibration parameters of the camera.
[0105] It should be noted that the functions or steps that the computer readable storage medium or the computer device can implement correspond to the related descriptions of the server side and the client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0108] The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not limit it. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features. The modification or replacement does not make the essence of the corresponding technical solution deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method of calibrating a camera, characterized by, The method comprises the following steps: obtaining a scan image sequence of a first image; based on the scan image sequence, first calibrating parameters of a camera corresponding to the scan image sequence to obtain first calibration parameters of the camera; according to the first calibration parameters, performing splicing processing on the scan image sequence to obtain a distortion splicing image; according to the distortion splicing image, fitting the first calibration parameters by using a line-scan distortion model based on a Bezier curve to obtain second calibration parameters of the camera.
2. The camera calibration method of claim 1, wherein, The method comprises the following steps: by using a camera, continuously scanning a first image to obtain a scan image sequence of the first image.
3. The camera calibration method of claim 1, wherein, The method comprises the following steps: identifying a two-dimensional code in the scan image sequence to obtain a first position of the two-dimensional code; obtaining a physical world coordinate of the two-dimensional code as a second position of the two-dimensional code; according to the first position and the second position, first calibrating parameters of the camera to obtain first calibration parameters of the camera.
4. The camera calibration method of claim 1, wherein, The method comprises the following steps: according to image sizes of the scan image sequence, generating a second image; according to the image sizes of the scan image sequence, calculating a first coordinate of the second image; based on the first calibration parameters and the first coordinate, calculating a second coordinate of the second image; based on the second coordinate, performing splicing processing on the scan image sequence to obtain a distortion splicing image.
5. The method of calibrating a camera of claim 1, wherein, The method comprises the following steps: extracting distortion feature points of the distortion splicing image and actual coordinate points corresponding to the distortion coordinate points; according to the distortion coordinate points and the actual coordinate points, constructing a line-scan distortion model of a Bezier curve; according to the line-scan distortion model, fitting the first calibration parameters to obtain second calibration parameters of the camera.
6. The method of calibrating a camera of claim 1, wherein, The method further comprises the following steps after the step of fitting the first calibration parameters by using the line-scan distortion model based on the Bezier curve to obtain the second calibration parameters of the camera: according to the first image and the second image, calculating a re-projection error; according to the re-projection error, evaluating fitting capability of the line-scan distortion model.
7. The method of calibrating a camera of claim 1, wherein, The method further comprises the following steps after the step of fitting the first calibration parameters by using the line-scan distortion model based on the Bezier curve to obtain the second calibration parameters of the camera: according to the second calibration parameters, performing splicing processing on the scan image sequence to obtain a non-distortion splicing image; according to the non-distortion splicing image, evaluating accuracy of the second calibration parameters.
8. A camera calibration apparatus characterized by comprising: The method comprises the following steps: an obtaining module, configured to obtain a scan image sequence of a first image; a calibration module, configured to perform a first calibration on parameters of a camera corresponding to the sequence of scanning images based on the sequence of scanning images, to obtain first calibration parameters of the camera; a splicing module, configured to perform splicing processing on the sequence of scanning images according to the first calibration parameters, to obtain a distorted spliced image; a fitting module, configured to perform fitting processing on the first calibration parameters based on a line-scan distortion model based on a Bezier curve according to the distorted spliced image, to obtain second calibration parameters of the camera.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the camera calibration method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the steps of the camera calibration method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Calibration method of line scanning camera
CN114494464A
Point coordinate distortion removing method and system based on quadratic curve fitting and storage medium
CN116433535A
Calibration method, system, chip and equipment
CN117422775A
HUD distortion correction method based on cubic Bezier curve fitting
CN119444625A
Image processing method and apparatus, calibration target, and computer-readable storage medium
WO2021212273A1