An image stitching method based on halcon

CN114742705BActive Publication Date: 2025-02-07HEFEI INSTITUTE OF PHYSICAL SCIENCE CHINESE ACADEMY OF SCIENCES +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210309504.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-25
Publication Date
2025-02-07
Estimated Expiration
2042-03-25

AI Technical Summary

Technical Problem

图像匹配较为热门是基于特征匹配的方法,包括SFIT、SURF、ORB,但这些方法对于每组图像都要提取其特征点,十分耗时,而且必然会出现特征点提取错误、匹配错误的风险,导致图像拼接的精度降低,无法满足笔记本自动化检测过程中要求实时性和高精度性

Benefits of technology

[0031] The invention first uses halcon to calibrate, obtain internal parameters and 3D poses, and then coordinate system mapping is performed to eliminate the error caused by the thickness of the calibration plate, obtain the final external parameter matrix, and finally obtain the final homographic matrix using internal parameters and external parameter calculations. . In addition, the invention translates the origin of the coordinate system in which the calibrated 3D position is located to the upper left corner point of the first picture taken by the first camera, so that the first camera and the second camera can be photographed at the same time and at different angles. Two graphs can be mapped under the same world coordinate system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114742705B_ABST
    Figure CN114742705B_ABST
Patent Text Reader

Abstract

The present invention discloses a halcon-based image stitching method. First, halcon is used to calibrate the camera to obtain the intrinsic parameters and 3D pose, and then coordinate system mapping is performed to eliminate the error caused by the thickness of the calibration plate, and the final external parameter matrix is ​​obtained, and finally the final homography matrix is ​​calculated using the intrinsic parameters and external parameters. In addition, the present invention translates the origin of the coordinate system where the calibrated camera 3D pose is located to the upper left corner of the first picture taken by the first camera, so that the two pictures taken by the first camera and the second camera at the same time and at different angles can be mapped in the same world coordinate system. The present invention eliminates the influence of the thickness of the calibration plate and the thickness of different keyboards (uneven placement) on the accuracy of image stitching and fusion, and can better align images, the accuracy of the stitched image is high, and the stitching result has no ghosting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image stitching method based on halcon. Background Art

[0002] During the production process of laptop computers, one camera may not be able to capture the entire appearance of the laptop computer or some areas may require higher resolution and clarity. Therefore, multiple cameras are required to shoot and image stitching technology is used during the production process to ensure that high-resolution images of the laptop computer that meet the inspection requirements can be obtained in real time.

[0003] Nowadays, image stitching technology mainly includes four steps, namely image matching, image reprojection, image stitching and image fusion. The first step "image matching" and the fourth step "image fusion" are the two steps that directly affect the image stitching effect. The more popular image matching methods are based on feature matching, including SFIT, SURF, and ORB. However, these methods need to extract feature points for each set of images, which is very time-consuming and will inevitably lead to the risk of feature point extraction errors and matching errors, resulting in reduced image stitching accuracy, which cannot meet the real-time and high-precision requirements in the notebook automatic detection process.

[0004] Moreover, in the actual production process, the laptop may be tilted or placed unevenly, so that the camera and the laptop are not parallel, which will also cause errors in stitching. Moreover, if the calibration point coordinates obtained by calibration are directly used, it is only a conversion between a two-dimensional coordinate system and a two-dimensional coordinate system, and the keyboard is a three-dimensional object, so stitching will inevitably lead to errors. In addition, even if the calibration plate is printed on paper, there will be height differences, which will cause errors in the stitching of the laptop keyboard image. Summary of the invention

[0005] In order to eliminate the errors in image stitching and fusion, the present invention provides an image stitching method based on Halcon, which can eliminate the errors caused by the tilt and uneven placement of the calibration plate and the object, and improve the accuracy of image stitching.

[0006] The present invention provides an image stitching method based on halcon, characterized in that it comprises the following steps:

[0007] Step 1: Map the points on the first image taken by the first camera to the corresponding world coordinate system, and then translate the origin of the coordinate system where the 3D pose of the first camera obtained by halcon calibration is located to the upper left corner of the world coordinate system where the pixel point of the first image is located, while taking into account the thickness of the dot calibration plate, and obtain a new 3D pose NewOrigin_PoseMatrix1, as shown in formula (8):

[0008]

[0009] Among them, PoseMatrix1 is the 3D pose of the first camera obtained by halcon calibration; Dx and Dy are the coordinates of the upper left corner pixel of the first image in the world coordinate system; Dz is the thickness of the calibration plate;

[0010] Step 2: First map the points on the second image taken by the second camera to the corresponding world coordinate system, then convert the origin of the world coordinate system of the second camera into the origin of the world coordinate system of the first image, and then translate the origin of the coordinate system where the 3D pose of the second camera obtained by halcon calibration is located to the upper left corner of the world coordinate system where the pixel point of the first image is located, and consider the thickness of the dot calibration plate at the same time, and obtain a new 3D pose NewOrigin_PoseMatrix2, as shown in formula (9):

[0011]

[0012] Among them, PoseMatrix2 is the 3D pose of the second camera obtained by halcon calibration;

[0013] Step 3: According to formula (8) and formula (9), the external parameter matrix formulas (11) and (12) of the first camera and the second camera are calculated respectively:

[0014] R1=NewOrigin_PoseMatrix1 T (11)

[0015] R2=NewOrigin_PoseMatrix2 T (12)

[0016] Where R1 represents the extrinsic matrix of the first camera, and R2 represents the extrinsic matrix of the second camera;

[0017] Step 4: Calculate the homography matrices H1(13) and H2(14) of the first camera and the second camera respectively mapped to the world coordinate system where the pixels of the first picture taken by the first camera are located, and at the same time correct the thickness of the dot calibration plate:

[0018] H1=A1*NewOrigin_PoseMatrix1 T (13)

[0019] H2=A2*NewOrigin_PoseMatrix2 T (14)

[0020] Among them, A1 is the intrinsic parameter matrix of the first camera calibrated by halcon, and A2 is the intrinsic parameter matrix of the second camera calibrated by halcon;

[0021] Step 5: According to formula (1), the first image and the second image at different positions captured by the first camera and the second camera at the same time are respectively mapped to the corresponding world coordinate system to obtain a mapping result graph;

[0022]

[0023] Where H is the homography matrix; (x, y) represents the coordinates of the image coordinate system, fx and fy are the number of pixels in the x direction and y direction respectively; (u, v) is the coordinate of the midpoint of the pixel coordinate system, (u0, v0) represents the origin in the pixel coordinate system; (X w , Y w , Z w ) is a point in the world coordinate system, and the dot calibration plate is located in the world coordinate system Z w =0; R = R1R2R3 represents the rotation matrix, R1, R2, R3 refer to the rotation matrices obtained by rotating around the X, Y, and Z axes in the world coordinate system respectively; T represents the translation matrix; an arrow above the number 0 represents the zero vector;

[0024] Step 6. Perform grayscale processing on the mapping result image of the second image taken by the second camera, then use the Otsu threshold segmentation method to binarize the grayscale image, obtain the pixel value of the threshold area, and finally convert the origin of the world coordinate system of the second camera into the origin of the world coordinate system where the first image is located, and map the final processing result of the second image taken by the second camera to the image coordinate system of the first image taken by the first camera to complete the image stitching and fusion.

[0025] Furthermore, before step one, the first camera and the second camera are calibrated using halcon respectively.

[0026] Furthermore, the calibration includes:

[0027] 1) With the help of the dot calibration plate, the first camera and the second camera respectively collect a number of images with the calibration plate in different directions and positions;

[0028] 2) Load the calibration image in halcon, and use the calibration tool provided by halcon to solve the intrinsic parameter matrix, distortion parameters and 3D pose of the first and second cameras respectively.

[0029] Furthermore, about 20 images with the calibration plate in different directions and positions are collected by the first camera and the second camera respectively.

[0030] Furthermore, the image stitching method includes pictures taken by at least two cameras.

[0031] The present invention first uses halcon for calibration to obtain internal parameters and 3D pose, then performs coordinate system mapping to eliminate the error caused by the thickness of the calibration plate, obtains the final external parameter matrix, and finally uses the internal and external parameters to calculate the final homography matrix. In addition, the present invention translates the origin of the coordinate system where the calibrated camera 3D pose is located to the upper left corner of the first picture taken by the first camera, so that the two pictures taken by the first camera and the second camera at the same time and at different angles can be mapped in the same world coordinate system.

[0032] The present invention eliminates the influence of the thickness of the calibration plate and the thickness of different keyboards (uneven placement) on the image stitching and fusion accuracy, can better perform image alignment, the stitching image has higher accuracy, and the stitching result has no ghosting. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a schematic diagram of rotating about the Z axis by an angle of θ;

[0034] Figure 2 The original image taken by camera 1 (left) and its mapping result image (right);

[0035] Figure 3 The original image taken by camera 2 (left) and its mapping result image (right);

[0036] Figure 4 The result of stitching the laptop computer image with the dot calibration plate.

[0037] Figure 5 This is a splicing effect diagram of the present invention;

[0038] Figure 6 In the figure, a is the stitching result image obtained by mapping the homography matrix directly obtained by halocn using the dot calibration plate; b is the stitching result image obtained by extracting feature points using the SIFT algorithm; c is the stitching result image obtained by extracting feature points using the SURF algorithm; d is the stitching result image obtained by extracting feature points using the ORB algorithm. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. 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.

[0040] The present invention will be further described below in conjunction with embodiments:

[0041] In an embodiment of the present invention, two industrial cameras of the "Hikvision" brand with different resolutions are used to photograph laptop computers on a production line. The model of the first camera is HK-1614-10MP with a resolution of 4096*3000, and the model of the second camera is MVL-HF0828M-6MP with a resolution of 2448*2048.

[0042] There are four different coordinate systems involved in the embodiments of the present invention: a world coordinate system, a camera coordinate system, an image coordinate system, and a pixel coordinate system.

[0043] 1. Homography Matrix

[0044] The homography matrix is ​​a matrix used to describe the position mapping relationship between an object in the world coordinate system and the pixel coordinate system.

[0045] The ultimate goal of image matching in image stitching is to obtain the homography matrix, and then perform perspective transformation to convert images taken at different angles to the same viewing angle. The mapping relationship between the pixel coordinate system and the world coordinate system is shown in formula (1):

[0046]

[0047] Among them, H is the homography matrix, including the camera's intrinsic parameter matrix A and extrinsic parameter matrix B, where the intrinsic parameter belongs to the inherent properties of the camera. (x, y) represents the coordinates of the image coordinate system, (u, v) is the coordinate of the point in the pixel coordinate system, fx and fy are the number of pixels in the x direction and y direction respectively, (u0, v0) represents the origin in the pixel coordinate system, (X w , Y w , Z w ) is a point in the world coordinate system (assuming that the calibration plate is located at the Z w =0); R = R1R2R3 represents the rotation matrix, R1, R2, R3 refer to the rotation matrices obtained by rotating around the X, Y, and Z axes in the world coordinate system, respectively, and T represents the translation matrix. An arrow above the number 0 represents a zero vector.

[0048] The following is the process of solving the homography matrix in the present invention.

[0049] 1. Camera calibration

[0050] The purpose of camera calibration is to determine the values ​​of some parameters of the camera. These parameters can establish the mapping relationship between the world coordinate system determined by the calibration plate and the camera image coordinate system.

[0051] 1. Dot calibration plate

[0052] Nowadays, most of the calibration of camera intrinsic parameters is obtained by Zhang Zhengyou calibration method. Zhang Zhengyou calibration method uses a checkerboard calibration plate, and it must be ensured that the entire calibration plate must be in the image, which also adds difficulty to the calibration process, because the edge information of the checkerboard is very important. They properly constrain the distortion of the lens, and any lack of it will lead to reduced accuracy.

[0053] In the study of image processing, circles can be detected as "spots" in the image. Applying some simple conditions on these binary spot regions, such as area, roundness, convexity, etc., can filter out bad feature points from the candidate points. After finding suitable candidates, the regular structure of the features is used again to identify and filter the pattern. In addition, because all pixels outside the circle can be used to reduce the impact of image noise, the determination of the circle can be very accurate.

[0054] Therefore, the center fitting degree of the solid circle on the dot calibration plate is high, so that the calibration accuracy of the dot calibration plate is higher. The present invention selects the dot calibration plate to calibrate the camera internal parameters.

[0055] 2. Camera intrinsic calibration

[0056] Due to the influence of the camera itself and the lens, the image captured by the camera is often distorted. In order to remove the distortion, the intrinsic parameters of the camera need to be calibrated to obtain the intrinsic parameter matrix.

[0057] Step 1

[0058] From the pixel coordinate system to the image coordinate system, the mapping relationship is shown in formula (2):

[0059]

[0060] Where (x, y) represents the coordinates of the image coordinate system, (u, v) represents the coordinates of the pixel coordinate system, and (u0, v0) represents the origin of the pixel coordinate system. dx and dy represent the number of units a pixel occupies in the x and y directions, respectively.

[0061] Step 2

[0062] The mapping relationship between the image coordinate system and the camera coordinate system (intrinsic parameter transformation) is shown in formula (3):

[0063]

[0064] Among them, (X c , Y c , Z c ) is a point in the camera coordinate system. f is the focal length of the camera.

[0065] 3. Camera extrinsic calibration

[0066] The camera extrinsic parameters determine the position and orientation of the camera in a certain three-dimensional space. Mapping the world coordinate system to the camera coordinate system through rotation and translation is a transformation from three-dimensional space to three-dimensional space. The camera extrinsic parameter matrix can be understood as a rotation and translation matrix. As shown in formula (4):

[0067]

[0068] Among them, (X c , Y c , Z c ) is a point in the camera coordinate system. (X w , Y w , Z w ) represents the coordinates of the point in the world coordinate system, R=R1r2R3 represents the rotation matrix, R1, R2, R3 refer to the matrices obtained by rotating around the Z, X, and Y axes respectively, and T represents the translation matrix.

[0069] Specifically, rotate about the Z axis by an angle of θ ( Figure 1 ) is expressed as formula (5):

[0070]

[0071] (x', y', z') are the coordinates after rotation, the same below.

[0072] Rotate around the X axis The matrix expression of the angle is formula (6):

[0073]

[0074] The matrix expression of the rotation angle ω around the Y axis is as follows:

[0075]

[0076] The present invention uses the calibration tool provided by halcon, and with the help of the dot calibration plate, collects about 20 images with the calibration plate in different directions and positions through the first camera and the second camera respectively, loads the calibration pictures in halcon, automatically detects the dots in the pictures, and uses the spatial position relationship between the calibration plane space dots and the corresponding image dots to establish the equation group such as formula (2)-(7), and respectively solves the internal parameter matrix, distortion parameters and 3D poses of the two cameras in the specific embodiment. As shown in Table 1 and Table 2:

[0077] Table 1. Calibration results of the first camera intrinsic parameters

[0078]

[0079] Table 2 Second camera intrinsic calibration results

[0080]

[0081] Among them, the solution of camera distortion parameters is a built-in function of halcon, including 3 radial distortion parameters and 2 tangential distortion parameters.

[0082] (II) Determine the conversion mapping between coordinate systems

[0083] Image stitching can only be performed in the same coordinate system, so the two pictures taken by the first camera and the second camera from different angles need to be mapped to the same world coordinate system.

[0084] The existing technologies all directly use the calibrated 3D pose PoseMatrix to perform conversion mapping between coordinate systems.

[0085] However, the calibrated 3D pose is mapped from a group of two-dimensional coordinate points. The Z axis defaults to 0 (the calibration plate is located in the plane of Z=0), and the dot calibration plate in actual applications has thickness. Therefore, the calibrated 3D pose needs to be converted and mapped between coordinate systems to eliminate the influence of the calibration plate itself on the calibration result.

[0086] First, the points (image coordinate system) on the first image taken by the first camera are mapped to the corresponding world coordinate system, and then the 3D pose of the first camera obtained by halcon calibration is translated. Specifically, the origin of the coordinate system where the 3D pose of the first camera is located is translated to the upper left corner of the world coordinate system where the pixel point of the first image is located. At the same time, the thickness of the dot calibration plate is taken into account to obtain a new 3D pose NewOrigin_PoseMatrix1, as shown in formula (8):

[0087]

[0088] Where Dx and Dy are the coordinates of the upper left corner pixel of the first image in the world coordinate system, and Dz is the thickness of the calibration plate.

[0089] For the second camera, the points on the second image taken by it are first mapped to the corresponding world coordinate system, and then the origin of the world coordinate system of the second camera is converted into the origin of the world coordinate system of the first image. Then, the 3D pose of the second camera obtained by halcon calibration is translated. Specifically, the origin of the coordinate system where the 3D pose of the calibrated second camera is located is translated to the upper left corner of the world coordinate system where the pixel point of the first image is located. At the same time, the thickness of the dot calibration plate is considered, so that the mapped second image and the first image are located in the same world coordinate system, and a new 3D pose NewOrigin_PoseMatrix2 is obtained, as shown in formula (9):

[0090]

[0091] (III) Obtaining the homography matrix

[0092] Each column vector of the transformation matrix R from the world coordinate system to the camera coordinate system represents the direction of each coordinate axis of the world coordinate system in the camera coordinate system, so the external parameter matrix of the camera can be obtained by inverting the 3D pose.

[0093] The following is the calculation formula of the external parameter matrix of the first camera (10):

[0094]

[0095] Where t represents the vector representation of the origin of the world coordinate system in the camera coordinate system. c is an orthogonal matrix, C is a vector that describes the position of the camera's visual center in the world coordinate system, I represents a 3*3 identity matrix, and the superscript T is the matrix transpose operator symbol.

[0096] The transpose of an orthogonal matrix is ​​equal to its inverse, and the inverse of a translation matrix is ​​its negative translation vector. Therefore, from formula (10), we can obtain the external parameter matrix formula (11) of camera 1 after mapping:

[0097] R1=NewOrigin_PoseMatrix1 T (11)

[0098] Similarly, the external parameter matrix formula (12) of the second camera after mapping can be obtained:

[0099] R2=NewOrigin_PoseMatrix2 T (12)

[0100] Thus, the first camera and the second camera are respectively mapped to the world coordinate system where the pixels of the first image taken by the first camera are located, and the homography matrix formulas (13) and (14) of the thickness of the dot calibration plate are corrected at the same time:

[0101] H1=A1*NewOrigin_PoseMatrix1 T (13)

[0102] H2=A2*NewOrigin_PoseMatrix2 T (14)

[0103] Among them, A1 is the intrinsic parameter matrix of the first camera calibrated by halcon, and A2 is the intrinsic parameter matrix of the second camera calibrated by halcon. For specific verification data, please refer to Table 1 and Table 2 above.

[0104] 2. Image stitching and fusion

[0105] After obtaining the homography matrix of the first camera and the second camera, the images captured by the first camera and the second camera at different positions at the same time are mapped according to formula (1), the data in Table 1, the data in Table 2, formula (13), and formula (14), respectively. The first image taken by the first camera and the second image taken by the second camera are respectively mapped to the corresponding world coordinate system. The solution process is completed by using halcon in the existing technology, and the mapping result is shown in the figure below. Figure 2 and Figure 3 .

[0106] After obtaining the two mapping result images, the mapping result image of the second image of the second camera is gray-scaled, and then the gray-scale image is binarized using the Otsu threshold segmentation method to obtain the pixel value of the threshold area. Finally, the origin of the world coordinate system of the second camera is converted into the origin of the world coordinate system of the first image, and the final processing result of the second image of the second camera is mapped to the image coordinate system of the first image taken by the first camera to complete the image stitching and fusion. The result is as follows: Figure 4 shown.

[0107] Comparative Verification

[0108] In another example, see the attached Figure 5 and attached Figure 6 It can be seen that the stitching algorithm proposed in the present invention is more accurate than the method of directly using the dots on the dot calibration plate to obtain the homography matrix, and the stitching image obtained by using the SIFT, SURF, and ORB algorithms.

[0109] Table 3. Algorithm performance comparison

[0110]

[0111] It can be seen from Table 3 that the time required for the stitching algorithm proposed in the present invention is much less than that of SIFT, SURF, ORB and other algorithms, and the accuracy is much higher than that of SIFT, SURF, ORB and other algorithms. The time required for the stitching algorithm of the present invention and the method of directly using the calibration plate to obtain the homography matrix is ​​roughly the same as that of the present algorithm, but the accuracy of the stitching algorithm of the present invention is much higher than that of the method of directly using the calibration plate to obtain the homography matrix.

[0112] In summary, the image stitching method based on halcon of the present invention translates the origin in the coordinate system where the 3D pose of the first camera obtained by calibration and the 3D pose of the second camera obtained by calibration are located to the upper left corner of the world coordinate system where the pixel point of the first picture taken by the first camera is located, and the thickness of the dot calibration plate is considered at the same time, and a new 3D pose is obtained, and image stitching and fusion are performed in the same world coordinate system, eliminating the influence of the thickness of the calibration plate and the thickness of different keyboards (uneven placement) on the accuracy of image stitching and fusion. The method proposed by the present invention can better perform image alignment, the precision of the stitched image is high, and the stitching result has no ghosting.

[0113] This method can be extended from stitching two images to stitching images from multiple cameras. In addition to being used in notebook automated detection, it is also applicable to multiple fields such as unmanned driving, and has practical industrial application prospects and significance.

[0114] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

[0115] The present invention is not limited to the above description of the embodiments. Any improvements and modifications made by those skilled in the art based on the contents disclosed by the present invention without creative work should be within the protection scope of the present invention.

Claims

1. A halcon-based image stitching method, characterized in that: The steps include: Step 1: Map the points on the first image taken by the first camera to the corresponding world coordinate system, and then translate the origin of the coordinate system where the 3D pose of the first camera obtained by halcon calibration is located to the upper left corner of the world coordinate system where the pixel point of the first image is located, while taking into account the thickness of the dot calibration plate, and obtain a new 3D pose NewOrigin_PoseMatrix1, as shown in formula (8): NewOrigin_PoseMatrix1=PoseMatrix1 (8) Among them, PoseMatrix1 is the 3D pose of the first camera obtained by halcon calibration; Dx and Dy are the coordinates of the upper left corner pixel of the first image in the world coordinate system; Dz is the thickness of the calibration plate; Step 2: First map the points on the second image taken by the second camera to the corresponding world coordinate system, then convert the origin of the world coordinate system of the second camera into the origin of the world coordinate system of the first image, and then translate the origin of the coordinate system where the 3D pose of the second camera obtained by halcon calibration is located to the upper left corner of the world coordinate system where the pixel point of the first image is located, and consider the thickness of the dot calibration plate at the same time, and obtain a new 3D pose NewOrigin_PoseMatrix2, as shown in formula (9): NewOrigin_PoseMatrix2=PoseMatrix2 (9) Among them, PoseMatrix2 is the 3D pose of the second camera obtained by halcon calibration; Step 3: According to formula (8) and formula (9), the external parameter matrix formulas (11) and (12) of the first camera and the second camera are calculated respectively: R1= (11) R2= (12) Where R1 represents the extrinsic matrix of the first camera, and R2 represents the extrinsic matrix of the second camera; Step 4: Calculate the homography matrices H1 and H2 of the first camera and the second camera respectively mapped to the world coordinate system where the pixels of the first picture taken by the first camera are located, and correct the thickness of the dot calibration plate at the same time: H1=A1* (13) <h2 style=";text-align:left;direction:ltr">H2=A2*<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (14) Among them, A1 is the intrinsic parameter matrix of the first camera calibrated by halcon, and A2 is the intrinsic parameter matrix of the second camera calibrated by halcon; Step 5: According to formula (1), the first image and the second image captured at different positions by the first camera and the second camera at the same time are respectively mapped to the corresponding world coordinate system to obtain a mapping result map; = =AB =H (1) Among them, H is the homography matrix; (x, y) represents the coordinates of the image coordinate system, fx and fy are the number of pixels in the x direction and y direction respectively; (u, v) is the coordinate of the midpoint of the pixel coordinate system, ( , ) represents the origin in the pixel coordinate system; ( , , ) is a point in the world coordinate system, and the dot calibration plate is located in the world coordinate system =0 plane; R= represents the rotation matrix, , , They refer to the rotation matrices obtained by rotating around the X, Y, and Z axes in the world coordinate system respectively; T represents the translation matrix; an arrow above the number 0 represents the zero vector; Step 6. Perform grayscale processing on the mapping result image of the second image taken by the second camera, then use the Otsu threshold segmentation method to binarize the grayscale image, obtain the pixel value of the threshold area, and finally convert the origin of the world coordinate system of the second camera into the origin of the world coordinate system where the first image is located, and map the final processing result of the second image taken by the second camera to the image coordinate system of the first image taken by the first camera to complete the image stitching and fusion.

2. According to claim 1, a halcon-based image stitching method is characterized in that: Before step 1, halcon is used to calibrate the first camera and the second camera respectively.

3. The image stitching method based on halcon according to claim 2 is characterized in that: The calibration includes: 1) With the help of the dot calibration plate, the first camera and the second camera respectively collect several images with the calibration plate in different directions and positions; 2) Load the calibration image in halcon, and use the calibration tool provided by halcon to solve the intrinsic parameter matrix, distortion parameters and 3D pose of the first and second cameras respectively.

4. The image stitching method based on halcon according to claim 3 is characterized in that: 20 images with calibration plates in different directions and positions are collected by the first camera and the second camera respectively.

5. The image stitching method based on halcon according to claim 3 is characterized in that: The image stitching method includes pictures taken by at least two cameras.

Citation Information

Patent Citations

  • Method for improving camera calibration accuracy by using multi-plane calibration board

    CN111429532A

  • High-precision hand-eye calibration method for garbage sorting robot

    CN113506349A