Image stitching method, image stitching system and computer readable storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LINGHU INTELLIGENT CO LTD
- Filing Date
- 2022-07-25
- Publication Date
- 2026-07-24
Smart Images

Figure CN115345778B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to an image stitching method, an image stitching system, and a computer-readable storage medium. Background Technology
[0002] Currently, 3C (China Compulsory Certification) industrial testing systems generally require the system to perform testing at high speed and high precision. Relatively speaking, the larger the measurement range of the measuring sensor, the lower the precision, and the smaller the measurement range, the higher the precision. In order to meet the high-precision testing requirements of the testing system, a high-precision sensor with a small stroke is needed as the main measurement tool. The primary problem to be solved is how to quickly stitch together multiple images of a scene.
[0003] In existing image stitching technologies, such as CN 114418861 A (authorization announcement date: April 29, 2022), entitled "A Camera Image Stitching Processing Method and System," the acquired images need to have good imaging effects and overlapping areas. However, in front-line production environments, there may be significant acquisition deviations and inconsistent imaging, leading to stitching errors. Similarly, in CN 114266701 A (authorization announcement date: April 1, 2022), entitled "A Wind Turbine Blade Image Stitching Method and Device," the method requires good imaging effects and prominent feature points, which is relatively difficult to implement in industrial environments. Therefore, existing image stitching technologies have many limitations on the acquired images, making it difficult to achieve accurate and rapid stitching. Summary of the Invention
[0004] The main objective of this invention is to provide an image stitching method, an image stitching system, and a computer-readable storage medium. It aims to solve the problem that image stitching technology has many limitations on the acquired images, making it difficult to achieve accurate and rapid stitching.
[0005] To achieve the above objectives, the present invention provides an image stitching method, which is applied to an image stitching system. The image stitching system includes a servo device and an image stitching device connected in sequence. The image stitching method includes the following steps:
[0006] The drive information of the input servo device and the control information of the image stitching device are acquired respectively.
[0007] The servo device is controlled to drive the image stitching device to scan the object under test according to the drive information, thereby obtaining all stitched images of the object under test.
[0008] The image stitching device is controlled to fuse all the images to be stitched together to obtain the target stitched image.
[0009] Optionally, the image stitching device includes an acquisition device; the driving information includes the number of unit pulse strokes and the number of pulses; the control information includes the scan width and the offset distance.
[0010] The steps of acquiring the driving information of the input servo device and the control information of the image stitching device respectively include:
[0011] The number of unit pulse strokes and the number of pulses of the servo device are obtained, as well as the scan width and offset distance of the acquisition device are obtained, wherein the offset distance is less than the scan width.
[0012] Optionally, the image stitching device further includes a computing device;
[0013] The step of controlling the servo device to drive the image stitching device to scan the object under test according to the driving information, and obtaining all images of the object under test to be stitched together, includes:
[0014] The servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the unit pulse stroke number and the number of pulses with the scan width and the offset distance, so as to obtain a single travel image of the object under test;
[0015] The control computing device performs three-dimensional reconstruction on the single travel image to obtain point cloud data of the object under test in the single travel direction;
[0016] The control computing device processes the point cloud data to obtain a stitched image corresponding to the object under test;
[0017] Obtain the width of the object to be tested, and perform the following steps based on the width: control the servo device to drive the acquisition device to scan the object to be tested in a single travel direction according to the unit pulse stroke number and the pulse number with the scanning width and the offset distance, to obtain a single travel image of the object to be tested, until all images of the object to be tested to be stitched are obtained.
[0018] Optionally, the step of the control computing device performing cropping processing on the point cloud data to obtain a stitched image corresponding to the object under test includes:
[0019] The control computing device obtains the length of the image to be stitched based on the number of pulses and the number of strokes per unit pulse.
[0020] The point cloud data is truncated according to the specified length to obtain the image to be stitched together.
[0021] Optionally, the step of obtaining the width of the object to be tested and performing the following steps based on the width: controlling the servo device to drive the acquisition device to scan the object to be tested in a single travel direction according to the number of unit pulse strokes and the number of pulses with the scanning width and the offset distance, to obtain a single travel image of the object to be tested, until all images of the object to be tested to be stitched are obtained, includes:
[0022] Obtain the width of the object to be tested, and determine whether the width is greater than the scanning width;
[0023] If the width is greater than the scanning width, then the number of scans, the scanning direction, and the lateral offset distance of the acquisition device are set according to the width and the scanning width;
[0024] Based on the number of scans, the scanning direction, and the lateral offset distance, the following steps are performed: the servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the number of unit pulse strokes and the number of pulses, with the scanning width and the offset distance, to obtain a single travel image of the object under test, until all images of the object under test to be stitched are obtained.
[0025] Optionally, after the step of obtaining the width of the object to be measured and determining whether the width is greater than the scanning width, the method further includes:
[0026] If the width is less than the scanning width, then the number of scans by the acquisition device is set to 0.
[0027] Optionally, the step of controlling the image stitching device to fuse all the images to be stitched to obtain the target stitched image includes:
[0028] The actual running distance of the acquisition device during each scanning process is obtained, and the image to be stitched is cropped according to the actual running distance obtained each time to obtain a number of first target stitched images;
[0029] Several first target stitched images are fused together to obtain a target stitched image.
[0030] Optionally, the step of fusing several of the first target stitched images to obtain the target stitched image includes:
[0031] Obtain adjacent points between two adjacent first target images from a plurality of first target stitched images;
[0032] Based on the proximity points, either of the two adjacent first target images is shifted as a whole to obtain the target stitched image.
[0033] In addition, to achieve the above objectives, the present invention also provides an image stitching system, which includes a servo device, an image stitching device, a memory, a processor, and an image stitching program stored in the memory and executable on the processor. When the image stitching program is executed by the processor, it implements the steps of the image stitching method described above.
[0034] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing an image stitching program, which, when executed by a processor, implements the steps of the image stitching method described above.
[0035] This invention proposes an image stitching method, an image stitching system, and a computer-readable storage medium. The image stitching method is applied to an image stitching system, which includes a servo device and an image stitching device connected in sequence. The image stitching method includes the following steps: acquiring drive information from the servo device and control information from the image stitching device; controlling the servo device to drive the image stitching device to scan the object under test according to the control information, thereby obtaining all stitched images of the object under test; and controlling the image stitching device to fuse all the stitched images to obtain a target stitched image. Through this method, this invention adds a hardware mechanism, namely the servo device, compared to traditional image stitching technologies, ensuring that the stitching purpose can be achieved within the stroke range of the servo device. Because of the control of hardware encoding technology, this invention controls the acquisition device to acquire images based on the actual pulses of the servo device, enabling multi-image stitching of moving objects or large scene objects, and completing the stitching task at an extremely high speed. This solves the problem in traditional image stitching technologies where there are many limitations on the acquired images, making accurate and rapid stitching difficult. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention;
[0037] Figure 2 This is a flowchart illustrating an embodiment of the image stitching method of the present invention;
[0038] Figure 3 This is a schematic diagram of the image stitching method of the present invention before image stitching;
[0039] Figure 4 This is a schematic diagram of the image stitching method of the present invention after image stitching.
[0040] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0042] like Figure 1 As shown, Figure 1 This is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiments of the present invention.
[0043] In this embodiment of the invention, the terminal can be an image stitching system.
[0044] like Figure 1 As shown, the terminal may include: a processor 1001, such as a CPU; a communication bus 1002; a user interface 1003; a DVI interface 1004; a USB interface 1005; and a memory 1006. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The DVI interface 1004 may optionally include a standard wired interface for connecting to other external devices via a DVI cable. The USB interface 1005 may optionally include a standard wired interface for connecting to other external devices via a USB cable. The memory 1006 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1006 may also be a storage device independent of the aforementioned processor 1001.
[0045] Optionally, the terminal may also include audio circuitry, etc., which will not be elaborated here.
[0046] Those skilled in the art will understand that Figure 1 The terminal structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0047] like Figure 1 As shown, the memory 1006, which serves as a computer storage medium, may include an operating system, a DVI interface module, a USB interface module, a user interface module, and an image stitching program.
[0048] exist Figure 1In the terminal shown, the DVI interface 1004 is mainly used to connect to external devices and communicate with them; the USB interface 1005 is mainly used to connect to external devices and communicate with them; the user interface 1003 is mainly used to connect to clients and communicate with them; and the processor 1001 can be used to call the image stitching program stored in the memory 1006 and perform the following operations:
[0049] The drive information of the input servo device and the control information of the image stitching device are acquired respectively.
[0050] The servo device is controlled to drive the image stitching device to scan the object under test according to the drive information, thereby obtaining all stitched images of the object under test.
[0051] The image stitching device is controlled to fuse all the images to be stitched together to obtain the target stitched image.
[0052] Furthermore, the processor 1001 can call the image stitching program stored in the memory 1006 and also perform the following operations:
[0053] The number of unit pulse strokes and the number of pulses of the servo device are obtained, as well as the scan width and offset distance of the acquisition device are obtained, wherein the offset distance is less than the scan width.
[0054] Furthermore, the processor 1001 can call the image stitching program stored in the memory 1006 and also perform the following operations:
[0055] The servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the unit pulse stroke number and the number of pulses with the scan width and the offset distance, so as to obtain a single travel image of the object under test;
[0056] The control computing device performs three-dimensional reconstruction on the single travel image to obtain point cloud data of the object under test in the single travel direction;
[0057] The control computing device processes the point cloud data to obtain a stitched image corresponding to the object under test;
[0058] Obtain the width of the object to be tested, and perform the following steps based on the width: control the servo device to drive the acquisition device to scan the object to be tested in a single travel direction according to the unit pulse stroke number and the pulse number with the scanning width and the offset distance, to obtain a single travel image of the object to be tested, until all images of the object to be tested to be stitched are obtained.
[0059] Furthermore, the processor 1001 can call the image stitching program stored in the memory 1006 and also perform the following operations:
[0060] The control computing device obtains the length of the image to be stitched based on the number of pulses and the number of strokes per unit pulse.
[0061] The point cloud data is truncated according to the specified length to obtain the image to be stitched together.
[0062] Furthermore, the processor 1001 can call the image stitching program stored in the memory 1006 and also perform the following operations:
[0063] Obtain the width of the object to be tested, and determine whether the width is greater than the scanning width;
[0064] If the width is greater than the scanning width, then the number of scans, the scanning direction, and the lateral offset distance of the acquisition device are set according to the width and the scanning width;
[0065] Based on the number of scans, the scanning direction, and the lateral offset distance, the following steps are performed: the servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the number of unit pulse strokes and the number of pulses, with the scanning width and the offset distance, to obtain a single travel image of the object under test, until all images of the object under test to be stitched are obtained.
[0066] Furthermore, the processor 1001 can call the image stitching program stored in the memory 1006 and also perform the following operations:
[0067] If the width is less than the scanning width, then the number of scans by the acquisition device is set to 0.
[0068] Furthermore, the processor 1001 can call the image stitching program stored in the memory 1006 and also perform the following operations:
[0069] The actual running distance of the acquisition device during each scanning process is obtained, and the image to be stitched is cropped according to the actual running distance obtained each time to obtain a number of first target stitched images;
[0070] Several first target stitched images are fused together to obtain a target stitched image.
[0071] Furthermore, the processor 1001 can call the image stitching program stored in the memory 1006 and also perform the following operations:
[0072] Obtain adjacent points between two adjacent first target images from a plurality of first target stitched images;
[0073] Based on the proximity points, either of the two adjacent first target images is shifted as a whole to obtain the target stitched image.
[0074] The specific embodiments of the image stitching system of the present invention are basically the same as the embodiments of the image stitching program described below, and will not be repeated here.
[0075] Please see Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the image stitching method of the present invention. The image stitching method provided in this embodiment includes the following steps:
[0076] Step S10: Obtain the drive information of the input servo device and the control information of the image stitching device respectively;
[0077] In this embodiment, the image stitching method is applied to an image stitching system, which includes a servo device and an image stitching device connected in sequence. The image stitching device includes an acquisition device and a computing device. The servo device, acquisition device, and computing device are connected in sequence, and the servo device is also connected to the computing device. Specifically, the servo device is a server, the acquisition device is a line scan camera, and the computing device is a computer terminal. For ease of understanding, the above devices will be described in the following embodiments.
[0078] In one embodiment, step S10 further includes:
[0079] Step A11: Obtain the number of unit pulse strokes and the number of pulses of the servo device, and obtain the scanning width and offset distance of the acquisition device, wherein the offset distance is less than the scanning width;
[0080] In this embodiment, the driving information includes the number of unit pulse strokes and the number of pulses of the server. The number of unit pulse strokes is the distance the server can move within a unit pulse, i.e., the stroke distance corresponding to each pulse. The number of pulses is the total number of pulses emitted by the server. Both of these data can be set in the server. The scanning width is the overall width that the line scan camera can scan in this scan. The offset distance is the stroke within the scanning width, used to prevent invalid areas from appearing on both sides of the scan due to the limited sensing range of the sensors in the line scan camera. Both the scanning width and the offset distance can be set in the line scan camera.
[0081] Step S20: Control the servo device to drive the image stitching device to perform image scanning on the object under test according to the drive information, so as to obtain all stitched images of the object under test.
[0082] In one embodiment, step S20 further includes:
[0083] Step A21: Control the servo device to drive the acquisition device to scan the object under test in a single travel direction according to the unit pulse stroke number and the number of pulses with the scanning width and the offset distance, so as to obtain a single travel image of the object under test;
[0084] In this embodiment, since the server drives the line scan camera to scan the object under test, it can only scan a portion of the area in one direction until the entire area is scanned. A single-path scan refers to scanning in a single direction. During scanning, the server controls the computing device to perform three-dimensional reconstruction of the single-path image based on the preset unit pulse travel number and pulse number, and step A22, to obtain the point cloud data of the object under test in the single-path direction.
[0085] In this embodiment, the point cloud data refers to the point-to-point recording of a single-movement image of the object under test on a three-dimensional coordinate system. Triangulation can be used to reconstruct the three-dimensional structure of the obtained single-movement image. Triangulation, in trigonometry and geometry, is a method of measuring the distance to a target by measuring the angle between a target point and a known endpoint of a fixed baseline. In this embodiment, each point in the single-movement image can be obtained using triangulation, and then the single-movement image can be reconstructed in three dimensions.
[0086] Step A23: Control the computing device to perform cropping processing on the point cloud data to obtain an image to be stitched corresponding to the object under test;
[0087] In this embodiment, step A23 further includes:
[0088] Step A231: The control computing device obtains the length of the image to be stitched based on the number of pulses and the number of unit pulse strokes;
[0089] Step A232: The point cloud data is truncated according to the length to obtain the image to be stitched;
[0090] In this embodiment, the length of the image to be stitched is the length scanned by the line scan camera, which can be calculated based on the number of pulses and the number of strokes per unit pulse. Specifically,
[0091]
[0092] Where per image height is the length of the image to be stitched, number is the number of pulses, and per pulse is the number of pulse strokes per unit.
[0093] The image to be stitched is cropped according to the specified length to meet preset requirements. These preset requirements can be set based on the actual needs of the object under test. For example, if an image of a certain part of the object under test is needed, then only that part needs to be cropped. It should be noted that, to ensure the accuracy of the image to be stitched, it needs to be cropped within the specified length to prevent invalid images from appearing.
[0094] Step A24: Obtain the width of the object to be tested, and perform step A21 according to the width until all images of the object to be tested are obtained.
[0095] In one embodiment, step A24 further includes:
[0096] Step A241: Obtain the width of the object to be measured, and determine whether the width is greater than the scanning width;
[0097] Step A242: If the width is greater than the scanning width, then set the number of scans, scanning direction, and lateral offset distance of the acquisition device according to the width and the scanning width;
[0098] In this embodiment, since the present invention performs image stitching on a test object with a relatively large width, if the actual width of the test object is smaller than the scanning width, image stitching is not required. If the actual width of the test object is larger than the scanning width, the number of scans required by the line scanner, as well as the scanning direction and the lateral offset distance, need to be calculated based on the actual width and the scanning width. The lateral offset distance is the distance the line scanner needs to be moved to another area for scanning after each scan; this lateral offset distance is the distance the line scanner needs to move.
[0099] Step A243: Based on the number of scans, the scanning direction, and the lateral offset distance, execute step A21 until all images of the object to be tested are obtained;
[0100] In this embodiment, after the first scan of the object to be tested, the object is scanned multiple times sequentially according to the calculated number of scans, scanning direction, and lateral offset distance until the entire object is scanned, and all images to be stitched are obtained corresponding to the number of scans. These images are then sequentially and orderly stored in a computing device connected to the acquisition device for subsequent fusion operations.
[0101] Step A244: If the width is less than the scanning width, then set the number of scans of the acquisition device to 0;
[0102] If the actual width of the object being measured is smaller than the scanning width, it means that an image of the object can be obtained with only one scan, and the number of subsequent scans can be set to 0. This stops the scanning process.
[0103] This invention performs real-time processing on the encoding of the acquisition device. Since the offset and offset direction of the acquisition device are known, the image only needs to be stitched together according to the specified direction and offset, reducing the process of finding feature points and thus achieving real-time speed.
[0104] Step S30: Control the image stitching device to fuse all the images to be stitched together to obtain the target stitched image.
[0105] In one embodiment, step S30 further includes:
[0106] Step A31: Obtain the actual running distance of the acquisition device during each scanning process, and extract the image to be stitched according to the actual running distance obtained each time to obtain several first target stitched images;
[0107] In this embodiment, the actual running distance refers to the lateral and longitudinal movement distances of the line scan camera during the scanning process. The lateral movement distance is the distance the line scan camera moves to an adjacent area after completing one scan, which is the aforementioned lateral offset distance. The longitudinal movement distance is the distance the line scan camera moves during one scan. Since the image to be stitched is a three-dimensional image, i.e., it has X, Y, and Z directions, the lateral movement distance can be defined as the X direction, and the longitudinal movement distance as the Y direction. Based on the actual running distance during each scan, the image to be stitched is sequentially cropped each time to obtain the first target stitched image corresponding to the number of scans.
[0108] Step A32: Fuse several of the first target stitched images to obtain the target stitched image.
[0109] In one embodiment, step A32 further includes:
[0110] Step A321: Obtain adjacent points between two adjacent first target images in a plurality of first target stitched images;
[0111] In this embodiment, since the line scan camera scans the object to be measured sequentially, two adjacent first target images can be obtained according to the scanning order. The adjacent point is the coordinate point that is closest to the other two images to be stitched in the Z direction, and is not located in the overlapping area.
[0112] Step A322: Based on the adjacent points, perform an overall offset on any one of the two adjacent first target images to obtain the target stitched image.
[0113] In this embodiment, after obtaining the nearest neighbor points, any one of the two adjacent first target images can be shifted towards the other based on these nearest neighbor points, thus completing the fusion of the two first target images. Therefore, all images to be stitched can be fused along the x, y, and z dimensions. It should be noted that since the scanning process is based on the scan width and offset distance, under the condition of the offset distance, adjacent images to be stitched will have overlapping areas. Therefore, the width of the final fused target stitched image is...
[0114]
[0115] Wherein, full image width is the width of the target stitched image, scan number is the number of scans, perscan width is the scan width, and offset1 and offset2 are the offset distances.
[0116] The above formula can be used to eliminate overlapping areas and achieve accurate image fusion.
[0117] In addition, to ensure the feasibility of this invention, please refer to [link / reference needed]. Figure 3 and Figure 4 , Figure 3 This is a schematic diagram of the object to be tested before assembly. Figure 4 This is a schematic diagram of the assembled parts. Figure 3 and Figure 4 As can be seen, the solution of the present invention accurately achieves image stitching.
[0118] This invention proposes an image stitching method applied to an image stitching system. The image stitching system includes a servo device and an image stitching device connected sequentially. The image stitching method includes the following steps: acquiring drive information from the servo device and control information from the image stitching device; controlling the servo device to drive the image stitching device to scan the object under test according to the control information, obtaining all stitched images of the object under test; and controlling the image stitching device to fuse all the stitched images to obtain a target stitched image. Through this method, compared to traditional image stitching technologies, this invention adds a hardware mechanism, namely the servo device, ensuring that the stitching purpose can be achieved within the stroke range of the servo device. Because of the control of hardware encoding technology, this invention controls the acquisition device to acquire images based on the actual pulses of the servo device, realizing multi-image stitching of moving objects or large scene objects, and completing the stitching task at an extremely high speed. This solves the problem in traditional image stitching technologies where there are many limitations on the acquired images, making accurate and rapid stitching difficult.
[0119] Furthermore, embodiments of the present invention also propose a computer-readable storage medium storing an image stitching program, which, when executed by a processor, performs the following operations:
[0120] The drive information of the input servo device and the control information of the image stitching device are acquired respectively.
[0121] The servo device is controlled to drive the image stitching device to scan the object under test according to the drive information, thereby obtaining all stitched images of the object under test.
[0122] The image stitching device is controlled to fuse all the images to be stitched together to obtain the target stitched image.
[0123] Furthermore, when the image stitching program is executed by the processor, it also performs the following operations:
[0124] The number of unit pulse strokes and the number of pulses of the servo device are obtained, as well as the scan width and offset distance of the acquisition device are obtained, wherein the offset distance is less than the scan width.
[0125] Furthermore, when the image stitching program is executed by the processor, it also performs the following operations:
[0126] The servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the unit pulse stroke number and the number of pulses with the scan width and the offset distance, so as to obtain a single travel image of the object under test;
[0127] The control computing device performs three-dimensional reconstruction on the single travel image to obtain point cloud data of the object under test in the single travel direction;
[0128] The control computing device processes the point cloud data to obtain a stitched image corresponding to the object under test;
[0129] Obtain the width of the object to be tested, and perform the following steps based on the width: control the servo device to drive the acquisition device to scan the object to be tested in a single travel direction according to the unit pulse stroke number and the pulse number with the scanning width and the offset distance, to obtain a single travel image of the object to be tested, until all images of the object to be tested to be stitched are obtained.
[0130] Furthermore, when the image stitching program is executed by the processor, it also performs the following operations:
[0131] The control computing device obtains the length of the image to be stitched based on the number of pulses and the number of strokes per unit pulse.
[0132] The point cloud data is truncated according to the specified length to obtain the image to be stitched together.
[0133] Furthermore, when the image stitching program is executed by the processor, it also performs the following operations:
[0134] Obtain the width of the object to be tested, and determine whether the width is greater than the scanning width;
[0135] If the width is greater than the scanning width, then the number of scans, the scanning direction, and the lateral offset distance of the acquisition device are set according to the width and the scanning width;
[0136] Based on the number of scans, the scanning direction, and the lateral offset distance, the following steps are performed: the servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the number of unit pulse strokes and the number of pulses, with the scanning width and the offset distance, to obtain a single travel image of the object under test, until all images of the object under test to be stitched are obtained.
[0137] Furthermore, when the image stitching program is executed by the processor, it also performs the following operations:
[0138] If the width is less than the scanning width, then the number of scans by the acquisition device is set to 0.
[0139] Furthermore, when the image stitching program is executed by the processor, it also performs the following operations:
[0140] The actual running distance of the acquisition device during each scanning process is obtained, and the image to be stitched is cropped according to the actual running distance obtained each time to obtain a number of first target stitched images;
[0141] Several first target stitched images are fused together to obtain a target stitched image.
[0142] Furthermore, when the image stitching program is executed by the processor, it also performs the following operations:
[0143] Obtain adjacent points between two adjacent first target images from a plurality of first target stitched images;
[0144] Based on the proximity points, either of the two adjacent first target images is shifted as a whole to obtain the target stitched image.
[0145] The specific embodiments of the computer-readable storage medium of the present invention are basically the same as the embodiments of the image stitching program described above, and will not be repeated here.
[0146] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0147] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0148] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0149] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. An image stitching method, characterized in that, The image stitching method is applied to an image stitching system, which includes a servo device and an image stitching device connected in sequence. The image stitching device includes an acquisition device and a computing device. The image stitching method includes the following steps: The number of pulse strokes per unit pulse and the number of pulses of the servo device are obtained, as well as the scan width and offset distance of the acquisition device are obtained, wherein the offset distance is less than the scan width; The servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the unit pulse stroke number and the number of pulses with the scan width and the offset distance, so as to obtain a single travel image of the object under test; The computing device is controlled to perform three-dimensional reconstruction on the single travel image to obtain point cloud data of the object under test in the single travel direction; The computing device is controlled to obtain the length of the image to be stitched based on the number of pulses and the number of strokes per unit pulse, wherein the length is obtained according to the following formula: in, For the length, The number of pulses. The unit pulse stroke count; The point cloud data is truncated according to the length to obtain an image to be stitched together corresponding to the object under test; Obtain the width of the object to be tested, and perform the following steps based on the width: control the servo device to drive the acquisition device to scan the object to be tested with the scanning width and the offset distance according to the unit pulse stroke number and the number of pulses in a single travel direction, to obtain a single travel image of the object to be tested, until all images of the object to be tested to be stitched are obtained. The image stitching device is controlled to fuse all images to be stitched together to obtain a target stitched image, wherein the width of the target stitched image is obtained according to the following formula: in, The width is... The number of scans performed by the acquisition device. The scan width is... and The offset distance is the distance mentioned above.
2. The image stitching method as described in claim 1, characterized in that, The step of obtaining the width of the object under test and performing the following steps based on the width: controlling the servo device to drive the acquisition device to scan the object under test with the scanning width and the offset distance according to the unit pulse stroke number and the number of pulses in a single travel direction, to obtain a single travel image of the object under test, until all images of the object under test to be stitched are obtained, includes: Obtain the width of the object to be tested, and determine whether the width is greater than the scanning width; If the width is greater than the scanning width, then the number of scans, the scanning direction, and the lateral offset distance of the acquisition device are set according to the width and the scanning width; Based on the number of scans, the scanning direction, and the lateral offset distance, the following steps are performed: the servo device is controlled to drive the acquisition device to scan the object under test in a single travel direction according to the number of unit pulse strokes and the number of pulses, with the scanning width and the offset distance, to obtain a single travel image of the object under test, until all images of the object under test to be stitched are obtained.
3. The image stitching method as described in claim 2, characterized in that, After the steps of obtaining the width of the object to be measured and determining whether the width is greater than the scanning width, the method further includes: If the width is less than the scanning width, then the number of scans by the acquisition device is set to 0.
4. The image stitching method as described in claim 3, characterized in that, The step of controlling the image stitching device to fuse all images to be stitched to obtain the target stitched image includes: The actual running distance of the acquisition device during each scanning process is obtained, and the image to be stitched is cropped according to the actual running distance obtained each time to obtain a number of first target stitched images; Several first target stitched images are fused together to obtain a target stitched image.
5. The image stitching method as described in claim 4, characterized in that, The step of fusing several of the first target stitched images to obtain the target stitched image includes: Obtain adjacent points between two adjacent first target images from a plurality of first target stitched images; Based on the proximity points, either of the two adjacent first target images is shifted as a whole to obtain the target stitched image.
6. An image stitching system, characterized in that, The image stitching system includes a servo device, an image stitching device, a memory, a processor, and an image stitching program stored in the memory and executable on the processor. The image stitching device includes an acquisition device and a computing device. When the image stitching program is executed by the processor, it implements the steps of the image stitching method as described in any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an image stitching program, which, when executed by a processor, implements the steps of the image stitching method as described in any one of claims 1 to 5.