Linear camera calibration method
By using the line array camera calibration method in image detection, dividing multiple areas and calculating the corresponding resolution, the problem of resolution changes and measurement errors caused by changes in the location of the detection area is solved, and more accurate measurement results are achieved.
Patent Information
- Application Number
- CN202111020128.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-01
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-01
AI Technical Summary
In the existing technology, when the position of the detection area in the image changes significantly, the resolution will change. If the measurement resolution remains unchanged, errors will occur in the measurement results.
Using the line array camera calibration method, the resolution is calculated by measuring the number of pixels and the actual width of the marking block on the calibration plate, and the measured area is divided into multiple areas, and the calculation is based on the pixel length and resolution of each area. Figure out the physical width to ensure the accuracy of the measurement results.
By automatically calculating the resolution of each area, resolution changes caused by changes in the location of the detection area are avoided, the accuracy of the measurement results is improved, and the error problem is alleviated.
Smart Images

Figure CN113689506B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image detection, and in particular to a linear array camera calibration method. Background Art
[0002] Due to the distortion error of the lens, the actual physical distance corresponding to each pixel in the image is different, so the image needs to be calibrated.
[0003] The existing technology is a regional calibration method, where each detection area corresponds to an average resolution, so that the actual target object can be measured by the number of pixels.
[0004] However, when the position of the detection area in the image changes significantly, the corresponding resolution will change. If the resolution used for measurement remains unchanged, errors will occur in the measurement results. Summary of the invention
[0005] The purpose of the present invention is to provide a linear array camera calibration method to alleviate the technical problem in the prior art that when the position of the detection area in the image changes significantly, the corresponding resolution will change. If the resolution used for measurement remains unchanged, the measurement result will have errors.
[0006] In a first aspect, the present invention provides a linear array camera calibration method, comprising the following steps:
[0007] Calibration steps: The camera measures the number of pixels of any marking block on the calibration plate, and the camera measures the actual width of any marking block on the calibration plate, and the resolution is calculated;
[0008] Positioning step: determine the area of the calibration plate where the target is located;
[0009] Area division step: dividing the measured area into a first area, a second area and a third area, wherein the first area is set to be a position from the left end point of the measured object to the leftmost dividing line covered by the measured object;
[0010] The second area is set to be from the leftmost calibration block dividing line position covered by the measured object to the rightmost calibration plate dividing line position covered by the measured object;
[0011] The third area is set to be from the rightmost calibration plate dividing line position covered by the measured object to the right end point of the measured area.
[0012] Calculation steps: Calculate the total physical width of the target to be measured according to the first area, the second area and the third area.
[0013] In an alternative embodiment,
[0014] The calibration step also includes the following steps:
[0015] Steps for recording the edge of the calibration plate: Use a camera to photograph the black and white calibration plate, and record the position of each intersection of the black and white stripes.
[0016] In an alternative embodiment,
[0017] The step of recording the edge of the calibration plate also includes the following steps:
[0018] Use binary segmentation to segment the calibration plate image and obtain the locations of black and white areas;
[0019] Use projection to get the average gray value of each column of the image. Convert the average gray value of each column into a discrete function;
[0020] In an alternative embodiment,
[0021] The recording and marking plate edge also includes the following steps:
[0022] Use sub-pixel edge detection to extract the exact position of the boundary edge between black and white areas and record it.
[0023] In an alternative embodiment,
[0024] The calculation step also includes the following steps:
[0025] The physical width of the second area is calculated by calculating the number of covered calibration blocks and the width of each calibration block.
[0026] In an alternative embodiment,
[0027] The calculation step also includes the following steps:
[0028] The physical width of the first region is calculated according to the pixel length of the first region and the resolution of the region where the first region is located.
[0029] In an alternative embodiment,
[0030] The calculation step also includes the following steps:
[0031] The physical width of the third area is calculated according to the pixel length of the third area and the resolution of the area where the third area is located.
[0032] In an alternative embodiment,
[0033] The calculation step also includes the following steps:
[0034] The total physical width of the measured object is calculated by adding the physical width of the first area, the physical width of the second area, and the physical width of the third area.
[0035] In an alternative embodiment,
[0036] The positioning step also includes the following steps:
[0037] Keep the camera position and working distance unchanged and collect the image of the target.
[0038] In an alternative embodiment,
[0039] The calibration plate includes a first calibration block and a second calibration block;
[0040] A plurality of the first calibration blocks and a plurality of the second calibration blocks are provided, and the first calibration blocks and the second calibration blocks are arranged alternately.
[0041] The linear array camera calibration method provided by the present invention uses a calibration plate to calculate the resolution of each calibration block. When the measured target moves, it can be divided into a first area, a second area and a third area according to the area where the measured target is located, and the resolution of the corresponding area is automatically calculated for calculation without error. The calculation result is more accurate, which alleviates the technical problem in the prior art that when the position of the detection area in the image changes greatly, the corresponding resolution will change. If the resolution used for measurement remains unchanged, the measurement result will have an error. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A schematic diagram of the structure of a calibration board in a linear array camera calibration method provided in an embodiment of the present invention.
[0044] Icon: 10-first area; 20-second area; 30-third area; 100-calibration plate; 110-first calibration block; 120-second calibration block; DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0048] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, or the positions or positional relationships in which the product of the invention is usually placed when in use. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific position, be constructed and operated in a specific position, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0049] In addition, the terms "horizontal", "vertical", "overhanging" and the like do not mean that the components are required to be absolutely horizontal or overhanging, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0050] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0051] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0052] Existing technical solution steps:
[0053] Step 1, calibration: According to the number of pixels P of the target under test in the camera and the physical width W of the actual target, the average value R of the resolution corresponding to each pixel can be calculated. The formula is R = W / P.
[0054] Step 2: Measurement: The method of using a camera for measurement is the opposite of step 1. The resolution R has been obtained through step 1. The actual physical width W of the measured object can be obtained through the number of pixels P of the measured object in the camera, and the formula is W = P*R.
[0055] Step 3: When the target moves in the camera field of view, the above step 1 must be repeated to re-acquire the resolution. Otherwise, due to lens distortion, the resolution at the current position will be different from the resolution at the previous position, and the actual physical width W of the target will be inaccurate.
[0056] The linear array camera calibration method provided in this embodiment includes the following steps: calibration step: the camera measures the number of pixels of any marking block on the calibration plate 100, the camera measures the actual width of any marking block on the calibration plate 100, and calculates the resolution; positioning step: determining the area position of the calibration plate 100 where the measured target is located; area division step: dividing the measured area into a first area 10, a second area 20 and a third area 30, the first area 10 is set to the left end point of the measured target to the leftmost dividing line position covered by the measured target; the second area 20 is set to the leftmost calibration block dividing line position covered by the measured target to the rightmost calibration plate 100 dividing line position covered by the measured target; the third area 30 is set to the rightmost calibration plate 100 dividing line position covered by the measured target to the right end point of the measured area. Calculation step: according to the first area 10, the second area 20 and the third area 30, the total physical width of the measured target is calculated.
[0057] Specifically, Figure 1 As shown, a camera is used to shoot a standard film with alternating black and white stripes and a width of D. The total number of black and white stripes is N. In each stripe, the number of pixels measured by the camera is P, the actual width is W, and the resolution is R. The calculation formula is R = P / W. The resolution in each stripe is calculated in this way.
[0058] Keeping the camera position and working distance unchanged, the image of the object to be measured is collected, the relative position of the object to be measured and the calibration plate 100 initially calibrated is determined, and the measured area is divided into three areas: the first area 10: from the left end point of the measured target to the leftmost dividing line position covered by the measured target; the second area 20: from the first dividing line position of the calibration plate 100 covered by the measured target to the rightmost dividing line position of the calibration plate 100 covered by the measured target; the third area 30: from the rightmost dividing line position of the calibration plate 100 covered by the measured target to the right end point of the measured area; the physical widths of the three areas are calculated respectively, and the total physical width is calculated. Even if the measured target moves, the resolution of the corresponding area can be calculated according to the area where the measured target is located.
[0059] The linear array camera calibration method provided in the present embodiment uses the calibration plate 100, and the resolution of each calibration block is calculated. When the measured target moves, it can be divided into the first area 10, the second area 20 and the third area 30 according to the area where the measured target is located. The resolution of the corresponding area is automatically calculated for calculation without error. The calculation result is more accurate, which alleviates the technical problem in the prior art that when the position of the detection area in the image changes significantly, the corresponding resolution will change. If the resolution used for measurement remains unchanged, the measurement result will have errors.
[0060] Based on the above embodiment, in an optional implementation manner, the calibration step in the linear array camera calibration method provided in this embodiment further includes the following steps: recording the edge of the calibration plate 100: using a camera to photograph the black and white calibration plate 100, and recording the position of each junction of the black and white stripes.
[0061] Specifically, before the calibration step, a camera is used to photograph black and white stripes as the calibration plate 100 , the width of each black and white stripe is the same, and the position of the junction of each group of black and white stripes is recorded.
[0062] In an optional embodiment, the step of recording the edge of the calibration plate 100 further includes the following steps: using binary segmentation to obtain the positions of black and white areas on the calibration plate 100 image; using projection to obtain the average gray value of each column of the image; converting the average gray value of each column into a discrete function;
[0063] Specifically, the image of the calibration plate 100 is first segmented using simple binary segmentation to obtain the approximate positions of the black and white areas, and then the average grayscale value of each column of the image is obtained using a projection method, and the average grayscale value of each column is converted into a discrete function.
[0064] The camera calibration has been completed in the above steps. If the working distance and camera position remain unchanged, there is no need to repeat the calibration.
[0065] In an optional embodiment, recording the edge of the calibration plate 100 further includes the following steps: using sub-pixel edge detection to extract the exact position of the boundary edge between the black and white areas and record it.
[0066] Specifically, after the calibration is completed, a sub-pixel edge detection algorithm is used to record the exact position of the boundary between black and white stripes.
[0067] In an optional embodiment, the calculation step further includes the following steps: calculating the physical width of the second area 20 by calculating the number of covered calibration blocks and the width of each calibration block.
[0068] Specifically, the physical width of the second area 20 can be calculated by the number of calibration blocks covered by the second area 20. Since the length of each calibration block is the same, which is D, if the second area 20 covers n calibration blocks, the physical width of the second area 20 is W2 = n*D.
[0069] In an optional embodiment, the calculation step further includes the following steps: calculating the physical width of the first region 10 by using the pixel length of the first region 10 and the resolution of the region where the first region 10 is located.
[0070] In an optional embodiment, the calculation step further includes the following steps: calculating the physical width of the third region 30 by using the pixel length of the third region 30 and the resolution of the region where the third region 30 is located.
[0071] Specifically, the physical widths of the first area 10 and the third area 30 are calculated by multiplying the pixel lengths of the first area 10 and the third area 30 by the resolutions of the corresponding areas. For example, if the first area 10 is located in area N, the resolution of area N is Nr, and the pixel length of the first area 10 is P1, then the physical width of the first area 10 is W1=P1*Nr. The calculation method of the third area 30 is the same as that of the first area 10, and the physical width of the third area 30 is recorded as W3.
[0072] In an optional embodiment, the calculation step further includes the following steps: adding the physical width of the first area 10, the physical width of the second area 20 and the physical width of the third area 30 to calculate the total physical width of the measured object.
[0073] Specifically, the total width of the measured object is calculated by adding the physical widths of the first regions 10, 2, and 3 to obtain the total width W=W1+W2+W3.
[0074] In an optional implementation, the positioning step further includes the following steps: keeping the camera position unchanged, keeping the camera working distance unchanged, and capturing an image of the target being measured.
[0075] In an optional embodiment, the calibration board 100 includes a first calibration block 110 and a second calibration block 120 ; a plurality of the first calibration block 110 and the second calibration block 120 are provided, and the first calibration blocks 110 and the second calibration blocks 120 are arranged alternately.
[0076] Specifically, the first calibration block 110 is a black stripe, and the second calibration block 120 is a white stripe. The black stripes and the white stripes have the same width and are arranged in black and white.
[0077] The overall steps are as follows: Step 1, record the edge of the calibration plate 100: record the position of each black and white stripe's boundary edge for subsequent resolution calibration and to determine the resolution of the object being measured. First, use a simple binary segmentation on the calibration plate 100 image to obtain the approximate position of the black and white areas.
[0078] Step 2: Use projection to obtain the average grayscale value of each column of the image, and convert the average grayscale value of each column into a discrete function.
[0079] Step 3: Use a sub-pixel edge detection algorithm to extract the exact position of the boundary edge between the black and white areas and record it.
[0080] Step 4, calibration: Use the camera to shoot a calibration plate 100 with alternating black and white stripes of width D. The total number of black and white stripes is N. In each stripe, the number of pixels measured by the camera is P, the actual width is W, and the resolution is R. The calculation formula is R=P / W, and the resolution in each stripe is calculated based on this.
[0081] Step 5: The camera calibration has been completed in steps 1 and 2. If the working distance and camera position remain unchanged, there is no need to repeat the calibration. Step 3 is to remove the calibration plate 100. In order to show the relative position relationship between the object to be measured and the calibration plate 100 in subsequent diagrams, the calibration plate 100 will continue to be displayed as a schematic diagram.
[0082] Step 6: Keep the camera position and working distance unchanged and collect the image of the object to be measured.
[0083] Step 7: Determine the relative position between the object to be measured and the calibration plate 100 of initial calibration.
[0084] Step 8, divide the measured area into three areas, the first area 10: from the left end point of the measured target to the leftmost dividing line position covered by the measured target, the second area 20: from the dividing line position of the first calibration plate 100 covered by the measured target to the dividing line position of the rightmost calibration plate 100 covered by the measured target, and the third area 30: from the dividing line position of the rightmost calibration plate 100 covered by the measured target to the right end point of the measured area.
[0085] Step 9, calculate the physical width of the second area 20, which can be calculated by the number of calibration blocks covered by the second area 20. Since the length of each calibration block is the same, which is D, if the second area 20 covers n calibration blocks, then the physical width of the second area 20 W2 = n*D.
[0086] Step 10: Calculate the physical width of the first area 10 and the third area 30. The calculation method is: multiply the pixel length of the first area 10 and 3 by the resolution of the corresponding area. For example, if the first area 10 is located in area N, the resolution of area N is Nr, and the pixel length of the first area 10 is P1, then the physical length W1 of the first area 10 is W1=P1*Nr. The calculation method of the third area 30 is the same as that of the first area 10.
[0087] Step 11, calculate the total width of the target to be measured, and add the physical widths of the first area 10, the second area 20, and the third area 30 to obtain the total width W=W1+W2+W3.
[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A linear array camera calibration method, characterized in that: The following steps are involved: Calibration steps: the camera measures the number of pixels of any marking block on the calibration plate (100), the camera measures the actual width of any marking block on the calibration plate (100), and the resolution is calculated; Positioning step: determining the area position of the calibration plate (100) where the measured object is located; Area division step: dividing the measured area into a first area (10), a second area (20) and a third area (30), wherein the first area (10) is set to be the position of the leftmost dividing line from the left end point of the measured object to the measured object; The second area (20) is set from the leftmost calibration block dividing line position covered by the measured object to the rightmost calibration plate (100) dividing line position covered by the measured object; The third area (30) is set to be from the rightmost dividing line position of the calibration plate (100) covered by the measured object to the right end point of the measured area; Calculation step: calculating the total physical width of the measured object according to the first area (10), the second area (20) and the third area (30); The calculation step also includes the following steps: Calculating the physical width of the second area (20) by calculating the number of covered calibration blocks and the width of each calibration block; The calculation step also includes the following steps: Calculating the physical width of the first region (10) by using the pixel length of the first region (10) and the resolution of the region where the first region (10) is located; The calculation step also includes the following steps: Calculating the physical width of the third area (30) by using the pixel length of the third area (30) and the resolution of the area where the third area (30) is located; The calculation step also includes the following steps: The total physical width of the measured object is calculated by adding the physical width of the first area (10), the physical width of the second area (20) and the physical width of the third area (30).
2. The linear array camera calibration method according to claim 1, characterized in that: The calibration step also includes the following steps: The step of recording the edge of the calibration plate (100) is as follows: using a camera to photograph the black and white calibration plate (100), and recording the position of each junction of the black and white stripes.
3. The linear array camera calibration method according to claim 2, characterized in that: The step of recording the edge of the calibration plate (100) further comprises the following steps: The calibration plate (100) image is segmented by binary method to obtain the positions of black and white areas; The projection method is used to obtain the average gray value of each column of the image, and the average gray value of each column is converted into a discrete function.
4. The linear array camera calibration method according to claim 3, characterized in that: The edge of the recording and calibration plate (100) further comprises the following steps: Use sub-pixel edge detection to extract the exact position of the boundary edge between black and white areas and record it.
5. The linear array camera calibration method according to claim 1, characterized in that: The positioning step also includes the following steps: Keep the camera position and working distance unchanged and collect the image of the target.
6. The linear array camera calibration method according to any one of claims 1 to 5, characterized in that: The calibration plate (100) comprises a first calibration block (110) and a second calibration block (120); A plurality of the first calibration blocks (110) and the second calibration blocks (120) are provided, and the first calibration blocks (110) and the second calibration blocks (120) are arranged alternately.
