Temperature coefficient calibration method, system, electronic device and storage medium
By selecting sample cameras in the batch of structured optical cameras, determining their temperature coefficients and applying a unified temperature coefficient, the time-consuming and labor-consuming problem in the prior art is solved, and efficient and low-cost temperature coefficient calibration is achieved.
Patent Information
- Application Number
- CN202210899356.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-28
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-07-28
AI Technical Summary
In the prior art, the temperature coefficient calibration process of structured optical cameras consumes time and effort and needs to be carried out one by one, resulting in a large workload on the production line.
Select several sample cameras from the current batch of cameras, determine their corresponding shooting temperature, and obtain speckle maps. Through the temperature compensation model and statistical algorithm, a unified temperature coefficient is determined and applied to all cameras.
It greatly improves the efficiency and quality of the temperature coefficient calibration of structured optical cameras leaving the factory and reduces the cost of the production line.
Smart Images

Figure CN115393446B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a temperature coefficient calibration method, system, electronic device, and storage medium. Background Art
[0002] A structured light camera is a device that obtains depth information by emitting an active infrared light source. A structured light camera consists of two basic components: an infrared laser projector and an infrared camera. The infrared laser projector projects a known structured light pattern onto the target object. The structured light pattern will deform on the surface of the target object in a manner related to the shooting distance. The infrared camera captures the deformed pattern and then uses a stereo matching algorithm to obtain the parallax of each pixel on the pattern, thereby restoring the depth information. However, in actual use, due to the thermal expansion and contraction characteristics of the infrared laser projector, the size, shape, and position of the structured light pattern emitted by the structured light camera at different operating temperatures may be different. Therefore, the temperature coefficient calibration of the structured light camera is required before leaving the factory. In actual use, high-quality depth information can only be obtained through the combination of temperature coefficient compensation and stereo matching algorithm.
[0003] The inventors of this application have discovered that, in the industry, temperature coefficient calibration is generally performed on each structured light camera leaving the factory. The calibration process for each structured light camera requires a certain amount of time, and the number of structured light cameras leaving the factory is very large. Therefore, the workload of the temperature coefficient calibration process of the entire production line is very large, time-consuming and labor-intensive. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide a temperature coefficient calibration method, system, electronic device and storage medium, which can improve the efficiency and quality of temperature coefficient calibration of structured light cameras before leaving the factory and reduce the cost of temperature coefficient calibration of the entire production line.
[0005] To solve the above technical problems, an embodiment of the present application provides a temperature coefficient calibration method, comprising the following steps: selecting a number of sample cameras from a current batch of cameras, and determining a shooting temperature corresponding to each of the sample cameras based on an operating temperature range of the current batch of cameras; wherein the shooting temperature includes a first temperature and a second temperature that is not equal to the first temperature; obtaining a first speckle pattern captured by each of the sample cameras on a preset plane at the first temperature, and a second speckle pattern captured on the preset plane at the second temperature; traversing each of the sample cameras, and determining the temperature coefficient of the current sample camera based on a preset temperature compensation model, the first speckle pattern, and the second speckle pattern corresponding to the current sample camera; determining a unified temperature coefficient based on a preset statistical algorithm and the temperature coefficients of each of the sample cameras, and calibrating the temperature coefficients of all the cameras in the current batch to the unified temperature coefficient.
[0006] An embodiment of the present application further provides a temperature coefficient calibration system, comprising: a screening module for selecting a plurality of sample cameras from a current batch of cameras, and determining a shooting temperature corresponding to each of the sample cameras based on an operating temperature range of the current batch of cameras, wherein the shooting temperature includes a first temperature and a second temperature not equal to the first temperature; an acquisition module for acquiring a first speckle pattern captured by each of the sample cameras on a preset plane at the first temperature, and a second speckle pattern captured on the preset plane at the second temperature; a sample calibration module for traversing each of the sample cameras and determining a temperature coefficient of the current sample camera based on a preset temperature compensation model and the first and second speckle patterns corresponding to the current sample camera; and a unified calibration module for determining a unified temperature coefficient based on a preset statistical algorithm and the temperature coefficients of each of the sample cameras, and calibrating the temperature coefficients of all cameras in the current batch to the unified temperature coefficient.
[0007] An embodiment of the present application also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned temperature coefficient calibration method.
[0008] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, which implements the above-mentioned temperature coefficient calibration method when executed by a processor.
[0009] The temperature coefficient calibration method, system, electronic device, and storage medium provided in the embodiments of the present application select several sample cameras from a current batch of cameras, and determine the shooting temperature corresponding to each sample camera based on the operating temperature range of the current batch of cameras. The shooting temperature corresponding to each sample camera includes a first temperature and a second temperature that is not equal to the first temperature. Subsequently, a first speckle pattern captured by each sample camera on a preset plane at the first temperature and a second speckle pattern captured on the preset plane at the second temperature are obtained. Then, each sample camera is traversed and the temperature coefficient of the current sample camera is determined based on a preset temperature compensation model, the first speckle pattern and the second speckle pattern corresponding to the current sample camera. Finally, a unified temperature coefficient is determined based on a preset statistical algorithm and the temperature coefficients of each sample camera, and the temperature coefficients of all cameras in the current batch are calibrated to the unified temperature coefficient. Considering the general requirements of the industry for factory-made structures, The temperature coefficient of structured light cameras is calibrated one by one, and the entire calibration process is very labor-intensive, time-consuming and labor-intensive. However, the embodiment of the present application selects several sample cameras from the current batch of cameras as the benchmark for temperature coefficient calibration. The cameras of the same model and the same batch that can be shipped out of the factory have very small differences in performance in all aspects. This small number of sample cameras can represent the quality of the entire batch of cameras. The server determines the corresponding shooting temperature for each camera and ensures that the corresponding shooting temperatures of all sample cameras completely cover the operating temperature range of the current batch of cameras, thereby determining the temperature coefficient of each sample camera one by one, and combining the preset statistical algorithm to calculate the most universal and most representative unified temperature coefficient of the current batch of cameras to calibrate all cameras in the batch, which greatly improves the efficiency and quality of the temperature coefficient calibration of structured light cameras before shipment and reduces the cost of temperature coefficient calibration of the entire production line.
[0010] In addition, there are M sample cameras, where M is an integer greater than 1, and determining the shooting temperature corresponding to each sample camera according to the operating temperature range of the current batch of cameras includes: determining the shooting temperature corresponding to each sample camera according to the lowest operating temperature, the highest operating temperature, the preset temperature interval, and the preset step size of the current batch of cameras; wherein the shooting temperature includes the first temperature and the second temperature that is not equal to the first temperature, the difference between the second temperature and the first temperature is equal to the preset temperature interval, and the first temperature of at least one sample camera among the M sample cameras is equal to the lowest operating temperature, and the second temperature of at least one sample camera among the M sample cameras is equal to the highest operating temperature. The operating temperature is the difference between the first temperature of the i-th sample camera and the first temperature of the i+1-th sample camera, which is equal to the preset step size. i is an integer greater than 0 and less than M. The structured light camera has a certain operating temperature range. It can only shoot normally when it is between the minimum operating temperature and the maximum operating temperature. The temperature coefficient of the camera calibration is also within this range to perform temperature compensation on the camera to eliminate line deviation. Therefore, during factory calibration, the server needs to simulate the camera working at different temperatures within the operating temperature range. In order to enhance the universality, representativeness and scientificity of subsequent temperature coefficient calibration, each sample camera only simulates two temperatures. The temperatures simulated by different temperature cameras are not all the same, thereby covering the entire operating temperature range.
[0011] In addition, the method of determining a unified temperature coefficient based on a preset statistical algorithm and the temperature coefficient of each of the sample cameras includes: determining a valid temperature coefficient and the total number of valid temperature coefficients in the temperature coefficient of each of the sample cameras according to a preset statistical algorithm; wherein the preset statistical algorithm is a random sampling consensus algorithm or an outlier detection algorithm based on cluster analysis; calculating an average value of each of the valid temperature coefficients according to the valid temperature coefficients and the total number of the valid temperature coefficients, and using the average value as the unified temperature coefficient. The random sampling consensus algorithm or the outlier detection algorithm based on cluster analysis can eliminate data that is too deviated from the overall temperature coefficient of each sample camera, thereby preventing these error data from participating in the calculation of the unified temperature coefficient. The unified temperature coefficient calculated in this way is more scientific and accurate, thereby further improving the quality of the temperature coefficient calibration of the camera before leaving the factory.
[0012] In addition, the temperature compensation model includes K unknown temperature coefficients, where K is an integer greater than 1. The temperature coefficient of the current sample camera is determined according to the preset temperature compensation model, the first speckle pattern corresponding to the current sample camera, and the second speckle pattern. The method includes: determining a plurality of seed points in the first speckle pattern corresponding to the current sample camera, and respectively determining a plurality of reference points with the same coordinates as the plurality of seed points in the second speckle pattern corresponding to the current sample camera; traversing the plurality of seed points, and calculating, according to the current seed point and a preset block matching algorithm, a matching similarity between the current seed point and each point within a preset two-dimensional search range centered on the reference point corresponding to the current seed point, and taking the point with the highest matching similarity as the same-name point of the current seed point; and determining, according to the coordinates of the current seed point and the current seed point, a plurality of reference points with the same coordinates as the seed points. The coordinates of the homonymous points, the first temperature corresponding to the first speckle pattern, the second temperature corresponding to the second speckle pattern and the temperature compensation model are used to establish an equation corresponding to the current seed point; wherein, the number of the equations is K; the equations are combined to obtain a system of equations, and the system of equations is solved to obtain K solved temperature coefficients. The infrared laser projector of the structured light camera is sensitive to temperature and has the characteristics of thermal expansion and contraction, which changes the internal structure of the structured light camera. Between the homonymous points in images of the same target taken by the same camera at different temperatures, not only column deviations but even row deviations may occur. Temperature compensation is to correct these row and column deviations. Therefore, when looking for homonymous points, it is necessary to search in both row and column directions. In this way, the matched homonymous points are more scientific and reasonable, and the subsequently solved temperature coefficients will also be more accurate.
[0013] In addition, the number of the equations is at least K+1, and the equations are combined to obtain a system of equations, and the system of equations is solved to obtain K solved temperature coefficients, including: combining the equations to obtain an overdetermined system of equations, performing least squares solution on the overdetermined system of equations to obtain K solved temperature coefficients, and the server must establish at least K+1 equations for the K temperature coefficients, that is, at least K+1 seed points are selected to ensure that the number of equations is greater than the number of unknown temperature coefficients, thereby constructing an overdetermined system of equations and obtaining a least squares solution, which can improve the accuracy of the determined temperature coefficients of each sample camera.
[0014] In addition, the method calculates the matching similarity between the current seed point and each point in a preset two-dimensional search range centered on the reference point corresponding to the current seed point based on the current seed point and the preset block matching algorithm, including: taking the current seed point as the center, obtaining a first image block according to a preset window size, and obtaining the grayscale value of each point in the first image block; taking each point in the preset two-dimensional search range centered on the reference point corresponding to the current seed point as a point to be matched, traversing each of the points to be matched, taking the current point to be matched as the center, obtaining a second image block according to the window size, and obtaining the grayscale value of each point in the second image block. Grayscale value of each point; according to the grayscale value of each point in the first image block and the grayscale value of each point in the second image block, calculate the sum of the absolute differences of the grayscale values between the first image block and the second image block, and use the sum of the absolute differences as the matching similarity between the current seed point and the current point to be matched. The sum of the absolute differences of the grayscale values can well measure the matching similarity between the two image blocks. This application uses a block matching algorithm and uses the sum of the absolute differences of the grayscale values as a measurement basis, which can more accurately determine the same-name points corresponding to the seed points, thereby further improving the accuracy of the entire temperature coefficient calibration process. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] One or more embodiments are exemplarily described by the figures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments.
[0016] Figure 1 is a flow chart of a temperature coefficient calibration method in one embodiment of the present application;
[0017] Figure 2 is a flow chart for determining a unified temperature coefficient based on a preset statistical algorithm and temperature coefficients of each sample camera in an embodiment of the present application;
[0018] Figure 3 is a schematic diagram showing the influence of temperature on a camera without temperature coefficient compensation provided in one embodiment of the present application;
[0019] Figure 4 is a schematic diagram showing the influence of temperature on a camera using original temperature coefficient compensation provided in one embodiment of the present application;
[0020] Figure 5 is a schematic diagram showing the influence of temperature on a camera using uniform temperature coefficient compensation provided in one embodiment of the present application;
[0021] Figure 6 This is a flow chart of determining a temperature coefficient of a current sample camera according to a preset temperature compensation model, a first speckle pattern and a second speckle pattern corresponding to the current sample camera in an embodiment of the present application;
[0022] Figure 7 This is a flowchart of an embodiment of the present application, which calculates the matching similarity between the current seed point and each point within a preset two-dimensional search range centered on a reference point corresponding to the current seed point based on the current seed point and a preset block matching algorithm;
[0023] Figure 8 is a schematic diagram of a temperature coefficient calibration system in another embodiment of the present application;
[0024] Figure 9 It is a structural diagram of an electronic device in another embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, each embodiment of the present application will be described in detail below with reference to the accompanying drawings. However, it will be understood by those skilled in the art that in each embodiment of the present application, many technical details are proposed to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can be implemented. The division of the following embodiments is for convenience of description and should not constitute any limitation on the specific implementation of the present application. The various embodiments can be combined and referenced with each other under the premise of no contradiction.
[0026] One embodiment of the present application relates to a temperature coefficient calibration method for an electronic device, wherein the electronic device may be a terminal or a server. In this embodiment and the following embodiments, the electronic device is described using a server as an example. The implementation details of the temperature coefficient calibration method of this embodiment are described below. The following content is provided for ease of understanding and is not required for implementation of this solution.
[0027] The specific process of the temperature coefficient calibration method of this embodiment can be as follows: Figure 1 Shown, including:
[0028] Step 101 : Select several sample cameras from the current batch of cameras, and determine the shooting temperature corresponding to each sample camera according to the operating temperature range of the current batch of cameras.
[0029] Specifically, when the server calibrates the temperature coefficients of the cameras in the current production batch, it can first randomly select several cameras in the current batch as sample cameras, and determine the shooting temperature corresponding to each sample camera based on the operating temperature range of the cameras in the current batch. The shooting temperature corresponding to each sample camera includes a first temperature and a second temperature that is not equal to the first temperature, that is, each sample camera selects two different temperatures as the shooting temperature within the operating temperature range of the cameras in the current batch.
[0030] In the specific implementation, the materials used for cameras in the same production batch are roughly the same, and the production environment and production conditions are also basically the same. That is, the cameras in the same production batch have certain similarities in quality. Such products support the use of statistical methods for production process quality control. In this application, the server calibrates the temperature coefficient of the camera based on statistical principles.
[0031] In specific implementations, due to limitations of factors such as materials, cameras have a certain operating temperature range. Cameras can only work normally when used within the operating temperature range. Therefore, when the server calibrates the temperature coefficient, it is necessary to simulate each sample camera operating within the operating temperature range.
[0032] In one example, there are M sample cameras, where M is an integer greater than 1, that is, the server randomly selects M cameras from the current batch of cameras as sample cameras. When determining the shooting temperatures corresponding to the M sample cameras, the server can determine the shooting temperatures corresponding to each of the M sample cameras according to the lowest operating temperature, highest operating temperature, preset temperature interval, and preset step size of the current batch of cameras. For the same sample camera, the shooting temperatures corresponding to the sample camera include a first temperature and a second temperature that is not equal to the first temperature. The difference between the second temperature and the first temperature is equal to the above-mentioned preset temperature interval. Usually, the second temperature is higher than the first temperature. For all sample cameras, the first temperature of at least one sample camera among the M sample cameras is equal to the lowest operating temperature of the current batch of cameras. Similarly, the second temperature of at least one sample camera among the M sample cameras is equal to the second temperature of the current batch. The maximum operating temperature of the camera. For two adjacent sample cameras, the difference between the first temperature of the i-th sample camera and the first temperature of the i+1-th sample camera is equal to the above-mentioned preset step size, where i is an integer greater than 0 and less than M. The preset temperature interval and the preset step size can be set by technicians in this field according to actual needs. Considering that the structured light camera has a certain operating temperature range, it can only shoot normally when it is between the minimum operating temperature and the maximum operating temperature. The temperature coefficient of the camera calibration also compensates the camera for temperature within this range to eliminate line deviation. Therefore, during factory calibration, the server needs to simulate the camera operating at different temperatures within the operating temperature range. In order to enhance the universality, representativeness, and scientificity of subsequent temperature coefficient calibration, each sample camera only simulates two temperatures. The simulated temperatures of different temperature cameras are not exactly the same, thereby covering the entire operating temperature range.
[0033] In an example, the operating temperature range of the current batch of cameras is -10°C to 60°C, the preset step size is 5°C, the preset temperature interval is 20°C, and the current batch of cameras has a total of 5,000 cameras. The server selects 110 sample cameras from the current batch of cameras. The server can divide these 110 sample cameras into 10 groups. The first sample camera in each group corresponds to a first temperature of -10°C and a second temperature of 10°C. The second sample camera in each group corresponds to a first temperature of -5°C and a second temperature of 15°C. And so on. The eleventh sample camera in each group corresponds to a first temperature of 40°C and a second temperature of 60°C, perfectly covering the entire operating temperature range.
[0034] Step 102 : obtaining a first speckle pattern captured by each sample camera on a preset plane at a first temperature, and a second speckle pattern captured by each sample camera on the preset plane at a second temperature.
[0035] Specifically, after determining the shooting temperature corresponding to each sample camera, the server can obtain a first speckle pattern captured by each sample camera on a preset plane at a first temperature, and a second speckle pattern captured on the same preset plane at a second temperature. The preset plane can be selected by those skilled in the art according to actual needs, and the embodiments of the present application do not specifically limit this.
[0036] In a specific implementation, after determining the shooting temperature corresponding to each sample camera, the server simulates the working states of these sample cameras at different temperatures. That is, the server first uses the sample camera to shoot a preset plane at a first temperature to obtain a first speckle pattern, and then uses the same sample camera to shoot the same preset plane at a second temperature to obtain a second speckle pattern.
[0037] Step 103 , traverse each sample camera and determine the temperature coefficient of the current sample camera according to a preset temperature compensation model, the first speckle pattern and the second speckle pattern corresponding to the current sample camera.
[0038] In the specific implementation, the server calibrates the temperature coefficient of the cameras in the current production batch based on statistical principles. For the selected sample cameras, they must first be calibrated one by one. The calibration in this step is not a real calibration. It is only necessary to determine the temperature coefficient that needs to be calibrated for each sample prototype. The server traverses each sample camera and determines the temperature coefficient of the current sample camera according to the preset temperature compensation model and the first and second speckle patterns corresponding to the current sample camera. The process of calibrating the temperature coefficient of the sample camera one by one is actually using the temperature compensation model to compensate the first speckle pattern into the second speckle pattern.
[0039] Step 104 : determining a uniform temperature coefficient based on a preset statistical algorithm and the temperature coefficients of the sample cameras, and calibrating the temperature coefficients of the current batch of cameras to the uniform temperature coefficient.
[0040] In the specific implementation, after the server calibrates the temperature coefficient of each sample camera "one by one", it can determine a unified temperature coefficient based on the preset statistical algorithm and the temperature coefficient of each sample camera. This unified temperature coefficient can represent the common trend of the temperature coefficient of all sample cameras, and naturally it can also represent the common trend of the temperature coefficient of the current batch of cameras. Based on this, the server directly calibrates the temperature coefficient of the current batch of cameras to a unified temperature coefficient.
[0041] In one example, the preset statistical algorithm is an average value algorithm. The server may calculate the average value of the temperature coefficients of the sample cameras and use the calculated average value as the unified temperature coefficient.
[0042] In another example, the preset statistical algorithm is a mode algorithm, and the server may calculate the mode of the temperature coefficients of the sample cameras and use the calculated mode as the unified temperature coefficient.
[0043] In this embodiment, several sample cameras are selected from a current batch of cameras, and a shooting temperature corresponding to each sample camera is determined based on the operating temperature range of the current batch of cameras. The shooting temperature corresponding to each sample camera includes a first temperature and a second temperature that is not equal to the first temperature. Subsequently, a first speckle pattern captured by each sample camera on a preset plane at the first temperature and a second speckle pattern captured on the preset plane at the second temperature are obtained. Then, each sample camera is traversed and a temperature coefficient of the current sample camera is determined based on a preset temperature compensation model, the first speckle pattern and the second speckle pattern corresponding to the current sample camera. Finally, a unified temperature coefficient is determined based on a preset statistical algorithm and the temperature coefficients of each sample camera, and the temperature coefficients of all cameras in the current batch are calibrated to the unified temperature coefficient. Considering that the industry generally performs temperature coefficient calibration on each factory-produced structured light camera, The entire calibration process is very labor-intensive, time-consuming, and labor-intensive. The embodiment of the present application selects several sample cameras from the current batch of cameras as the benchmark for temperature coefficient calibration. The cameras of the same model and the same batch that can be shipped out of the factory have very small differences in performance in all aspects. This small number of sample cameras can represent the quality of the entire batch of cameras. The server determines the corresponding shooting temperature for each camera and ensures that the corresponding shooting temperatures of all sample cameras completely cover the operating temperature range of the current batch of cameras, thereby determining the temperature coefficient of each sample camera one by one, and combining the preset statistical algorithm to calculate the most universal and most representative unified temperature coefficient of the current batch of cameras to calibrate all cameras in the batch, which greatly improves the efficiency and quality of the temperature coefficient calibration of structured light cameras before shipment, and reduces the cost of temperature coefficient calibration of the entire production line.
[0044] In one embodiment, the server determines the uniform temperature coefficient based on a preset statistical algorithm and the temperature coefficient of each sample camera, which can be done as follows: Figure 2The steps shown in the figure are as follows:
[0045] Step 201 : determining a valid temperature coefficient and the total number of valid temperature coefficients from the temperature coefficients of each sample camera according to a preset statistical algorithm.
[0046] In the specific implementation, the preset statistical algorithm is the Random Sample Consensus algorithm (RASAC) or the outlier detection algorithm based on cluster analysis. These two statistical algorithms can find abnormal data, that is, they can find data that deviates far from the normal range. Such data is noise data, which may be caused by problems during shooting or the sample camera is defective. Such temperature coefficients should not be included in the statistics. The server confirms that such abnormal data is an invalid temperature coefficient, while the data within the normal range is a valid temperature coefficient. The server can determine all valid temperature coefficients and the total number of valid temperature coefficients.
[0047] Step 202 : Calculate an average value of the effective temperature coefficients based on the effective temperature coefficients and the total number of effective temperature coefficients, and use the average value as a unified temperature coefficient.
[0048] In a specific implementation, the server only counts the valid temperature coefficients. The server calculates the average value of the valid temperature coefficients according to the valid temperature coefficients and the total number of valid temperature coefficients, and uses the average value as the unified temperature coefficient.
[0049] In an example, the temperature effect of a camera without temperature coefficient calibration, that is, without temperature coefficient compensation, is shown in Figure 3. Without temperature coefficient compensation, the camera is severely affected by temperature. The temperature effect of a camera with original temperature coefficient compensation is shown in Figure 4. The temperature effect of a camera with unified temperature coefficient compensation is shown in Figure 5. The effect of using unified temperature coefficient compensation is significantly better than using original temperature coefficient compensation.
[0050] In this embodiment, the use of a random sampling consensus algorithm or an outlier detection algorithm based on cluster analysis can eliminate data that deviates too much from the overall temperature coefficient of each sample camera, preventing these error data from participating in the calculation of the unified temperature coefficient. The unified temperature coefficient calculated in this way is more scientific and accurate, thereby further improving the quality of the temperature coefficient calibration of the camera when it leaves the factory.
[0051] In one embodiment, the temperature compensation model includes K unknown temperature coefficients, where K is an integer greater than 1. The server determines the temperature coefficient of the current sample camera according to the preset temperature compensation model and the first and second speckle patterns corresponding to the current sample camera. Figure 6 The steps shown in the figure are as follows:
[0052] Step 301 : determining a plurality of seed points in a first speckle image corresponding to a current sample camera, and determining a plurality of reference points having the same coordinates as the plurality of seed points in a second speckle image corresponding to the current sample camera.
[0053] Specifically, the structured light camera expands and contracts due to the influence of temperature. The most direct manifestation is that in the speckle patterns taken by the camera for the same target at different temperatures, the positions of the same-name points have large row and column deviations. The existence of temperature coefficient compensation is to eliminate these deviations. Therefore, when calibrating the temperature coefficient of the sample prototypes one by one, the first step is to find the same-name points in the first speckle pattern and the second speckle pattern corresponding to the same sample camera. The server first determines several seed points in the first speckle pattern corresponding to the current sample camera, and respectively determines several reference points with the same coordinates as the seed points in the second speckle pattern corresponding to the current sample camera.
[0054] In one example, in order to eliminate the influence of brightness on the matching of homonymous points, the server first needs to perform local contrast normalization (LCN) on the first speckle pattern and the second speckle pattern respectively, so as to enhance the contrast of the first speckle pattern and the contrast of the second speckle pattern. Taking the first speckle pattern as an example, the server sequentially takes each point in the first speckle pattern as a point to be normalized, calculates the average value and standard deviation of the grayscale value of each point in a preset two-dimensional normalization window centered on the point to be normalized, and finally obtains the normalized grayscale value of the point to be normalized based on the grayscale value of the point to be normalized and the average value and standard deviation of the grayscale value of each point in the preset two-dimensional normalization window centered on the point to be normalized, thereby obtaining the normalized first speckle pattern.
[0055] In one example, the server obtains the normalized grayscale value of the point to be normalized based on the grayscale value of the point to be normalized and the average and standard deviation of the grayscale values of each point within a preset two-dimensional normalization window centered on the point to be normalized. This can be achieved using the following formula:
[0056]
[0057] Where I is the grayscale value of the point to be normalized, μ is the average grayscale value of each point in the preset two-dimensional normalization window centered on the point to be normalized, δ is the standard deviation of the grayscale value of each point in the preset two-dimensional normalization window centered on the point to be normalized, K is a preset constant, and I LCN is the normalized grayscale value of the point to be normalized.
[0058] Step 302, traverse several seed points, and calculate the matching similarity between the current seed point and each point in a preset two-dimensional search range centered on the reference point corresponding to the current seed point based on the current seed point and the preset block matching algorithm, and take the point with the highest matching similarity as the same-name point of the current seed point.
[0059] Specifically, after determining the reference point, the server can traverse several seed points, and calculate the matching similarity between the current seed point and each point within the preset two-dimensional search range centered on the reference point corresponding to the current seed point based on the current seed point and the preset block matching algorithm. The point with the highest matching similarity is used as the homonymous point of the current seed point. Taking into account the existence of row deviation and column deviation caused by temperature, the server will search within the preset two-dimensional search range during the matching search, thereby improving the accuracy of the process of matching homonymous points.
[0060] In one example, the preset two-dimensional search range is [-D, D] in the x-direction and [-R, R] in the y-direction.
[0061] Step 303 : establishing an equation corresponding to the current seed point according to the coordinates of the current seed point, the coordinates of the point with the same name as the current seed point, the first temperature corresponding to the first speckle pattern, the second temperature corresponding to the second speckle pattern and the temperature compensation model.
[0062] Specifically, after finding the synonymous point of the current seed point, the server can establish an equation corresponding to the current seed point according to the coordinates of the current seed point, the coordinates of the synonymous point of the current seed point, the first temperature corresponding to the first speckle pattern, the second temperature corresponding to the second speckle pattern, and the temperature compensation model. The number of established equations is K, and K equations can ensure that the system of equations obtained by simultaneous solution can solve K temperature coefficients.
[0063] In one example, K is equal to 4, that is, the temperature compensation model includes an unknown first temperature coefficient, an unknown second temperature coefficient, an unknown third temperature coefficient, and an unknown fourth temperature coefficient. The server establishes an equation corresponding to the current seed point based on the coordinates of the current seed point, the coordinates of the point with the same name as the current seed point, the first temperature corresponding to the first speckle pattern, the second temperature corresponding to the second speckle pattern, and the temperature compensation model. It can be expressed by the following formula:
[0064] r2=(T1-T2)(r1-pt_y)*scaling y +pt_y
[0065] c2=(T1-T2)(c1-pt_x)*scaling x +pt_x
[0066] Among them, r1 is the horizontal coordinate of the current seed point, c1 is the vertical coordinate of the current seed point, r2 is the horizontal coordinate of the point with the same name as the current seed point, c2 is the vertical coordinate of the point with the same name as the current seed point, T1 is the first temperature corresponding to the first speckle pattern, T2 is the second temperature corresponding to the second speckle pattern, pt_x is the unknown first temperature coefficient, pt_y is the unknown second temperature coefficient, scaling x is the unknown third temperature coefficient, scaling y is the unknown fourth temperature coefficient.
[0067] Step 304 , combining the equations to obtain a system of equations, and solving the system of equations to obtain K solved temperature coefficients.
[0068] Specifically, after establishing the K equations, the server can combine the K equations to obtain an equation group, and solve the equation group to obtain the solved K temperature coefficients.
[0069] In one example, the number of equations established by the server is at least K+1. The server can obtain an overdetermined system of equations by combining these K+1 equations. The overdetermined system of equations is solved by least squares to obtain K solved temperature coefficients. The server must establish at least K+1 equations for the K temperature coefficients, that is, at least K+1 seed points are selected to ensure that the number of equations is greater than the number of unknown temperature coefficients, thereby constructing an overdetermined system of equations and finding a least squares solution, which can improve the accuracy of the determined temperature coefficients of each sample camera.
[0070] In this embodiment, considering that the infrared laser projector of the structured light camera is sensitive to temperature and has the characteristics of thermal expansion and contraction, the internal structure of the structured light camera changes. Between the same-name points in images of the same target taken by the same camera at different temperatures, not only column deviations but also row deviations may occur. Temperature compensation is to correct these row and column deviations. Therefore, when looking for same-name points, it is necessary to search in both row and column directions. In this way, the matched same-name points are more scientific and reasonable, and the temperature coefficient solved subsequently will also be more accurate.
[0071] In one embodiment, the server calculates the matching similarity between the current seed point and each point in the preset two-dimensional search range centered on the reference point corresponding to the current seed point based on the current seed point and the preset block matching algorithm, which can be achieved by Figure 7 The steps shown in the figure are as follows:
[0072] Step 401 : Taking the current seed point as the center, a first image block is obtained according to a preset window size, and the grayscale value of each point in the first image block is obtained.
[0073] Specifically, this application uses a block matching algorithm to match points of the same name. During the matching process, the server first obtains the first image block based on the preset window size with the current seed point as the center, and obtains the grayscale value of each point in the first image block. The preset window size is also two-dimensional and can be expressed as: (2n+1)*(2m+1).
[0074] In step 402, each point within a preset two-dimensional search range centered on the reference point corresponding to the current seed point is used as a point to be matched, each point to be matched is traversed, and a second image block is obtained according to the window size with the current point to be matched as the center, and the grayscale value of each point in the second image block is obtained.
[0075] Specifically, after the server obtains the grayscale value of each point in the first image block, it can use each point in a preset two-dimensional search range centered on the reference point corresponding to the current seed point as a point to be matched, traverse each point to be matched, and obtain the second image block according to the window size with the current point to be matched as the center, and obtain the grayscale value of each point in the second image block, wherein the sizes of the first image block and the second image block are equal.
[0076] Step 403 , based on the grayscale value of each point in the first image block and the grayscale value of each point in the second image block, calculate the sum of the absolute differences of the grayscale values between the first image block and the second image block, and use the sum of the absolute differences as the matching similarity between the current seed point and the current point to be matched.
[0077] In the specific implementation, considering that the sum of the absolute differences in grayscale values can well measure the matching similarity between two image blocks, the server selects a block matching algorithm to calculate the sum of the absolute differences in the grayscale values between the first image block and the second image block based on the grayscale values of each point in the first image block and the grayscale values of each point in the second image block. The sum of the absolute differences is used as the matching similarity between the current seed point and the current point to be matched. That is, using the sum of the absolute differences in grayscale values as a measurement basis can more accurately determine the points of the same name corresponding to the seed point, thereby further improving the accuracy of the entire temperature coefficient calibration process.
[0078] In one example, the server calculates the sum of absolute differences in grayscale values between the first image block and the second image block based on the grayscale value of each point in the first image block and the grayscale value of each point in the second image block, which can be achieved by the following formula:
[0079]
[0080] Where I1(x+i,y+j) is used to represent the grayscale value of each point in the first image block, I2(x+i+d,y+j+r) is used to represent the grayscale value of each point in the second image block, SAD(x,y,d,r) is the sum of the absolute differences in the grayscale values between the first image block and the second image block, d is used to represent the column deviation, and r is used to represent the row deviation.
[0081] In an example, after the server determines the same-name point (r2, c2) of the seed point (r1, c1), it can perform sub-pixel interpolation on r2 and c2 respectively to obtain the same-name point (r2 * , c2 * ).
[0082] The steps of the various methods above are divided only for the purpose of clear description. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0083] Another embodiment of the present application relates to a temperature coefficient calibration system. The implementation details of the temperature coefficient calibration system of this embodiment are specifically described below. The following content is only for the convenience of understanding the implementation details and is not necessary for the implementation of this solution. The schematic diagram of the temperature coefficient calibration system of this embodiment can be as follows: Figure 8 Shown, including:
[0084] The screening module 501 is used to select several sample cameras from the current batch of cameras and determine a shooting temperature corresponding to each sample camera according to the operating temperature range of the current batch of cameras. The shooting temperature corresponding to each sample camera includes a first temperature and a second temperature that is not equal to the first temperature.
[0085] The acquisition module 502 is configured to acquire a first speckle pattern captured by each sample camera on a preset plane at a first temperature, and a second speckle pattern captured by each sample camera on the preset plane at a second temperature.
[0086] The sample calibration module 503 is configured to traverse each sample camera and determine the temperature coefficient of the current sample camera according to a preset temperature compensation model, the first speckle pattern and the second speckle pattern corresponding to the current sample camera.
[0087] The unified calibration module 504 determines a unified temperature coefficient according to a preset statistical algorithm and the temperature coefficients of each sample camera, and calibrates the temperature coefficients of the current batch of cameras to the unified temperature coefficient.
[0088] It is worth mentioning that all modules involved in this embodiment are logical modules. In actual applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, to highlight the innovation of this application, this embodiment does not include units that are not closely related to solving the technical problem proposed by this application. However, this does not mean that other units do not exist in this embodiment.
[0089] Another embodiment of the present application relates to an electronic device, such as Figure 9 As shown, it includes: at least one processor 601; and a memory 602 that is communicatively connected to the at least one processor 601; wherein the memory 602 stores instructions that can be executed by the at least one processor 601, and the instructions are executed by the at least one processor 601 to enable the at least one processor 601 to execute the temperature coefficient calibration method in the above-mentioned embodiments.
[0090] The memory and processor are connected using a bus, which can include any number of interconnected buses and bridges. The bus connects various circuits of one or more processors and memories. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. These are all well known in the art and are therefore not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over a wireless medium via an antenna. Furthermore, the antenna receives data and transmits it to the processor.
[0091] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.
[0092] Another embodiment of the present application relates to a computer-readable storage medium storing a computer program, which implements the above method embodiment when executed by a processor.
[0093] That is, those skilled in the art will understand that all or part of the steps in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a program, which is stored in a storage medium and includes a number of instructions for causing a device (which may be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program code.
[0094] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and that in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
Claims
1. A temperature coefficient calibration method, characterized in that: include: Selecting a plurality of sample cameras from a current batch of cameras, and determining a shooting temperature corresponding to each of the sample cameras according to an operating temperature range of the current batch of cameras; wherein the shooting temperature includes a first temperature and a second temperature that is not equal to the first temperature; Acquire a first speckle pattern captured by each of the sample cameras on a preset plane at the first temperature, and a second speckle pattern captured by each of the sample cameras on the preset plane at the second temperature; Traversing each of the sample cameras, compensating the first speckle pattern corresponding to the sample camera to the second speckle pattern corresponding to the sample camera according to a preset temperature compensation model, so as to calibrate the temperature coefficient of the current sample camera; Determine a unified temperature coefficient according to a preset statistical algorithm and the temperature coefficient of each of the sample cameras, and calibrate the temperature coefficients of the current batch of cameras to the unified temperature coefficient; The number of sample cameras is M, where M is an integer greater than 1, and determining the shooting temperature corresponding to each sample camera according to the operating temperature range of the current batch of cameras includes: Determine a shooting temperature corresponding to each of the sample cameras based on the lowest operating temperature, the highest operating temperature, the preset temperature interval, and the preset step size of the current batch of cameras; wherein the shooting temperature includes the first temperature and a second temperature that is not equal to the first temperature, the difference between the second temperature and the first temperature is equal to the preset temperature interval, the first temperature of at least one sample camera among the M sample cameras is equal to the lowest operating temperature, the second temperature of at least one sample camera among the M sample cameras is equal to the highest operating temperature, the difference between the first temperature of the i-th sample camera and the first temperature of the (i+1)-th sample camera is equal to the preset step size, and i is an integer greater than 0 and less than M.
2. The temperature coefficient calibration method according to claim 1, characterized in that: The determining of a unified temperature coefficient based on a preset statistical algorithm and the temperature coefficient of each of the sample cameras includes: Determining a valid temperature coefficient and a total number of valid temperature coefficients from the temperature coefficients of each of the sample cameras according to a preset statistical algorithm; wherein the preset statistical algorithm is a random sampling consensus algorithm or an outlier detection algorithm based on cluster analysis; An average value of the effective temperature coefficients is calculated according to the effective temperature coefficients and the total number of the effective temperature coefficients, and the average value is used as the unified temperature coefficient.
3. The temperature coefficient calibration method according to claim 1, characterized in that: The temperature compensation model includes K unknown temperature coefficients, where K is an integer greater than 1. The determining the temperature coefficient of the current sample camera according to the preset temperature compensation model and the first speckle pattern and the second speckle pattern corresponding to the current sample camera includes: Determining a plurality of seed points in the first speckle map corresponding to the current sample camera, and respectively determining a plurality of reference points having the same coordinates as the plurality of seed points in the second speckle map corresponding to the current sample camera; Traversing the plurality of seed points, calculating, based on the current seed point and a preset block matching algorithm, the matching similarity between the current seed point and each point within a preset two-dimensional search range centered on the reference point corresponding to the current seed point, and selecting the point with the highest matching similarity as the same-name point of the current seed point; Establishing an equation corresponding to the current seed point according to the coordinates of the current seed point, the coordinates of the point with the same name as the current seed point, a first temperature corresponding to the first speckle pattern, a second temperature corresponding to the second speckle pattern, and the temperature compensation model; wherein the number of the equations is K; The equations are combined to obtain a system of equations, and the system of equations is solved to obtain K solved temperature coefficients.
4. The temperature coefficient calibration method according to claim 3, characterized in that: K is equal to 4, that is, the temperature compensation model includes an unknown first temperature coefficient, an unknown second temperature coefficient, an unknown third temperature coefficient, and an unknown fourth temperature coefficient. The equation corresponding to the current seed point is established according to the coordinates of the current seed point, the coordinates of the point with the same name as the current seed point, the first temperature corresponding to the first speckle pattern, the second temperature corresponding to the second speckle pattern, and the temperature compensation model, and is expressed by the following formula: Where r1 is the horizontal coordinate of the current seed point, c1 is the vertical coordinate of the current seed point, r2 is the horizontal coordinate of the point with the same name as the current seed point, c2 is the vertical coordinate of the point with the same name as the current seed point, T1 is the first temperature corresponding to the first speckle pattern, T2 is the second temperature corresponding to the second speckle pattern, pt_x is the unknown first temperature coefficient, pt_y is the unknown second temperature coefficient, scaling x is the unknown third temperature coefficient, scaling y is the unknown fourth temperature coefficient.
5. The temperature coefficient calibration method according to claim 3, characterized in that: The number of the equations is at least K+1, the equations are combined to obtain a system of equations, and the system of equations is solved to obtain K temperature coefficients, including: An overdetermined system of equations is obtained by combining the above equations, and the overdetermined system of equations is solved by least squares to obtain K solved temperature coefficients.
6. The temperature coefficient calibration method according to claim 3, characterized in that: The calculating, based on the current seed point and a preset block matching algorithm, the matching similarity between the current seed point and each point within a preset two-dimensional search range centered on a reference point corresponding to the current seed point includes: Taking the current seed point as the center, obtaining a first image block according to a preset window size, and obtaining the grayscale value of each point in the first image block; Taking each point within a preset two-dimensional search range centered on the reference point corresponding to the current seed point as a to-be-matched point, traversing each of the to-be-matched points, obtaining a second image block based on the window size with the current to-be-matched point as the center, and obtaining the grayscale value of each point in the second image block; According to the grayscale value of each point in the first image block and the grayscale value of each point in the second image block, the sum of the absolute differences of the grayscale values between the first image block and the second image block is calculated, and the sum of the absolute differences is used as the matching similarity between the current seed point and the current point to be matched.
7. A temperature coefficient calibration system, characterized in that: include: a screening module, configured to select a plurality of sample cameras from a current batch of cameras, and determine a shooting temperature corresponding to each of the sample cameras based on an operating temperature range of the current batch of cameras, wherein the shooting temperature includes a first temperature and a second temperature that is not equal to the first temperature; The number of sample cameras is M, where M is an integer greater than 1, and determining the shooting temperature corresponding to each sample camera according to the operating temperature range of the current batch of cameras includes: Determining a shooting temperature corresponding to each of the sample cameras based on the lowest operating temperature, the highest operating temperature, the preset temperature interval, and the preset step size of the current batch of cameras; wherein the shooting temperatures include the first temperature and a second temperature that is not equal to the first temperature, the difference between the second temperature and the first temperature is equal to the preset temperature interval, the first temperature of at least one sample camera among the M sample cameras is equal to the lowest operating temperature, the second temperature of at least one sample camera among the M sample cameras is equal to the highest operating temperature, and the difference between the first temperature of the i-th sample camera and the first temperature of the i+1-th sample camera is equal to the preset step size, where i is an integer greater than 0 and less than M; an acquisition module, configured to acquire a first speckle pattern captured by each of the sample cameras on a preset plane at the first temperature, and a second speckle pattern captured by each of the sample cameras on the preset plane at the second temperature; a sample calibration module, configured to traverse each of the sample cameras and compensate the first speckle pattern corresponding to the sample camera to the second speckle pattern corresponding to the sample camera according to a preset temperature compensation model, so as to calibrate the temperature coefficient of the current sample camera; The unified calibration module determines a unified temperature coefficient according to a preset statistical algorithm and the temperature coefficient of each of the sample cameras, and calibrates the temperature coefficients of the current batch of cameras to the unified temperature coefficient.
8. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the temperature coefficient calibration method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the temperature coefficient calibration method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Temperature compensation method and device for depth camera
CN111353963A
Depth recovery method, electronic equipment and computer readable storage medium
CN114299129A