Image stitching method and apparatus, computer device, and storage medium

By using two rows of parallel calibration patterns to assist the image stitching method in a multi-line laser imaging system, the problem of low image stitching efficiency in traditional technology is solved, fast and accurate image stitching is achieved, and imaging accuracy and efficiency are improved. It is especially suitable for Imaging of battery cells and other products.

WO2024183165A1PCT designated stage expired Publication Date: 2024-09-12GUANGDONG LYRIC ROBOT INTELLIGENT AUTOMATION CO LTD

Patent Information

Application Number
PCT/CN2023/096870
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-07
Filing Date
2023-05-29
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

Traditional multi-line laser imaging stitching technology has problems such as complex theory, large amount of calculation, and low efficiency, which results in inaccurate robustness test results and difficulty in achieving fast and accurate image stitching.

Method used

Two rows of parallel calibration patterns are used to assist the image splicing method. By obtaining the grayscale image and height map of the image to be spliced, the actual coordinates of the calibration pattern are determined, the affine matrix is ​​calculated for image transformation, and the plane fitting is corrected. Finally, the corrected image is Perform splicing to achieve complete imaging of the object to be imaged.

Benefits of technology

This method does not need to adjust the parameters of the line laser correction unit, but directly processes the image, improving imaging accuracy and efficiency. It is especially suitable for imaging scenarios of products such as battery cells, and solves the problem of unsatisfactory imaging effects at the edge of the battery core.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023096870_12092024_PF_FP_ABST
    Figure CN2023096870_12092024_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides an image stitching method and apparatus, a computer device, and a storage medium. The method is applied to a multi-line laser imaging system, and an object to be imaged is placed between two rows of parallel calibration patterns. The method comprises: acquiring a plurality of groups of images to be stitched; for any group of images to be stitched, determining actual coordinates of each calibration pattern in a grayscale map, and calculating an affine matrix used for transforming the actual coordinates to corresponding ideal coordinates; respectively transforming a height map and the grayscale map by using the affine matrix to obtain a first height map and a corrected grayscale map, and performing plane fitting according to height information of each calibration pattern in the first height map to obtain a corrected plane; correcting height information of each pixel point in the first height map by using the corrected plane to obtain a corrected height map; and stitching each group of corrected images to be stitched to obtain an image of an object to be imaged. The method can quickly and accurately achieve the correction and stitching of images to be stitched.
Need to check novelty before this filing date? Find Prior Art

Description

Image stitching method, device, computer equipment and storage medium Technical Field

[0001] The present application relates to the field of laser imaging technology, and in particular to an image stitching method, apparatus, computer equipment, and storage medium. Background Art

[0002] With the development of industrial automation, various industries are facing comprehensive industrial upgrades in terms of efficiency, energy saving, informatization, safety, etc. Laser imaging can automatically perform defect detection and good product judgment during the product manufacturing process, and is therefore widely used in the production processes of various products.

[0003] Three-dimensional laser imaging is a crucial component of laser imaging technology. It can capture both planar and elevation information of objects, enabling better inspection. However, a single line laser imaging unit has a limited field of view. For objects beyond this field of view, a multi-line laser imaging system with multiple line laser imaging units is required. Therefore, the images captured by these multiple line laser imaging units must be stitched together. However, conventional stitching techniques for multi-line laser imaging suffer from theoretical complexity, high computational complexity, and low efficiency.

[0004] Summary of the Invention

[0005] The purpose of this application is to solve at least one of the above technical deficiencies, especially the technical defect that the robustness test results in the prior art are not accurate enough.

[0006] In a first aspect, the present application provides an image stitching method, which is applied to a multi-line laser imaging system. The object to be imaged is placed between two rows of parallel calibration patterns. The stitching method includes:

[0007] Acquire multiple sets of images to be stitched; each set of images to be stitched includes a grayscale image and a height image;

[0008] For any set of images to be stitched, determine the actual coordinates of each calibration pattern in the grayscale image, and calculate the affine matrix that transforms each actual coordinate to the corresponding ideal coordinate;

[0009] The height map and the grayscale map are transformed respectively using an affine matrix to obtain a first height map and a corrected grayscale map, and a plane fitting is performed based on the height information of each calibration pattern in the first height map to obtain a corrected plane.

[0010] Correcting the height information of each pixel in the first height map using the correction plane to obtain a corrected height map;

[0011] The corrected images to be stitched are stitched together to obtain an image of the object to be imaged.

[0012] In one embodiment, for any set of images to be stitched, determining the actual coordinates of each calibration pattern in the grayscale image and calculating an affine matrix that transforms each actual coordinate to the corresponding ideal coordinate includes:

[0013] For any set of images to be stitched, determine whether there is a misalignment phenomenon in the set of images to be stitched;

[0014] When it is determined that there is no misalignment in the images to be spliced, the actual coordinates of each calibration pattern are determined in the grayscale image, and an affine matrix for transforming each actual coordinate into a corresponding ideal coordinate is calculated.

[0015] In one embodiment, the calibration pattern includes a first circular pattern and a second circular pattern with different radii, and the first circular pattern and the second circular pattern are alternately arranged at equal intervals in the same row; and determining whether there is misalignment in the set of images to be stitched includes:

[0016] Get the radius of the first calibration pattern in the grayscale image;

[0017] If the radius of the first calibration image matches the standard radius corresponding to the set of images to be stitched, it is determined that there is no misalignment in the set of images to be stitched; otherwise, it is determined that there is a misalignment in the set of images to be stitched.

[0018] In one embodiment, the calibration pattern is a circular pattern, and determining the actual coordinates of each calibration pattern in the grayscale image includes:

[0019] Identify multiple circular contour areas in a grayscale image;

[0020] Obtain the center coordinates of each circular contour area, and use the center coordinates of each circle as the actual coordinates of the corresponding calibration pattern.

[0021] In one embodiment, calculating an affine matrix that transforms each actual coordinate into a corresponding ideal coordinate includes:

[0022] Based on the minimum distance square sum method, the affine matrix is ​​calculated according to each actual coordinate and the ideal coordinate corresponding to each actual coordinate.

[0023] In one embodiment, using a correction plane to correct the height information of each pixel in the first height map to obtain a corrected height map includes:

[0024] For any pixel point in the first height map, obtain the height information of the same position as the pixel point on the correction plane, and use the height information as the height correction information;

[0025] In the first height map, the height correction information is subtracted from the height information of the pixel.

[0026] In one embodiment, stitching the groups of corrected images to be stitched together to obtain an image of the object to be imaged includes:

[0027] Identifying overlapping portions between the corrected images to be stitched;

[0028] The corrected images to be stitched are stitched together according to the overlapping parts to obtain an image of the object to be imaged.

[0029] In a second aspect, an embodiment of the present application further provides an image stitching device, which is applied to a multi-line laser imaging system. The object to be imaged is placed between two rows of parallel calibration patterns. The device includes:

[0030] An image acquisition module is used to acquire multiple sets of images to be stitched; each set of images to be stitched includes a grayscale image and a height image;

[0031] An image correction module is configured to determine the actual coordinates of each calibration pattern in the grayscale image for any set of images to be stitched, and calculate an affine matrix that transforms each actual coordinate into the corresponding ideal coordinate; use the affine matrix to transform the height map and grayscale image respectively to obtain a first height map and a corrected grayscale image; perform plane fitting based on the height information of each calibration pattern in the first height map to obtain a corrected plane; and use the corrected plane to correct the height information of each pixel in the first height map to obtain a corrected height map;

[0032] The image stitching module is used to stitch the corrected images to be stitched together to obtain an image of the object to be imaged.

[0033] In a third aspect, an embodiment of the present application further provides a computer device comprising one or more processors and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the steps of the image stitching method in any of the above embodiments are executed.

[0034] In a fourth aspect, an embodiment of the present application further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image stitching method in any of the above embodiments.

[0035] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0036] Based on the image stitching method of this embodiment, the object to be imaged is placed on a calibration plate with two rows of parallel calibration patterns. The calibration patterns are used as anchor points to correct the images to be stitched obtained by each line laser scanning unit. Specifically, an affine matrix is ​​calculated based on the actual coordinates and ideal coordinates of each calibration pattern, and the grayscale image and height map are transformed using the affine matrix. The errors on the plane perpendicular to the height direction are corrected to obtain a first height map and a corrected grayscale map. The first height map containing the height information is further corrected in the height direction using the correction plane obtained by fitting the height information of each calibration pattern on the first height map to obtain a corrected height map. Finally, the corrected images to be stitched are stitched together to obtain a complete image of the object to be imaged. This method does not require parameter adjustment of the line laser correction unit and directly processes the image. It can quickly and accurately realize the correction and stitching of the images to be stitched, greatly improving the imaging accuracy and efficiency. It is particularly suitable for scenarios where products such as battery cells are imaged, and can well solve the problem of unsatisfactory imaging effects at the edges of the battery cells. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0038] FIG1 is a diagram illustrating an application scenario of an image stitching method provided by an embodiment of the present application;

[0039] FIG2 is a schematic diagram of a flow chart of an image stitching method provided in one embodiment of the present application;

[0040] FIG3 is a diagram illustrating an application scenario of an image stitching method provided by another embodiment of the present application;

[0041] FIG4 is a module structure diagram of an image stitching device provided by one embodiment of the present application;

[0042] FIG5 is a diagram showing the internal structure of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0043] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0044] The purpose of this application is to solve at least one of the above technical deficiencies, especially the technical defect that the robustness test results in the prior art are not accurate enough.

[0045] The present application provides an image stitching method, which is applied to a multi-line laser imaging system. The multi-line laser imaging system includes a plurality of line laser scanning units. Each line laser scanning unit images the object to be imaged by emitting a line laser to the object to be imaged and then receiving the light reflected back from the object to be imaged. For objects that cannot be accommodated by the field of view of a single line laser scanning unit, the scanning results of each line laser scanning unit need to be stitched together. For ordinary two-dimensional imaging, stitching based on key feature point extraction is often used, but this type of method is not applicable when facing line laser imaging containing height information. In addition, since each line laser scanning unit needs to move during the imaging process, this may cause the line laser scanning unit to be offset, making it difficult to stitch the imaging results together. The method of correcting the scanning unit in traditional technology is very cumbersome and requires a large amount of calculation, which is not conducive to improving the efficiency of production and manufacturing.

[0046] Based on this, this application designs a calibration board to assist in the correction of each image to be spliced. Please refer to Figure 1. Two rows of parallel calibration patterns are set on the calibration board. The object to be imaged is placed between these two rows of calibration patterns. When placing the object to be imaged, it should be noted that the calibration pattern must not be blocked at the imaging angle of the online laser scanning unit. The shape, size, spacing, color, etc. of the calibration pattern can be selected as needed, such as circular patterns, rectangular patterns, triangular patterns, etc. What is presented in Figure 1 is a circular pattern set at equal intervals, and the object to be imaged is a battery cell.

[0047] In image stitching scenarios, it is generally necessary to set three-dimensional coordinate axes. The setting method of the three-dimensional coordinate axes can be selected as needed. For the convenience of explanation, the surface parallel to the calibration plate plane is referred to as the XY plane, and the direction perpendicular to the calibration plate upward is referred to as the Z axis direction.

[0048] Please refer to FIG. 2 . The splicing method provided in the embodiment of the present application includes steps S202 to S210 .

[0049] S202: Acquire multiple groups of images to be stitched.

[0050] It can be understood that each line laser imaging unit scans the object to be imaged to generate a set of images to be stitched. In other words, each set of images to be stitched has a one-to-one correspondence with a line laser imaging unit. Based on the operating principle of the line laser scanning unit, each set of images to be stitched will include a grayscale image and a height map. The pixel value of each pixel in the grayscale image is related to the color of the corresponding position on the object. The pixel value of each pixel in the height map is related to the height information of the corresponding position on the object.

[0051] As previously mentioned, each line laser scanning unit may experience lens offset and other issues during the scanning process, resulting in image distortion. Steps S204 to S208 are the process of correcting each set of images to be stitched together. This requires these steps for both the grayscale image and the height map in each set of images to be stitched together.

[0052] S204 : For any set of images to be stitched, determine the actual coordinates of each calibration pattern in the grayscale image, and calculate an affine matrix for transforming each actual coordinate into a corresponding ideal coordinate.

[0053] It is understandable that the deformation of the image to be stitched is caused by the offset of the line laser scanning unit, which will cause the pixels in the image to be stitched to change from the ideal coordinate system when there is no lens offset to the actual coordinate system when there is lens offset. Therefore, it is necessary to recalibrate the image to be stitched back to the ideal coordinate system. The calibration process includes both correction of the XY plane and correction of the height information. The affine matrix is ​​used to transform from one two-dimensional coordinate system to another two-dimensional coordinate system and is applicable to the correction of the XY plane in this application.

[0054] Because the positions of the calibration patterns remain constant and their number meets the requirements for obtaining the affine matrix, this embodiment uses each calibration pattern as an anchor point. The ideal coordinates of each calibration pattern are obtained in advance, and then the actual coordinates of each calibration pattern are identified on the grayscale image using an image recognition algorithm. Based on three or more pairs of ideal and actual coordinates, an affine matrix is ​​fitted to transform the calibration image from actual coordinates to ideal coordinates.

[0055] It is worth mentioning that, since the calibration pattern is not a point, in order to represent a calibration pattern with one coordinate, it is necessary to select a representative point on each calibration pattern, and use the coordinates of the representative point as the coordinates of the calibration pattern. In addition, the representative points of the calibration patterns in the same row should be in the same straight line, and the two straight lines corresponding to different rows should be parallel to each other, so as to facilitate the subsequent steps of fitting the corrected plane. Based on this, in some embodiments, in order to facilitate understanding and locking the representative point during image recognition, the center point of each calibration pattern is selected as the representative point. As shown in Figure 1, the center of each circular pattern is selected as the representative point, and the center of the circular patterns in the same row are in the same straight line, and the two straight lines corresponding to different rows are parallel to each other.

[0056] S206 , using an affine matrix to transform the height map and the grayscale map respectively to obtain a first height map and a corrected grayscale map, and performing plane fitting based on the height information of each calibration pattern in the first height map to obtain a corrected plane.

[0057] It can be understood that after calculating the affine matrix, the coordinates of each pixel in the height map and grayscale image are transformed using the affine matrix to eliminate the error caused by XY plane offset. The transformed grayscale image is the corrected grayscale image. Since it does not contain height information, no Z-axis correction is required, thus completing the grayscale image correction. However, the height map contains height information and still requires further correction in the Z-axis, meaning that the height information of each pixel in the first height map needs to be further corrected. Specifically, each calibration image should be in the same plane. If there is no Z-axis offset, their pixel values ​​in the first height map should be the same. However, offset may occur in the actual coordinate system, meaning that each calibration image may appear to have different heights in the first height map. If the calibration images in the first height map need to be corrected to the same height, the effect of the calibration image in the first height map reflects the required Z-axis correction. Based on knowledge of plane geometry, two parallel lines define a plane. Therefore, two parallel rows of calibration patterns define a plane in three-dimensional space, with the representative points of each calibration pattern lying on that plane. The corrected plane, obtained by plane fitting based on the height information of each calibration pattern in the first height map, reflects the Z-axis offset of each pixel in the first height map.

[0058] S208 , using a correction plane to correct the height information of each pixel in the first height map to obtain a corrected height map.

[0059] It can be understood that there is a one-to-one correspondence between each pixel point in the first height map and each point on the correction plane, and the height information of each point on the correction plane reflects the correction amount in the Z-axis direction of the corresponding pixel point of the point on the first height map. Therefore, for any pixel point in the first height map, the height information at the same position as the pixel point is obtained on the correction plane, and the height information is used as the height correction information. In the first height map, the height information of the pixel point is subtracted from the height correction information. After correcting each pixel point in the first height map, a corrected height map can be obtained. At this point, the grayscale image and height map in a set of images to be stitched have been corrected, eliminating the error caused by the offset of the line laser scanning unit.

[0060] S210 , stitching the corrected images to be stitched together to obtain an image of the object to be imaged.

[0061] It can be understood that the image obtained by stitching the corrected images to be stitched will not be distorted, and a complete image of the object to be imaged can be obtained.

[0062] Based on the image stitching method of this embodiment, the object to be imaged is placed on a calibration plate with two rows of parallel calibration patterns. The calibration patterns are used as anchor points to correct the images to be stitched obtained by each line laser scanning unit. Specifically, an affine matrix is ​​calculated based on the actual coordinates and ideal coordinates of each calibration pattern, and the grayscale image and height map are transformed using the affine matrix. The errors on the plane perpendicular to the height direction are corrected to obtain a first height map and a corrected grayscale map. The first height map containing the height information is further corrected in the height direction using the correction plane obtained by fitting the height information of each calibration pattern on the first height map to obtain a corrected height map. Finally, the corrected images to be stitched are stitched together to obtain a complete image of the object to be imaged. This method does not require parameter adjustment of the line laser correction unit and directly processes the image. It can quickly and accurately realize the correction and stitching of the images to be stitched, greatly improving the imaging accuracy and efficiency. It is particularly suitable for scenarios where products such as battery cells are imaged, and can well solve the problem of unsatisfactory imaging effects at the edges of the battery cells.

[0063] In one embodiment, for any set of images to be stitched, determining the actual coordinates of each calibration pattern in the grayscale image and calculating an affine matrix that transforms each actual coordinate to the corresponding ideal coordinate includes:

[0064] (1) For any set of images to be stitched, determine whether there is any misalignment in the set of images to be stitched.

[0065] (2) When it is determined that there is no misalignment in the images to be stitched, the actual coordinates of each calibration pattern are determined in the grayscale image, and an affine matrix is ​​calculated to transform each actual coordinate into the corresponding ideal coordinate.

[0066] It can be understood that misalignment refers to a situation where the imaging perspective of the laser scanning unit deviates significantly from the ideal perspective, resulting in the loss of part of the image of the object to be imaged. The occurrence of misalignment indicates that the imaging results of the line laser scanning unit are difficult to correct. Therefore, correction of the images to be stitched can only be initiated after it is determined that there is no misalignment in the images to be stitched. If misalignment is determined in the images to be stitched, an adjustment prompt can be issued to prompt the staff to adjust the perspective of the line laser scanning unit that captured the set of images to be stitched.

[0067] In one embodiment, a specific calibration pattern setting method can be adopted to facilitate the determination of whether there is a misalignment phenomenon. As shown in Figure 3, the calibration pattern is set as two circular patterns with different radii, namely a first circular pattern and a second circular pattern. The first circular pattern and the second circular pattern are arranged alternately with equal spacing in the same row. That is, the circular patterns with different radii are arranged in the same row with equal spacing in a pattern of large and small.

[0068] Determining whether there is any misalignment in the set of images to be stitched, including:

[0069] (1) Get the radius of the first calibration pattern in the grayscale image.

[0070] It can be understood that the first calibration pattern here refers to the first calibration image in the preset direction in the same row of calibration patterns, and the preset direction can be determined according to the arrangement direction of each line laser scanning unit. For example, if the line laser scanning units are arranged from left to right, the first calibration pattern refers to the calibration pattern closest to the left boundary in the grayscale image. The research on the method of identifying the circular contour from the grayscale image and determining the radius of the circular contour based on the circular contour is very mature, and there are open source and integrated tools in computer vision software libraries such as OpenCV that can be used directly. After determining the preset direction, the coordinates of each calibration pattern can be used to determine which calibration pattern in the preset direction is the first calibration pattern, and then the radius of the calibration pattern can be obtained by using the relevant radius acquisition algorithm.

[0071] (2) If the radius of the first calibration image matches the standard radius corresponding to the set of images to be stitched, it is determined that there is no misalignment in the set of images to be stitched; otherwise, it is determined that there is misalignment in the set of images to be stitched.

[0072] It can be understood that since the relative position between the line laser scanning unit and the calibration plate is relatively fixed when in a proper position, the first calibration pattern in the grayscale image captured by each line laser scanning unit should remain unchanged. When the first calibration pattern within the viewing angle of the line laser scanning unit changes, it can be determined that the line laser scanning unit has experienced an uncorrectable positional deviation, which will result in misalignment of the images to be stitched corresponding to that line laser scanning unit. The standard radius refers to the radius of the first calibration image captured when the line laser scanning unit corresponding to the set of images to be stitched is in a proper position. Since circular patterns of varying radii are provided at intervals in this application, misalignment can only be determined for the set of images to be stitched if the actual radius of the first calibration image matches the ideal standard radius. Otherwise, misalignment can be determined for the images to be stitched. For example, refer to Figure 3 , where the dashed box represents the viewing angle of the grayscale image when the line laser scanning unit is in a proper position. The first calibration pattern within this viewing angle is the first circular pattern with a radius smaller than that of the second circular pattern. The dotted box in the figure represents the actual viewing angle range of the line laser scanning unit, and the first calibration pattern within this viewing angle range is the second circular pattern. Therefore, it can be determined that the set of images to be stitched is misaligned. It is worth mentioning that the spacing between the first and second circular patterns should be considered based on the maximum deviation of the line laser scanning unit and should not be set too closely to prevent the line laser scanning unit from completely missing more than one circular pattern with a different radius from the standard, resulting in a situation where the first calibration pattern remains unchanged despite the misalignment.

[0073] In one embodiment, to facilitate the acquisition of the coordinates of the calibration pattern, taking a battery cell as an example, since there is generally no circular portion on a battery cell, selecting a circular calibration pattern can avoid misidentification by the algorithm. There are also many mature algorithms for acquiring the coordinates of the center of a circular area. Therefore, determining the actual coordinates of each calibration pattern in the grayscale image includes:

[0074] (1) Identify multiple circular contour areas in the grayscale image.

[0075] It can be understood that each circular contour area corresponds to a circular pattern. Through the contour recognition algorithm, all contours can be found in the grayscale image, and then the shape of each contour can be judged to find the circular contour area.

[0076] (2) Obtain the center coordinates of each circular contour area, and use the center coordinates of each circle as the actual coordinates of the corresponding calibration pattern.

[0077] It is understood that in this embodiment, the center of the circular contour area is used as the representative point, and the coordinates of the center of each circular contour area can reflect the position of the calibration pattern. After the circular contour area is determined, the position of the center of the circular contour area can be found in the circular contour area through the current relevant algorithm and the corresponding coordinates can be calculated.

[0078] In one embodiment, calculating an affine matrix for transforming each actual coordinate into a corresponding ideal coordinate includes: calculating an affine matrix based on each actual coordinate and the ideal coordinate corresponding to each actual coordinate based on a minimum distance square sum method.

[0079] It can be understood that the transformation of the affine matrix is ​​a linear transformation, which can be expressed in matrix form as follows:

[0080] Among them, x and y are the coordinates before affine transformation, and x' and y' are the coordinates after affine transformation. 11 、a 12 、a 13 、a 21 、a 22 and a 23 is the desired parameter in the affine matrix. The minimum squared distance method can fit the desired parameter in the affine matrix from multiple actual coordinates. The affine matrix can be obtained using the matrix form of the minimum squared distance method.

[0081] In one embodiment, stitching the groups of corrected images to be stitched together to obtain an image of the object to be imaged includes:

[0082] (1) Identify the overlapping parts between the corrected images to be stitched.

[0083] (2) The corrected images to be stitched are stitched together according to the overlapping parts to obtain an image of the object to be imaged.

[0084] It can be understood that the images to be stitched collected by two adjacent line laser scanning units will have overlapping parts. Therefore, the overlapping parts between the corrected images to be stitched can be identified and processed so that the redundant overlapping parts can be removed during stitching. This part of the technology is very mature in the existing technology, and the corresponding algorithm can be selected according to actual needs. It is worth mentioning that the stitching here refers to the stitching between grayscale images and grayscale images of different groups, and the stitching between height maps and height maps. The final image of the object to be imaged includes a complete grayscale image and a complete height map that can present the entire object to be imaged.

[0085] The present application also provides an image stitching device for use in a multi-line laser imaging system, wherein the object to be imaged is placed between two rows of parallel calibration patterns. Referring to FIG. 4 , the image stitching device includes an image acquisition module 410 , an image correction module 420 , and an image stitching module 430 .

[0086] The image acquisition module 410 is used to acquire multiple groups of images to be stitched. Each group of images to be stitched includes a grayscale image and a height image.

[0087] Image correction module 420 is used to determine the actual coordinates of each calibration pattern in the grayscale image for any set of images to be stitched, and calculate an affine matrix that transforms each actual coordinate to the corresponding ideal coordinate. The affine matrix is ​​used to transform the height map and grayscale image, respectively, to obtain a first height map and a corrected grayscale image. A plane is then fitted based on the height information of each calibration pattern in the first height map to obtain a corrected plane. The corrected plane is used to correct the height information of each pixel in the first height map to obtain a corrected height map.

[0088] The image stitching module 430 is used to stitch the corrected images to be stitched together to obtain an image of the object to be imaged.

[0089] In one embodiment, the image correction module 420 is used to determine whether there is any misalignment in any set of images to be stitched; if it is determined that there is no misalignment in the images to be stitched, the actual coordinates of each calibration pattern are determined in the grayscale image, and an affine matrix is ​​calculated to transform each actual coordinate into a corresponding ideal coordinate.

[0090] In one embodiment, the calibration pattern includes a first circular pattern and a second circular pattern having different radii, and the first circular pattern and the second circular pattern are alternately arranged in the same row at equal intervals. The image correction module 420 is configured to obtain the radius of the first calibration pattern in the grayscale image; if the radius of the first calibration image matches the standard radius corresponding to the set of images to be stitched, the set of images to be stitched is determined to have no misalignment; otherwise, the set of images to be stitched is determined to have misalignment.

[0091] In one embodiment, the calibration pattern is a circular pattern. The image correction module 420 is configured to identify a plurality of circular contour areas in the grayscale image, obtain the center coordinates of each circular contour area, and use the center coordinates as the actual coordinates of the corresponding calibration pattern.

[0092] In one embodiment, the image correction module 420 is configured to calculate an affine matrix based on the minimum distance square method according to each actual coordinate and the ideal coordinate corresponding to each actual coordinate.

[0093] In one embodiment, the image correction module 420 is used to obtain height information at the same position as any pixel point in the first height map on the correction plane, and use the height information as height correction information; in the first height map, subtract the height correction information from the height information of the pixel point.

[0094] In one embodiment, the image correction module 420 is configured to identify overlapping portions between the groups of corrected images to be stitched; and stitch the groups of corrected images to be stitched based on the overlapping portions to obtain an image of the object to be imaged.

[0095] An embodiment of the present application also provides a computer device, including one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the computer device performs the following steps: obtaining multiple groups of images to be stitched; each group of images to be stitched includes a grayscale image and a height map; for any group of images to be stitched, determining the actual coordinates of each calibration pattern in the grayscale image, and calculating an affine matrix that transforms each actual coordinate into a corresponding ideal coordinate; using the affine matrix to transform the height map and the grayscale image respectively to obtain a first height map and a corrected grayscale image, and performing plane fitting based on the height information of each calibration pattern in the first height map to obtain a corrected plane; using the corrected plane to correct the height information of each pixel point in the first height map to obtain a corrected height map; stitching the groups of corrected images to be stitched to obtain an image of the object to be imaged.

[0096] In one embodiment, when the computer-readable instructions are executed by one or more processors, the computer-readable instructions perform the following steps: for any set of images to be stitched, determining whether the set of images to be stitched has a misalignment phenomenon; if it is determined that the images to be stitched do not have a misalignment phenomenon, determining the actual coordinates of each calibration pattern in the grayscale image, and calculating an affine matrix that transforms each actual coordinate into a corresponding ideal coordinate.

[0097] In one embodiment, when the computer-readable instructions are executed by one or more processors, the following steps are performed: obtaining the radius of the first calibration pattern in the grayscale image; if the radius of the first calibration image matches the standard radius corresponding to the set of images to be stitched, determining that there is no misalignment in the set of images to be stitched; otherwise, determining that there is misalignment in the set of images to be stitched.

[0098] In one embodiment, when the computer-readable instructions are executed by one or more processors, the computer-readable instructions perform the following steps: identifying a plurality of circular contour areas in a grayscale image; obtaining the center coordinates of each circular contour area, and using the center coordinates of each circular contour area as the actual coordinates of the corresponding calibration pattern.

[0099] In one embodiment, when the computer readable instructions are executed by one or more processors, the computer readable instructions are used to calculate an affine matrix based on the minimum distance square method according to each actual coordinate and the ideal coordinate corresponding to each actual coordinate.

[0100] In one embodiment, when the computer-readable instructions are executed by one or more processors, the following is performed: for any pixel point in the first height map, obtaining height information at the same position as the pixel point on the correction plane, and using the height information as height correction information; in the first height map, subtracting the height correction information from the height information of the pixel point.

[0101] In one embodiment, when the computer-readable instructions are executed by one or more processors, the computer-readable instructions perform the following steps: identifying overlapping portions between the groups of corrected images to be stitched; and stitching the groups of corrected images to be stitched based on the overlapping portions to obtain an image of the object to be imaged.

[0102] Schematically, as shown in FIG5 , FIG5 is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. Referring to FIG5 , computer device 500 includes a processing component 502, which further includes one or more processors, and a memory resource represented by memory 501 for storing instructions executable by processing component 502, such as an application. The application stored in memory 501 may include one or more modules, each corresponding to a set of instructions. In addition, processing component 502 is configured to execute instructions to perform the text recognition method of any of the above-described embodiments.

[0103] The computer device 500 may further include a power supply component 503 configured to perform power management of the computer device 500, a wired or wireless network interface 504 configured to connect the computer device 500 to a network, and an input / output (I / O) interface 505. The computer device 500 may operate based on an operating system stored in the memory 501, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or the like.

[0104] Those skilled in the art will understand that the structure shown in FIG5 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0105] An embodiment of the present application also provides a storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors are caused to execute: obtaining multiple groups of images to be stitched; each group of images to be stitched includes a grayscale image and a height map; for any group of images to be stitched, determining the actual coordinates of each calibration pattern in the grayscale image, and calculating an affine matrix that transforms each actual coordinate into a corresponding ideal coordinate; using the affine matrix to transform the height map and the grayscale image respectively to obtain a first height map and a corrected grayscale image, and performing plane fitting based on the height information of each calibration pattern in the first height map to obtain a corrected plane; using the corrected plane to correct the height information of each pixel point in the first height map to obtain a corrected height map; stitching the groups of corrected images to be stitched to obtain an image of the object to be imaged.

[0106] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to perform: for any set of images to be stitched, determining whether the set of images to be stitched has a misalignment phenomenon; if it is determined that the images to be stitched do not have a misalignment phenomenon, determining the actual coordinates of each calibration pattern in the grayscale image, and calculating an affine matrix that transforms each actual coordinate into a corresponding ideal coordinate.

[0107] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to perform the following steps: obtaining a radius of a first calibration pattern in a grayscale image; determining that there is no misalignment in the set of images to be stitched if the radius of the first calibration image matches a standard radius corresponding to the set of images to be stitched; otherwise, determining that there is misalignment in the set of images to be stitched.

[0108] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to perform: identifying multiple circular contour areas in a grayscale image; obtaining the center coordinates of each circular contour area, and using each center coordinate as the actual coordinate of the corresponding calibration pattern.

[0109] In one embodiment, when the computer readable instructions are executed by one or more processors, the one or more processors are caused to perform: calculating an affine matrix based on each actual coordinate and the ideal coordinate corresponding to each actual coordinate based on the minimum distance square sum method.

[0110] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to perform: for any pixel point in the first height map, obtain height information at the same position as the pixel point on the correction plane, and use the height information as height correction information; in the first height map, subtract the height correction information from the height information of the pixel point.

[0111] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to perform the following steps: identifying overlapping portions between the groups of corrected images to be stitched; and stitching the groups of corrected images to be stitched based on the overlapping portions to obtain an image of the object to be imaged.

[0112] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0113] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.

[0114] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An image stitching method, characterized in that: Applied to a multi-line laser imaging system, the object to be imaged is placed between two rows of parallel calibration patterns, and the stitching method includes: Acquire multiple groups of images to be stitched; each group of images to be stitched includes a grayscale image and a height image; For any group of the images to be stitched, determining the actual coordinates of each calibration pattern in the grayscale image, and calculating an affine matrix that transforms each actual coordinate into a corresponding ideal coordinate; The height map and the grayscale map are transformed respectively by using the affine matrix to obtain a first height map and a corrected grayscale map, and a plane fitting is performed according to the height information of each calibration pattern in the first height map to obtain a corrected plane; Using the correction plane to correct the height information of each pixel in the first height map, to obtain a corrected height map; The corrected images to be stitched are stitched together to obtain an image of the object to be imaged.

2. The method according to claim 1, characterized in that For any group of images to be stitched, determining the actual coordinates of each calibration pattern in the grayscale image, and calculating an affine matrix for transforming each actual coordinate into a corresponding ideal coordinate, comprises: For any group of images to be stitched, determining whether there is a misalignment phenomenon in the group of images to be stitched; When it is determined that the image to be spliced ​​does not have the misalignment phenomenon, the actual coordinates of each calibration pattern are determined in the grayscale image, and an affine matrix for transforming each actual coordinate into a corresponding ideal coordinate is calculated.

3. The method according to claim 2, characterized in that The calibration pattern includes a first circular pattern and a second circular pattern with different radii, and the first circular pattern and the second circular pattern are alternately arranged at equal intervals in the same row; and judging whether there is a misalignment phenomenon in the group of images to be stitched includes: Obtaining the radius of the first calibration pattern in the grayscale image; When the radius of the first calibrated image matches the standard radius corresponding to the group of images to be stitched, it is determined that the group of images to be stitched does not have the misalignment phenomenon; otherwise, it is determined that the group of images to be stitched has the misalignment phenomenon.

4. The method according to claim 1, characterized in that: The calibration pattern is a circular pattern, and determining the actual coordinates of each calibration pattern in the grayscale image includes: identifying a plurality of circular contour regions in the grayscale image; The center coordinates of each circular contour area are obtained, and each center coordinate is used as the actual coordinate of the corresponding calibration pattern.

5. The method according to claim 1, characterized in that The calculating of an affine matrix for transforming each of the actual coordinates into a corresponding ideal coordinate comprises: Based on the minimum distance square method, the affine matrix is ​​calculated according to each of the actual coordinates and the ideal coordinates corresponding to each of the actual coordinates.

6. The method according to claim 1, characterized in that The using the correction plane to correct the height information of each pixel in the first height map to obtain a corrected height map includes: For any pixel point in the first height map, obtaining height information at the same position as the pixel point on the correction plane, and using the height information as height correction information; In the first height map, the height correction information is subtracted from the height information of the pixel point.

7. The method according to claim 1, characterized in that The step of stitching the corrected images to be stitched together to obtain an image of the object to be imaged comprises: Identifying overlapping portions between the groups of corrected images to be stitched; The cropped images to be spliced ​​are spliced ​​according to the overlapping parts to obtain an image of the object to be imaged.

8. An image stitching device, characterized in that: Applied to a multi-line laser imaging system, the object to be imaged is placed between two rows of parallel calibration patterns, and the device comprises: An image acquisition module, used to acquire multiple groups of images to be stitched; each group of images to be stitched includes a grayscale image and a height image; An image correction module is used to determine the actual coordinates of each calibration pattern in the grayscale image for any group of images to be stitched, and calculate an affine matrix for transforming each actual coordinate into a corresponding ideal coordinate; transform the height map and the grayscale image respectively using the affine matrix to obtain a first height map and a corrected grayscale image, and perform plane fitting based on the height information of each calibration pattern in the first height map to obtain a corrected plane; and correct the height information of each pixel point in the first height map using the corrected plane to obtain a corrected height map; The image stitching module is used to stitch the corrected images to be stitched together to obtain an image of the object to be imaged.

9. A computer device, characterized in that: The system comprises one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the image stitching method according to any one of claims 1 to 7 are executed.

10. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image stitching method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for multi-line laser high-precision calibration splicing

    CN111504202A

  • Method for collecting and processing 2D and 3D images of PCB and related device

    CN115546016A

  • Image splicing method and device, computer equipment and storage medium

    CN116071240A

  • Calibration method and calibration device for line structured light measurement system, and system

    WO2022143796A1

Cited By

  • Correcting and splicing method for EBSD data

    CN119090717A

  • Image splicing method and device for microscopic morphology three-dimensional reconstruction and medium

    CN121481838A