A camera calibration method using distance difference
By calculating the resolution and number of pixels of the object under test at different distances, and using the formula to establish the ratio of the distance between the lens and the sensor, the measurement error problem of the camera when the distance changes is solved, and efficient resolution calibration without additional hardware is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-18
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies do not maintain pixel resolution when the distance between the object being measured and the camera changes, leading to measurement errors. Furthermore, using a laser rangefinder requires additional hardware costs.
By calculating the resolution and number of pixels of the object under test at different distances, the ratio of the distance between the lens and the sensor is established using a formula, and the current resolution is calculated to eliminate measurement errors.
Without using a laser rangefinder, the current camera resolution is calculated through algorithmic calculations, eliminating measurement errors caused by distance variations.
Smart Images

Figure CN115661268B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of object imaging, and particularly relates to a camera calibration method using distance difference. BACKGROUND
[0002] Due to the principle of camera imaging, the distance between the measured object and the camera changes, and the physical distance represented by a single pixel in the image also changes (note: the physical distance represented by a single pixel is the resolution of a single pixel). The existing technology uses a constant pixel resolution when the distance between the measured object and the camera changes, thereby causing measurement errors. Although a laser range finder can solve this problem, it requires additional hardware costs. SUMMARY
[0003] Therefore, the present application aims to provide a camera calibration method using distance difference to solve the problem of measurement errors caused by the constant pixel resolution when the distance between the measured object and the camera changes in the prior art.
[0004] To achieve the above-mentioned purpose, the technical scheme of the present application is as follows:
[0005] A camera calibration method using distance difference, comprising the following steps:
[0006] S1, performing first image acquisition calculation at a position where the distance between the measured object and the lens is D1, to obtain resolution R1 and pixel number P1;
[0007] S2, performing second image acquisition calculation at a position where the distance between the measured object and the lens is D2, to obtain resolution R2 and pixel number P2;
[0008] S3, obtaining the relationship between the resolution and the measured object width, the imaging width of the measured object on the sensor, and the physical width of a single pixel element through a formula;
[0009] S4, obtaining the ratio between the two resolutions through a formula, which is equal to the ratio between the imaging widths of the measured object on the sensor at two times;
[0010] S5, proving through a formula that the ratio between the measured object width and the distance between the lens and the measured object is equal to the ratio between the imaging width of the measured object on the sensor and the distance between the lens and the sensor;
[0011] S6, obtaining the relationship between the imaging width of the measured object on the sensor and the measured object width, the distance between the lens and the measured object, and the distance between the lens and the sensor through the formula conversion of step S5;
[0012] S7. Substituting the formula in step S6 into the formula in step S4, we can obtain the ratio between the two calibrated resolutions, which is equal to the ratio of the distance between the lens and the sensor during the two calibrations.
[0013] S8. Through the transformation of the formula in step S7, the relationship between the resolution during the second calibration and the resolution during the first calibration, the distance between the lens and the sensor during the first calibration, and the distance between the lens and the sensor during the second calibration is obtained.
[0014] S9. The distance between the lens and the sensor is unknown during the two calibrations, but the difference in distance between the lens and the sensor during the two calibrations, D3, is known.
[0015] S10. Substituting D3 into the formula in step S8, we can obtain the relationship between the resolution during the two calibrations, the distance D2 during the second calibration, and the difference D3 between the lens and sensor distances during the two calibrations.
[0016] S11. By transforming the formula in step S10, we obtain the difference between the lens and sensor distances during the first calibration, D1 and D2. We then use the expressions for the three parameters—the resolution during the first calibration, the resolution during the second calibration, and the difference between the lens and sensor distances during the two calibrations, D3—to calculate D1 and D2.
[0017] S12. During use, if the distance difference between the current measurement position and the distance D1 between the lens and sensor during the first calibration is known to be D5, then the current resolution R3 can be obtained, and the resolution R1 during the first calibration, the resolution R2 during the second calibration, the difference D3 between the distances between the lens and sensor during the two calibrations, and the distance difference D5 between the current measurement position and the distance D1 between the lens and sensor during the first calibration can be calculated.
[0018] Furthermore, the relationship between the resolution and the width of the object being measured, the imaging width of the object on the sensor, and the physical width of a single pixel in step S3 is as follows:
[0019]
[0020] W1 is the actual material width of the object being measured, S1 is the physical width of the object imaged on the camera sensor during the first image acquisition and calculation, S2 is the physical width of the object imaged on the camera sensor during the second image acquisition and calculation, and A is the physical width of a single pixel.
[0021] Furthermore, in step S6, the relationship between the imaging width of the object being measured on the sensor and the width of the object being measured, the distance between the lens and the object being measured, and the distance between the lens and the sensor is as follows:
[0022]
[0023] C1 is the distance between the lens and the sensor.
[0024] Furthermore, the relationship between the distance between the lens and the sensor during the first calibration and the distance between the lens and the sensor during the second calibration in step S8 is as follows:
[0025] Furthermore, the relationship between the resolution during the two calibrations, the distance D2 during the second calibration, and the difference D3 between the lens and sensor distances during the two calibrations in step S10 is as follows:
[0026] R2×D2+R2×D3=D2×R1, R2×D3=(R1-R2)×D2.
[0027] Furthermore, in step S11,
[0028] Furthermore, in step 12, the resolution of the object being measured...
[0029] Compared with the prior art, the camera calibration method using distance difference described in this invention has the following advantages: given the resolution of two camera calibrations and the difference in object distance between the two calibrations, the current camera resolution can be calculated through algorithmic calculation without using a laser rangefinder, thereby eliminating measurement errors caused by changes in the distance between the object being measured and the camera. Attached Figure Description
[0030] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0031] Figure 1 This is a schematic diagram illustrating the first image acquisition calculation calibration of a camera calibration method using distance difference as described in an embodiment of the present invention;
[0032] Figure 2 This is a schematic diagram illustrating the second image acquisition calculation calibration using a camera calibration method employing distance difference, as described in an embodiment of the present invention.
[0033] Figure 3 This is a schematic diagram illustrating the position of two calibration differences in a camera calibration method using distance difference as described in an embodiment of the present invention.
[0034] Figure 4 This is a calibration diagram illustrating the use of a camera calibration method based on distance difference, as described in an embodiment of the present invention.
[0035] Explanation of reference numerals in the attached figures:
[0036] 1-Object being measured; 2-Lens; 3-Sensor. Detailed Implementation
[0037] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0038] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0039] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0040] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0041] like Figures 1-4 As shown, a camera calibration method using distance difference includes the following steps:
[0042] S1. Perform the first image acquisition and calculation at a distance D1 between the object being measured 1 and the lens 2 to obtain the resolution R1 and the number of pixels P1.
[0043] Step 1: The actual physical width of the object being measured is W1 and its value is known; the distance between the object being measured 1 and the lens 2 is D1 and its value is unknown; the physical width of the image of the object being measured on the camera sensor 3 is S1 and its value is known; the physical width of a single pixel is A and its value is known; the number of pixels of the object being measured in the camera image is:
[0044] The average pixel resolution of the object being measured is:
[0045] S2. Perform a second image acquisition and calculation at a distance D2 between the object being measured 1 and the lens 2 to obtain the resolution R2 and the number of pixels P2.
[0046] Step 2: The actual physical width of the object being measured is W1 and its value is known; the distance between the object being measured 1 and lens 2 is D2 and its value is unknown; the physical width of the image of the object being measured on camera sensor 3 is S2 and its value is known; the physical width of a single pixel is A and its value is known; the number of pixels of the object being measured in the camera image is:
[0047] The average pixel resolution of the object being measured is:
[0048] S3. The relationship between resolution and the width of the measured object 1, the imaging width of the measured object 1 on the sensor 3, and the physical width of a single pixel is obtained through the formula.
[0049] because Substituting into the pixel resolution calculation formula, we get:
[0050]
[0051] W1 is the actual width of the measured object, S1 is the physical width of the measured object image on camera sensor 3 during the first image acquisition calculation, S2 is the physical width of the measured object image on camera sensor 3 during the second image acquisition calculation, and A is the physical width of a single pixel.
[0052] S4. The ratio between the two resolutions is obtained by formula, which is equal to the ratio of the imaging width of the measured object 1 on the sensor 3 in the two resolutions.
[0053] The ratio of the pixel resolution R1 during calibration to the pixel resolution R2 after the distance between the object and lens 2 changes is:
[0054]
[0055] S5. Prove by formula that the ratio between the width of the measured object 1 and the distance between the lens 2 and the measured object 1 is equal to the ratio between the imaging width of the measured object 1 on the sensor 3 and the distance between the lens 2 and the sensor 3.
[0056] According to trigonometric functions, we can obtain:
[0057]
[0058] S6. By converting the formula in step S5, the relationship between the imaging width of the object being measured 1 on the sensor 3 and the width of the object being measured 1, the distance between the lens 2 and the object being measured 1, and the distance between the lens 2 and the sensor 3 is obtained.
[0059] In step S6, the relationship between the imaging width of the object 1 on the sensor 3 and the width of the object 1, the distance between the lens 2 and the object 1, and the distance between the lens 2 and the sensor 3 is as follows:
[0060]
[0061] C1 is the distance between lens 2 and sensor 3.
[0062] S7. Substituting the formula in step S6 into the formula in step S4, we can obtain the ratio between the two calibrated resolutions, which is equal to the ratio of the distance between lens 2 and sensor 3 during the two calibrations.
[0063]
[0064] S8. Through the transformation of the formula in step S7, the relationship between the resolution during the second calibration and the resolution during the first calibration, the distance between lens 2 and sensor 3 during the first calibration, and the distance between lens 2 and sensor 3 during the second calibration is obtained.
[0065] The relationship between the distance between lens 2 and sensor 3 during the first calibration and the distance between lens 2 and sensor 3 during the second calibration in step S8 is as follows:
[0066] S9. The distance between lens 2 and sensor 3 is unknown during the two calibrations, but the difference in distance between lens 2 and sensor 3 during the two calibrations is known to be D3 = D1 - D2.
[0067] When winding material, if the material thickness and the number of winding layers are known, the distance difference between two calibrations can be obtained; if two materials are placed on the same plane, and the material heights of the two calibrations are known, the distance difference can be obtained by subtracting the material heights of the two calibrations, etc.
[0068] S10. Substituting D3 into the formula in step S8, we can obtain the relationship between the resolution during the two calibrations, the distance D2 during the second calibration, and the difference D3 between the distances between lens 2 and sensor 3 during the two calibrations.
[0069] The relationship between the resolution during the two calibrations, the distance D2 during the second calibration, and the difference D3 between the distances D2 and D3 between the lens 2 and sensor 3 during the two calibrations in step S10 is as follows:
[0070] R2×D2+R2×D3=D2×R1, R2×D3=(R1-R2)×D2.
[0071] S11. By transforming the formula in step S10, we obtain the distance difference D1 between lens 2 and sensor 3 during the first calibration and the distance difference D2 between lens 2 and sensor 3 during the first calibration. We then obtain D1 and D2 by using the expressions for the three parameters: the resolution during the first calibration, the resolution during the second calibration, and the distance difference D3 between lens 2 and sensor 3 during the two calibrations.
[0072] In step S11,
[0073] S12. During use, if it is known that the distance difference between the current measurement position and the distance D1 between the lens 2 and sensor 3 during the first calibration is D5, then the current resolution R3 can be obtained, and the resolution R1 during the first calibration, the resolution R2 during the second calibration, the difference D3 between the distances between the lens 2 and sensor 3 during the two calibrations, and the distance difference D5 between the current measurement position and the distance D1 between the lens 2 and sensor 3 during the first calibration can be calculated.
[0074] The resolution of the current object being measured in step 12
[0075] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A camera calibration method using distance difference, characterized in that: The method comprises the following steps: S1, the first sampling calculation is carried out at the position where the distance between the measured object and the lens is , the resolution and the pixel number are obtained. S2, the second time of image acquisition is calculated when the distance between the measured object and the lens is , and the resolution and the number of pixels are obtained. S3, obtaining the relationship between the resolution, the measured object width, the measured object imaging width on the sensor and the single pixel physical width by a formula; S4, obtaining the ratio between the two resolutions by a formula, which is equal to the ratio between the two measured object imaging widths on the sensor; S5, proving by a formula that the ratio between the measured object width and the lens distance from the measured object is equal to the ratio between the measured object imaging width on the sensor and the lens distance from the sensor; S6, obtaining the relationship between the measured object imaging width on the sensor, the measured object width, the lens distance from the measured object and the lens distance from the sensor by the formula conversion of step S5; S7, substituting the formula of step S6 into the formula of step S4, so that the ratio between the two calibration resolutions is equal to the ratio between the lens distances from the sensor in the two calibration times; S8, obtaining the relationship between the resolution in the second calibration time, the resolution in the first calibration time, the lens distance from the sensor in the first calibration time and the lens distance from the sensor in the second calibration time by the formula conversion of step S7; S9, the distance between the lens and the sensor is unknown in two calibrations, but the difference between the distance between the lens and the sensor in two calibrations is known ; S10, will Substituting into the formula in step S8, we can obtain the resolution during the two calibrations and the distance during the second calibration. The difference in distance between the lens and the sensor during the two calibrations The relationship between them; S11, formula conversion of step S10, to obtain the difference between the lens and sensor distance in the first calibration the difference between the lens and sensor distance in the first calibration , through the resolution in the first calibration, the resolution in the second calibration, the difference between the lens and sensor distance in the two calibrations the expression of the three parameters, to obtain and ; S12, in use, if the distance difference between the current measurement position and the lens-sensor distance of the first calibration is known when measuring , the current resolution can be obtained , the resolution of the first calibration is obtained , the resolution of the second calibration is obtained , the distance difference between the lens-sensor distance of the two calibrations , the distance difference between the current measurement position and the lens-sensor distance of the first calibration . 2. The camera calibration method using distance difference according to claim 1, wherein: The relationship between the resolution, the measured object width, the measured object imaging width on the sensor and the single pixel physical width in step S3 is: , ; the actual material width of the object under test, the physical width of the object under test imaged on the camera sensor for the first image capture calculation, the physical width of the object under test imaged on the camera sensor for the second image capture calculation, A being the physical width of a single pixel.
3. The camera calibration method using distance difference according to claim 2, wherein: The relationship between the measured object imaging width on the sensor, the measured object width, the lens distance from the measured object and the lens distance from the sensor in step S6 is is the distance between the lens and the sensor.
4. The camera calibration method using distance difference according to claim 3, wherein: The relationship between the lens-to-sensor distance at the first time of calibration in step S8 and the lens-to-sensor distance at the second time of calibration is: .
5. The camera calibration method using distance difference according to claim 4, wherein: The relationship between the resolution of the two calibrations, the distance at the second calibration The difference between the lens and sensor distance at the two calibrations is , 。 6. The camera calibration method using distance difference according to claim 5, wherein: In step S11, .
7. The camera calibration method using distance difference according to claim 6, wherein: Resolution of the currently measured object in step 12 .
Citation Information
Patent Citations
Camera distance attitude calculation method based on laser pattern assistance and server
CN110619664A
Method and device for correcting image distortion of wide-angle lens and photographic equipment
CN113962892A