Method and device for calibrating camera

By acquiring and utilizing the theoretical parameters of the camera, the fixed focus and zoom lens are uniformly calibrated, which solves the problem of inconsistent lens calibration environment and improves calibration efficiency and resource utilization.

CN120031981APending Publication Date: 2025-05-23ZHEJIANG HUACHUANG VISION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510024794.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

The calibration environment of the fixed-focus lens and the zoom lens is not uniform, resulting in a low resource utilization rate.

Method used

Calibrate the camera based on these parameters by obtaining the theoretical parameters of the target camera, including the theoretical zoom curve of the zoom lens and the theoretical focus position of the fixed-focus lens. The specific method includes adjusting the theoretical parameters of the lens to match the actual curve and focus position, and determining the actual lens parameters by fitting and calibrating the image center and center.

Benefits of technology

The calibration environment of fixed-focus lens and zoom lens is unified, and the efficiency and resource utilization of lens calibration are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120031981A_ABST
    Figure CN120031981A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a camera calibration method and device, and the method comprises the steps: obtaining the theoretical parameters of a target camera, the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a prime lens, and the binocular camera comprises a zoom lens and a prime lens; and calibrating the target camera according to the theoretical parameters. Through the method and the device, the problem of relatively high resource utilization rate caused by non-uniform calibration environments of a prime lens and a zoom lens in related technologies is solved, and the effect of improving the lens calibration efficiency is further achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer vision technology, and in particular to a method and device for calibrating a camera. Background Art

[0002] Lens calibration refers to the adjustment of camera lenses to ensure that they can focus and capture images correctly. This usually involves making some settings in the camera, such as adjusting parameters such as focus, aperture and shutter speed to ensure image clarity and correct exposure. In addition, special tools and equipment can also be used to detect and calibrate the lens, such as using calibration boards and calibration software to determine the accuracy and deviation of the lens. Lens calibration is very important for cameras because it ensures that the images captured are of high quality and accurate. A fast calibration method for zoom lenses based on images captured with single focal length focus is widely used in cameras. The main disadvantages are as follows: the calibration methods for fixed-focus lenses and zoom lenses are different, and two different schemes need to be maintained.

[0003] There is currently no effective solution to the above problems. Summary of the invention

[0004] The embodiments of the present invention provide a method and device for calibrating a camera, so as to at least solve the problem in the related art that the calibration environment of a fixed-focus lens and a zoom lens is not uniform, resulting in a high resource utilization rate.

[0005] According to one embodiment of the present invention, a method for calibrating a camera is provided, comprising: obtaining theoretical parameters of a target camera, wherein the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a fixed-focus lens, and the binocular camera includes a zoom lens and a fixed-focus lens; and calibrating the target camera according to the theoretical parameters.

[0006] In an exemplary embodiment, calibrating the target camera according to the theoretical parameters includes: when the lens of the target camera is the zoom lens, determining an actual zoom curve according to a theoretical zoom curve of the zoom lens, wherein the theoretical parameters include the theoretical zoom curve; and when the lens of the target camera is the fixed-focus lens, determining an actual focusing position according to a theoretical focusing position of the fixed-focus lens, wherein the theoretical parameters include the theoretical focusing position.

[0007] In an exemplary embodiment, determining the actual zoom curve according to the theoretical zoom curve of the zoom lens includes: determining N theoretical points on the theoretical zoom curve, where N is an integer greater than 1; and determining the actual zoom curve through the N theoretical points.

[0008] In an exemplary embodiment, determining the actual zoom curve through N theoretical points includes: adjusting the first theoretical parameter and the second theoretical parameter of the zoom lens to the coordinate values ​​corresponding to each of the theoretical points, respectively, and obtaining N target points by adjusting the value of the second theoretical parameter; and fitting the N target points to obtain the actual zoom curve.

[0009] In an exemplary embodiment, N target points are obtained by adjusting the value of the second theoretical parameter, including: photographing a test chart through the zoom lens, and determining the value of the second theoretical parameter of the test chart that is clearest as the target coordinate value of the target point, wherein a relay lens is placed between the zoom lens and the test chart.

[0010] In an exemplary embodiment, after obtaining N target points by adjusting the value of the second theoretical parameter, the method further includes: determining the difference between the horizontal coordinates of the first target point and the first theoretical point as a first deviation; determining the difference between the vertical coordinates of the first target point and the first theoretical point as a second deviation; wherein the first theoretical point is any point among the N theoretical points, and the first target point is a point obtained by adjusting the first theoretical point.

[0011] In an exemplary embodiment, when the lens of the target camera is the fixed-focus lens, determining the actual focus position according to the theoretical focus position of the fixed-focus lens includes: when a relay lens is placed between the fixed-focus lens and the test chart, adjusting the focus position of the fixed-focus lens to a first theoretical focus position, moving the focus position of the fixed-focus lens, and determining the clearest focus position of the test chart taken as a first actual focus position; when no relay lens is placed between the fixed-focus lens and the test chart, adjusting the focus position of the fixed-focus lens to a second theoretical focus position, moving the focus position of the fixed-focus lens, and determining the clearest focus position of the test chart taken as a second actual focus position.

[0012] In an exemplary embodiment, after determining the clearest focus position of the photographed test image as the first actual focus position, the method further includes: determining the difference between the first actual focus position and the first theoretical focus position as a third deviation.

[0013] In an exemplary embodiment, calibrating the target camera according to the theoretical parameters further includes: obtaining a first image of a test chart taken by the zoom lens, and calibrating the zoom lens according to a center and a center of a circle of the first image, wherein the test chart includes a circle; and / or obtaining a second image of the test chart taken by the fixed-focus lens, and calibrating the zoom lens according to a center and a center of a circle of the second image, wherein the test chart includes a circle.

[0014] According to another embodiment of the present invention, there is provided a device for calibrating a camera, comprising: an acquisition module, used to acquire theoretical parameters of a target camera, wherein the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a fixed-focus lens, and the binocular camera includes a zoom lens and a fixed-focus lens; and a calibration module, used to calibrate the target camera according to the theoretical parameters.

[0015] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of any of the above methods when executed by a processor.

[0016] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0017] According to yet another embodiment of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0018] Through the present invention, the theoretical parameters of the target camera are obtained, wherein the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a fixed-focus lens, and the binocular camera includes a zoom lens and a fixed-focus lens; the target camera is calibrated according to the theoretical parameters. Therefore, the problem of high resource utilization caused by the non-uniform calibration environment of the fixed-focus lens and the zoom lens in the related art can be solved, and the effect of improving the lens calibration efficiency can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a schematic diagram of a conventional test of a far focal length according to an embodiment of the present invention;

[0020] Figure 2 is a schematic diagram of relay mirror imaging according to an embodiment of the present invention;

[0021] Figure 3 is a schematic diagram of a test of a relay lens and a camera module at a large object distance according to an embodiment of the present invention;

[0022] Figure 4 is a hardware structure block diagram of a mobile terminal for a method of calibrating a camera according to an embodiment of the present invention;

[0023] Figure 5 is a flow chart of a method for calibrating a camera according to an embodiment of the present invention;

[0024] Figure 6 is a schematic diagram of a binocular camera according to an embodiment of the present invention Figure 1 ;

[0025] Figure 7 is a schematic diagram of a binocular camera according to an embodiment of the present invention Figure 2 ;

[0026] Figure 8 is a schematic diagram of zoom lens curve calibration according to an embodiment of the present invention;

[0027] Fig. 9 is a schematic diagram of zoom lens scale factor calibration according to an embodiment of the present invention;

[0028] Fig.10 is a schematic diagram of fixed-focus lens curve calibration according to an embodiment of the present invention;

[0029] Fig.11 is a schematic diagram of calibration of a fixed-focus lens scale factor according to an embodiment of the present invention;

[0030] Fig.12 is a schematic diagram of converting an image space into a parameter space according to an embodiment of the present invention;

[0031] Fig.13 is a schematic diagram of a three-dimensional cone according to an embodiment of the present invention;

[0032] Fig.14 is a schematic diagram of a calibration plate according to an embodiment of the present invention;

[0033] Fig.15 is a schematic diagram of a fixed-focus lens calibration process according to an embodiment of the present invention;

[0034] Fig.16 is a schematic diagram of zoom lens calibration according to an embodiment of the present invention;

[0035] Fig.17 is a flowchart of a procedure for adjusting a camera according to an embodiment of the present invention;

[0036] Fig.18 4 is a structural block diagram of a device for calibrating a camera according to an embodiment of the present invention. DETAILED DESCRIPTION

[0037] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0039] The related technologies of the embodiments of the present invention are as follows:

[0040] 1) Calibration environment

[0041] Figure 1 FIG. 1 is a schematic diagram of a conventional test of a telephoto distance according to an embodiment of the present invention. In the camera module test, the ideal solution is to test within the nominal focal length of the camera module. The telephoto distance is often several thousand meters. When testing at this distance, if a conventional test is used, the following will occur: Figure 1 The situation shown:

[0042] ① The test requires a large size (i.e. a large venue);

[0043] ② A slight change in the field of view angle + an increase in the object distance will result in an increase in the diagonal size of the image, which may cause the test chart to not fill the entire field of view.

[0044] Therefore, when the object distance reaches a certain value, the conventional method obviously cannot meet the requirements. The relay lens can not only meet the object distance requirements, but also ensure that the chart fills the entire field of view.

[0045] Figure 2 FIG. 1 is a schematic diagram of a relay lens imaging according to an embodiment of the present invention. A relay lens (Relay Lens), also known as a teleconverter, is shown in FIG. Figure 2 As shown in the figure, the optical principle is to generate an upright and enlarged virtual image of a close object (actual detection target) at a farther distance. When the object distance is less than the focal length of the relay lens (RelayLens), the object passes through the lens to form an upright and enlarged virtual image; therefore, different values ​​can generate virtual images of test charts (Charts) at different distances: the color correction matrix (CCM) can be used to evaluate the imaging of charts at different distances.

[0046] In this case, the object generates a positive virtual image with image distance greater than object distance. According to Gauss's imaging formula: 1 / u+1 / v=1 / f, where f is the focal length, which is positive for convex lenses and negative for concave lenses; u is the object distance; v is the image distance, which is positive for real images and negative for virtual images. Therefore, if the parameters are converted to algebraic form, the following relationship can be obtained for the teleconverter composed of the lens group: 1 / u-1 / v=1 / f, Figure 3 It is a schematic diagram of testing a relay lens in cooperation with a camera module at a large object distance according to an embodiment of the present invention.

[0047] By comparing the relay lens with and without the relay lens, it can be found that after selecting the appropriate object distance, the teleconverter can expand the image distance and magnify the image, and the chart can fill the entire field of view of the CCM. So far, from a theoretical perspective, all the difficult problems have been qualitatively solved. Therefore, the module test work of the embodiment of this aspect is completed with the cooperation of the relay lens.

[0048] The camera calibration method provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 4 FIG. 1 is a hardware structure block diagram of a mobile terminal for a method of calibrating a camera according to an embodiment of the present invention. Figure 4 As shown, the mobile terminal may include one or more ( Figure 4 Only one is shown in the figure) a processor 402 (the processor 402 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 404 for storing data, wherein the mobile terminal may also include a transmission device 406 and an input / output device 408 for communication functions. It can be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown.

[0049] The memory 404 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for calibrating a camera in the embodiment of the present invention. The processor 402 executes various functional applications and data processing by running the computer program stored in the memory 404, that is, to implement the above method. The memory 404 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 404 may further include a memory remotely arranged relative to the processor 402, and these remote memories may be connected to the mobile terminal via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0050] The transmission device 406 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 406 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 406 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0051] In this embodiment, a method running on the above mobile terminal or network architecture is provided. Figure 5 is a flow chart of a method for calibrating a camera according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:

[0052] Step S502, obtaining theoretical parameters of a target camera, wherein the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a fixed-focus lens, and the binocular camera includes a zoom lens and a fixed-focus lens;

[0053] The target camera can be a monocular camera or a binocular camera. Figure 6 is a schematic diagram of a binocular camera according to an embodiment of the present invention Figure 1 , Figure 7 is a schematic diagram of a binocular camera according to an embodiment of the present invention Figure 2 ,like Figure 6 , Figure 7 As shown, the binocular camera is equipped with a zoom lens and a fixed focus lens at the same time. The theoretical parameter can be a theoretical zoom curve of the zoom lens or a theoretical fixed focus position of the fixed focus lens.

[0054] Step S504: calibrate the target camera according to the theoretical parameters.

[0055] The above calibration of the target camera includes calibration of the zoom lens, calibration of the fixed-focus lens and calibration of the binocular camera.

[0056] Optionally, in the case that the lens of the target camera is the zoom lens, the actual zoom curve is determined according to a theoretical zoom curve of the zoom lens, wherein the theoretical parameters include the theoretical zoom curve.

[0057] When the lens of the target camera is a zoom lens, firstly, a theoretical zoom curve of the zoom lens is obtained, and an actual zoom curve is determined by the theoretical zoom curve. The actual zoom curve can be determined by curve calibration and proportional integral (PI) calibration.

[0058] For zoom lenses, curve calibration involves the relationship between the lens at different focal lengths (zoom) and focus positions (focus). This includes measuring the focus accuracy and focus depth at different focal lengths, as well as ensuring the consistency of image quality when zooming. By measuring the imaging results at various focal lengths and focus settings, a curve can be generated for adjustment and optimization in actual use.

[0059] Specifically, N theoretical points are determined on the theoretical zoom curve, where N is an integer greater than 1; the actual zoom curve is determined by the N theoretical points. The first theoretical parameter and the second theoretical parameter of the zoom lens are respectively adjusted to the coordinate values ​​corresponding to the theoretical points, and N target points are obtained by adjusting the value of the second theoretical parameter; the N target points are fitted to obtain the actual zoom curve. The test chart is photographed by the zoom lens, and the value of the second theoretical parameter of the test chart that is clearest is determined as the target coordinate value of the target point, wherein a relay lens is placed between the zoom lens and the test chart.

[0060] The first theoretical parameter is zoom, which refers to the ability of the lens to adjust the focal length so that the captured image can be enlarged or reduced. The second theoretical parameter is focus, which refers to the process of the camera adjusting the lens to make the captured object clear. Figure 8 is a schematic diagram of zoom lens curve calibration according to an embodiment of the present invention. Figure 8 As shown in the figure, an image coordinate system is established with zoom as the horizontal coordinate and focus as the vertical coordinate. Therefore, each point on the theoretical zoom curve and the actual zoom curve can be represented by a pair of coordinate points with the values ​​of zoom and focus as the horizontal and vertical coordinates. N points are determined on the above theoretical zoom curve, where N can be an integer greater than 1. The horizontal coordinates of the N points are kept unchanged (zoom unchanged). The best focus position (the above theoretical point) is found by moving the point with the vertical coordinate (focus), and N target points are determined. The above N target points are connected with a smooth curve, so that the actual zoom curve of the above zoom lens can be fitted.

[0061] Specifically, in the case of a relay lens, move zoom and focus to the theoretical position of point 1 on the theoretical zoom curve, move focus and find the best focus position, and obtain point 1. Move zoom and focus to the theoretical position of point 2 on the theoretical zoom curve, move focus and find the best focus position, and obtain point 2. Move zoom and focus to the theoretical position of point 3 on the theoretical zoom curve, move focus and find the best focus position, and obtain point 3. Move zoom and focus to the theoretical position of point 4 on the theoretical zoom curve, move focus and find the best focus position, and obtain point 4. Move zoom and focus to the theoretical position of point 5 on the theoretical zoom curve, move focus and find the best focus position, and obtain point 5. Based on the actual data from points 1 to 5. Use the least squares method to fit the actual zoom curve of the zoom lens. Among them, the least squares method is a commonly used curve fitting method, which finds the best fitting curve by minimizing the sum of squares of the residuals between the actual observation value and the fitted value.

[0062] For zoom lenses, PI calibration mainly involves adjusting the calibration of the lens' principal point and image plane. This is an important step to ensure that the image is correctly aligned on the sensor, affecting the image's geometric distortion and focus accuracy. The principal point position may shift due to lens manufacturing errors or improper installation, so it needs to be measured and adjusted.

[0063] Specifically, the difference between the horizontal coordinates of the first target point and the first theoretical point is determined as the first deviation; the difference between the vertical coordinates of the first target point and the first theoretical point is determined as the second deviation; wherein, the first theoretical point is any point among N theoretical points, and the first target point is a point obtained by adjusting the first theoretical point.

[0064] Fig. 9 is a schematic diagram of zoom lens scale factor calibration according to an embodiment of the present invention. Fig. 9As shown, an image coordinate system is established with zoom as the horizontal axis and focus as the vertical axis, where zoom refers to the ability of the lens to adjust the focal length so that the captured image can be enlarged or reduced. Focus refers to the process of the camera adjusting the lens to make the captured object clear. In the case of a relay lens, move zoom and focus to the theoretical position of point 1 on the theoretical zoom curve, move focus and find the best focus position, assuming it is point 1, move zoom and focus to the theoretical position of point 2 on the theoretical zoom curve, move focus and find the best focus position, assuming it is point 2. In actual situations, N points can be determined on the theoretical zoom curve of the zoom lens, where N can be an integer greater than 1. In order to better determine the actual zoom curve, the value of N should be as large as possible. This is just an example, so N is 2. The above points 1' and 2' are located on the actual zoom curve. The theoretical zoom curve of the above zoom lens can be obtained by connecting 1' and 2' with a smooth curve. Shift points 1` and 2` to coincide with points 1 and 2. The horizontal shift is the first deviation (zoom deviation value) and the vertical shift is the second deviation (focus deviation value). In theory, 1` and 2` are the best focus positions of the zoom lens found by moving the focus. Therefore, the horizontal coordinate of point 1` should be the same as that of point 1, and the horizontal coordinate of point 2` should be the same as that of point 2, that is, the first deviation is 0. However, the actual process of moving the focus may cause changes in zoom, that is, the horizontal coordinate of point 1` will deviate from that of point 1, and the horizontal coordinate of point 2` will deviate from that of point 2. As long as the above deviations are within the acceptable error range, it is fine.

[0065] In the case that the lens of the target camera is the fixed-focus lens, the actual focus position is determined according to the theoretical focus position of the fixed-focus lens, wherein the theoretical parameters include the theoretical focus position.

[0066] When the lens of the target camera is a fixed-focus lens, the theoretical focus position of the fixed-focus lens is first obtained, and the actual focus position is determined by the theoretical focus position. The actual focus position can be determined by curve calibration and proportional integral (PI) calibration.

[0067] Although fixed-focus lenses do not have zoom capabilities, they can also be calibrated in relation to focus. In particular, this is done to ensure that focus is accurate at different distances and that the image quality is consistent at different apertures. Focus curves may be generated by measuring the focus position at different shooting distances. These curves help optimize focus accuracy, especially when shooting fast-moving objects or applications that require precise focus.

[0068] Specifically, when a relay lens is placed between the fixed-focus lens and the test chart, the focus position of the fixed-focus lens is adjusted to a first theoretical focus position, the focus position of the fixed-focus lens is moved, and the focus position of the test chart that is photographed with the clearest image is determined as a first actual focus position. When a relay lens is not placed between the fixed-focus lens and the test chart, the focus position of the fixed-focus lens is adjusted to a second theoretical focus position, the focus position of the fixed-focus lens is moved, and the focus position of the test chart that is photographed with the clearest image is determined as a second actual focus position.

[0069] Fig.10 is a schematic diagram of a fixed-focus lens curve calibration according to an embodiment of the present invention. Fig.10 As shown, the first theoretical focus position is the infinity theoretical position of the fixed-focus lens, and the first actual position is the clearest focus position of the fixed-focus lens determined based on the infinity theoretical position. In the case of a relay lens, move the focus to the infinity theoretical position, move the focus and find the best focus position, and get point 1. The second theoretical position is the closest object distance theoretical position of the fixed-focus lens, and the second actual position is the clearest focus position of the fixed-focus lens determined based on the closest object distance theoretical position. The function of the relay lens is to magnify the image for measurement under large focal length conditions. Therefore, a relay lens is not required when determining the actual position of the closest object distance at the closest object distance theoretical position. In the case of no relay lens, move the chart to the closest focus distance position of the lens. Move the focus to the closest object distance theoretical position, move the focus and find the best focus position, and get point 2. The range from point 1 to point 2 is the effective use range of the fixed-focus lens.

[0070] For fixed-focus lenses, PI calibration is still important. This is because the accuracy of the principal point and the imaging plane of a fixed-focus lens directly affects the geometric distortion of the image and the position of the focal plane. During the manufacturing process, if the lens assembly is not properly aligned or the optical axis is not correct, poor imaging results will result. Therefore, PI calibration can ensure the optical performance of the lens.

[0071] Specifically, when a relay lens is placed between the fixed-focus lens and the test chart, the focus position of the fixed-focus lens is adjusted to a first theoretical focus position, the focus position of the fixed-focus lens is moved, and the clearest focus position of the captured test chart is determined as a first actual focus position; and the difference between the first actual focus position and the first theoretical focus position is determined as a third deviation.

[0072] Fig.11 is a schematic diagram of the calibration of the scale factor of a fixed focus lens according to an embodiment of the present invention. Fig.11As shown, the actual focus position of the fixed focus lens is determined on the focus axis. In the case of a relay lens, the focus is moved to the theoretical position of 1 on the focus axis, which is the first theoretical focus position mentioned above. The focus is moved and the best focus position is found, which is the first actual focus position mentioned above, and the obtained value is 1'. The offset is the third deviation (focus deviation value) mentioned above.

[0073] When the target camera is a binocular lens, a first image of a test chart taken by the zoom lens is obtained, and the zoom lens is calibrated according to the center and the center of the first image, wherein the test chart includes a circle; and / or a second image of the test chart taken by the fixed-focus lens is obtained, and the zoom lens is calibrated according to the center and the center of the second image, wherein the test chart includes a circle.

[0074] The binocular lens includes a zoom lens and a fixed-focus lens. The criterion for determining whether calibration is required is whether the center of the image captured by the lens coincides with the center of the circle. If they coincide, calibration is not required, and if they do not coincide, calibration is required. The binocular lens calibration of the embodiment of the present invention adopts the center calibration method of the Hough circle transformation circle. The binocular lens center calibration is an important step in the binocular system, which ensures that the optical centers of the two lenses are aligned to obtain accurate visual measurement results.

[0075] The main contents of Hough circle transform are as follows: The general equation of a circle is: (xa)2+(yb)2=r 2 , where (a, b) are the coordinates of the center of the circle and r is the radius of the circle. Convert the image space into parameter space, where the xy plane is converted into abr parameter space. Then a circle passing through the x and y points in the image space corresponds to a three-dimensional cone with varying height in the parameter space. Fig.12 Schematic diagram of image space conversion to parameter space according to an embodiment of the present invention. The three-dimensional cones in the corresponding parameter space passing through the same circle in the image space must intersect at a point (a, b, r) in the r plane, so that the parameters of a circle can be obtained through this point. Fig.13 3D cone according to an embodiment of the present invention is a schematic diagram of a standard Hough circle transform. The basic idea is: for each edge point in the image, we consider all possible circles passing through the point. For each such circle, we add 1 to the accumulator corresponding to its parameters (a, b, r). Finally, the parameter corresponding to the point with the largest value in the accumulator is the parameter of the circle in the image.

[0076] The steps of the binocular lens center calibration method of the embodiment of the present invention are as follows:

[0077] Preparation: Install the binocular system stably on a flat surface and a stable bracket, and ensure that the positions and angles of the two lenses have been adjusted.

[0078] Chart calibration board: There are multiple marking points on the calibration board. These marking points make it easy to determine the shape of the position. Fig.14 is a schematic diagram of a calibration plate according to an embodiment of the present invention.

[0079] Calibration process: Place the calibration plate in the field of view of the binocular system and make sure it is visible to both lenses. Align the optical axis of the fixed focus lens with the marker by adjusting the position and angle of the binocular system. This can be adjusted by whether the image center point is in the center of the image. Fig.15 4 is a schematic diagram of a fixed-focus lens calibration process according to an embodiment of the present invention.

[0080] Using the center point position in the image of the zoom lens at maximum magnification as a reference, adjust the position and angle of the second lens so that its optical axis is also aligned on the marked point. Fig.16 is a schematic diagram of zoom lens calibration according to an embodiment of the present invention.

[0081] Specifically, the calibration method of the zoom lens and the fixed-focus lens is as follows: the first / second image is placed in the image coordinate system, which is a coordinate system used to describe the pixel position in the image. In the common image coordinate system, the origin, x-axis, and y-axis are included, so each pixel in the image can be represented by a two-dimensional coordinate (x, y) to represent its position. In this embodiment, assuming that the width of the image is W and the height is H, the first coordinate of the center of the first / second image is (W / 2, H / 2), and the second coordinate of the center of the circle in the first / second image is obtained by Hough circle transformation detection, assuming that the detected center coordinates are (x_d, y_d). The first rotation angle of the zoom / fixed-focus lens is determined and adjusted according to the deviation between the first coordinate and the second coordinate. The above deviation is the difference between the detected center of the circle and the center of the image, and the calculation formula is Δx=x_d-(W / 2); Δy=y_d-(H / 2). The formula for calculating the rotation angle using the deviation is θ=arctan(Δy / Δx). Therefore, the calculation formula of the first rotation angle is θ=arctan((y_d-(H / 2)) / (x_d-(W / 2))). The zoom / fixed-focus lens is adjusted according to the first rotation angle so that the second coordinate is as close to the first coordinate as possible. For example, if the second coordinate is located on the left side of the first coordinate, the zoom / fixed-focus lens is rotated right by θ degrees; if the second coordinate is located on the right side of the first coordinate, the zoom / fixed-focus lens is rotated left by θ degrees.

[0082] Calibration Verification: After completing the lens center calibration, you can verify the accuracy of the calibration by observing the degree of overlap of the markers in the image of the binocular system. If the markers are aligned and there is no misalignment, it means that the lens center calibration is successful.

[0083] Fig.17 is a flowchart of a procedure for adjusting a camera according to an embodiment of the present invention, such as Fig.17 As shown, the process includes the following steps:

[0084] S1701, the device is placed in a teleconverter environment;

[0085] S1702, fixed focus lens PI calibration;

[0086] S1703, fixed focus lens curve calibration;

[0087] S1704, the fixed-focus lens is clearly focused, jump to S1708;

[0088] S1705, zoom lens PI calibration;

[0089] S1706, zoom lens curve calibration;

[0090] S1707, zoom lens with maximum magnification and clear focus;

[0091] S1708, center calibration;

[0092] S1709, record lens calibration data.

[0093] Note that the above S1702-S1704 and S1705-S1707 are parallel steps and there is no order of precedence.

[0094] Optionally, the execution entity of the above steps can be a background processor, or other devices with similar processing capabilities, or a machine that integrates at least an image acquisition device and a data processing device, wherein the image acquisition device may include a graphics acquisition module such as a camera, and the data processing device may include a computer, a mobile phone or other terminal, but is not limited to this.

[0095] Through the above steps, the problem of high resource utilization caused by inconsistent calibration environments for fixed-focus lenses and zoom lenses in related technologies is solved, and the lens calibration efficiency is improved.

[0096] In the embodiment of the present invention, the zoom lens calibration and the fixed-focus lens calibration use the same test environment, and the calibration process is synchronized, which saves costs and resources in time and space. The fixed-focus lens calibration, zoom lens calibration, center calibration, and program flow in the embodiment of the present invention are not only applicable to the field of video conferencing, but also to the control of zoom lenses in the fields of security and protection.

[0097] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0098] In this embodiment, a device for calibrating a camera is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are omitted. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0099] Fig.18 is a structural block diagram of an apparatus for calibrating a camera according to an embodiment of the present invention, such as Fig.18 As shown, the device includes an acquisition module 1802, which is used to acquire theoretical parameters of a target camera, wherein the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a fixed-focus lens, and the binocular camera includes a zoom lens and a fixed-focus lens; and a calibration module 1804, which is used to calibrate the target camera according to the theoretical parameters.

[0100] In an exemplary embodiment, the above-mentioned device is also used to determine the actual zoom curve according to the theoretical zoom curve of the zoom lens when the lens of the target camera is the zoom lens, wherein the theoretical parameters include the theoretical zoom curve; and to determine the actual focusing position according to the theoretical focusing position of the fixed-focus lens when the lens of the target camera is the fixed-focus lens, wherein the theoretical parameters include the theoretical focusing position.

[0101] In an exemplary embodiment, the above-mentioned apparatus is further used to determine N theoretical points on the theoretical zoom curve, wherein N is an integer greater than 1; and the actual zoom curve is determined by the N theoretical points.

[0102] In an exemplary embodiment, the above-mentioned device is also used to adjust the first theoretical parameter and the second theoretical parameter of the zoom lens to the coordinate values ​​corresponding to each of the theoretical points, respectively, and obtain N target points by adjusting the value of the second theoretical parameter; and fit the N target points to obtain the actual zoom curve.

[0103] In an exemplary embodiment, the above-mentioned device is also used to photograph the test image through the zoom lens, and determine the value of the clearest second theoretical parameter of the photographed test image as the target coordinate value of the target point, wherein a relay lens is placed between the zoom lens and the test image.

[0104] In an exemplary embodiment, the above-mentioned device is also used to determine the difference between the horizontal coordinates of the first target point and the first theoretical point as the first deviation; and determine the difference between the vertical coordinates of the first target point and the first theoretical point as the second deviation; wherein, the first theoretical point is any point among N theoretical points, and the first target point is a point obtained by adjusting the first theoretical point.

[0105] In an exemplary embodiment, the above-mentioned device is also used to adjust the focus position of the fixed-focus lens to a first theoretical focus position, move the focus position of the fixed-focus lens, and determine the clearest focus position of the test chart taken as the first actual focus position when a relay lens is placed between the fixed-focus lens and the test chart; and adjust the focus position of the fixed-focus lens to a second theoretical focus position, move the focus position of the fixed-focus lens, and determine the clearest focus position of the test chart taken as the second actual focus position when no relay lens is placed between the fixed-focus lens and the test chart.

[0106] In an exemplary embodiment, the apparatus is further configured to determine a difference between the first actual focus position and the first theoretical focus position as a third deviation.

[0107] In an exemplary embodiment, the above-mentioned device is also used to obtain a first image of a test chart taken by the zoom lens, and calibrate the zoom lens according to the center and the center of the first image, wherein the test chart includes a circle; and / or, obtain a second image of the test chart taken by the fixed-focus lens, and calibrate the zoom lens according to the center and the center of the second image, wherein the test chart includes a circle.

[0108] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0109] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0110] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0111] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0112] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0113] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0114] An embodiment of the present invention further provides a computer program product, including a computer program, which implements the steps of the method described in each embodiment of the present application when executed by a processor.

[0115] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0116] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for calibrating a camera, characterized in that: include: Obtain theoretical parameters of a target camera, wherein the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a fixed-focus lens, and the binocular camera includes a zoom lens and a fixed-focus lens; The target camera is calibrated according to the theoretical parameters.

2. The method according to claim 1, characterized in that The target camera is calibrated according to the theoretical parameters, including: In the case where the lens of the target camera is the zoom lens, determining an actual zoom curve according to a theoretical zoom curve of the zoom lens, wherein the theoretical parameters include the theoretical zoom curve; In the case that the lens of the target camera is the fixed-focus lens, the actual focus position is determined according to the theoretical focus position of the fixed-focus lens, wherein the theoretical parameters include the theoretical focus position.

3. The method according to claim 2, characterized in that Determining an actual zoom curve according to a theoretical zoom curve of the zoom lens comprises: Determining N theoretical points on the theoretical zoom curve, where N is an integer greater than 1; The actual zoom curve is determined by the N theoretical points.

4. The method according to claim 3, characterized in that Determining the actual zoom curve through the N theoretical points includes: The first theoretical parameter and the second theoretical parameter of the zoom lens are respectively adjusted to the coordinate values ​​corresponding to the theoretical points, and N target points are obtained by adjusting the values ​​of the second theoretical parameters; The N target points are fitted to obtain the actual zoom curve.

5. The method according to claim 4, characterized in that By adjusting the value of the second theoretical parameter, N target points are obtained, including: The test chart is photographed through the zoom lens, and the value of the second theoretical parameter of the test chart that is clearest is determined as the target coordinate value of the target point, wherein a relay lens is placed between the zoom lens and the test chart.

6. The method according to claim 4, characterized in that After obtaining N target points by adjusting the value of the second theoretical parameter, the method further includes: Determine the difference between the abscissas of the first target point and the first theoretical point as a first deviation; determining a difference between the longitudinal coordinates of the first target point and the first theoretical point as a second deviation; The first theoretical point is any point among N theoretical points, and the first target point is a point obtained by adjusting the first theoretical point.

7. The method according to claim 2, characterized in that In the case where the lens of the target camera is the fixed-focus lens, determining the actual focus position according to the theoretical focus position of the fixed-focus lens includes: In the case where a relay lens is placed between the fixed-focus lens and the test chart, adjusting the focus position of the fixed-focus lens to a first theoretical focus position, moving the focus position of the fixed-focus lens, and determining the clearest focus position of the photographed test chart as a first actual focus position; In the case where no relay lens is placed between the fixed-focus lens and the test chart, the focus position of the fixed-focus lens is adjusted to a second theoretical focus position, the focus position of the fixed-focus lens is moved, and the clearest focus position of the captured test chart is determined as a second actual focus position.

8. The method according to claim 7, characterized in that After determining the clearest focus position of the photographed test image as the first actual focus position, the method further includes: A difference between the first actual focus position and the first theoretical focus position is determined as a third deviation.

9. The method according to claim 1, characterized in that: The target camera is calibrated according to the theoretical parameters, and further comprises: Acquire a first image of a test chart taken by the zoom lens, and calibrate the zoom lens according to the center of the first image and the center of a circle, wherein the test chart includes a circle; and / or, A second image of a test chart shot by the fixed-focus lens is obtained, and the zoom lens is calibrated according to a center of the second image and a center of a circle, wherein the test chart includes a circle.

10. A device for calibrating a camera, characterized in that: include: An acquisition module, used for acquiring theoretical parameters of a target camera, wherein the target camera is a monocular camera or a binocular camera, the lens of the monocular camera is a zoom lens or a fixed-focus lens, and the binocular camera includes a zoom lens and a fixed-focus lens; A calibration module is used to calibrate the target camera according to the theoretical parameters.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 9 when executed by a processor.

12. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 9.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.