Dual-camera image splicing method, system and device and medium
By using a dual-camera image stitching method, overlapping pixels are determined using the same marker, and line-by-line stitching is performed using C++ code and a memory start pointer. This solves the problem of long image stitching time in the coating process of the lithium battery industry, achieves efficient image stitching and defect detection, and improves production efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-04-14
AI Technical Summary
In existing technologies, the dual-camera image stitching method used in the coating process of the lithium battery industry is time-consuming, affecting detection efficiency and production efficiency.
A dual-camera image stitching method is adopted. By acquiring the first and second image data of the same landmark, the number of overlapping pixels in the overlapping area is determined, and line-by-line stitching is performed. The C++ code is converted into a format that can be directly manipulated in memory. The image data is directly copied to the memory area using a memory start pointer and alignment processing to achieve image stitching.
It significantly shortens image stitching time, improves inspection and production efficiency, ensures the accuracy and integrity of image stitching, supports efficient product defect detection, and enhances the efficiency of the production process.
Smart Images

Figure CN121860847A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of production equipment technology, and more specifically, to a dual-camera image stitching method, system, device, and medium. Background Technology
[0002] In the coating process of the lithium battery industry, it is necessary to use two cameras to stitch together to obtain a relatively wide image of the product for inspection. The current stitching method is time-consuming, which has a significant impact on the entire image processing process and reduces production efficiency. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a dual-camera image stitching method, system, device and medium to improve detection efficiency and production efficiency.
[0004] In a first aspect, this application provides a dual-camera image stitching method, including: Acquire first and second image data of the product; wherein both the first and second image data contain the same marker. Based on the first image data, the second image data, and the markers, determine the number of overlapping pixels in the overlapping area of the first image data and the second image data. Based on the first image data and the second image data, a line-by-line stitching operation is performed to obtain each image stitching row. The stitching operation includes: selecting a target first stitching row from the first image data and a target second stitching row from the second image data, respectively, based on the height direction of the first or second image data; performing alignment processing on the target first and second stitching rows to obtain the number of overlapping pixels in each row; and obtaining the image stitching row based on the target first stitching row, the target second stitching row, the number of overlapping pixels in each row, and the number of overlapping pixels in each region. Based on the stitched rows of images, the inspection image data of the product is obtained.
[0005] Optionally, the first image data and second image data of the product are acquired, including: The image data of the product collected by the first sensor located on one side of the detection device is used as the first image data. Image data of the product collected by a second sensor located on the other side of the detection device is used as second image data; wherein the data acquisition direction of the first sensor is set opposite to the data acquisition direction of the second sensor, and the field of view of the sensor covers the entire width of the product.
[0006] Optionally, based on the first image data, the second image data, and the marker, the number of overlapping pixels in the overlapping area of the first image data and the second image data is determined, including: Based on pixel count, determine the position of the first pixel in the first image data of the marker; Based on pixel count, the location of the marker in the second pixel of the second image data is determined; Based on the first pixel position and the second pixel position, determine the number of overlapping pixels in the overlapping area of the first image data and the second image data.
[0007] Optionally, the splicing operation also includes: The first image data and the second image data are converted into a format that can be directly manipulated in memory using C++ code, and the first memory starting pointer of the first image data and the second memory starting pointer of the second image data are determined respectively; wherein, the memory starting pointer is the memory address of the upper left corner of the image data.
[0008] Optionally, based on the target first stitching row and the target second stitching row, alignment processing is used to obtain the number of overlapping pixels in the rows, including: Based on the first memory start pointer and the target first concatenation row, and the second memory start pointer and the target second concatenation row, the number of overlapping pixels in the rows is obtained by using 4-bit alignment processing.
[0009] Optionally, image stitching rows are obtained based on the target first stitching row, the target second stitching row, the number of row overlap pixels, and the number of region overlap pixels, including: Copy the width data of the first concatenated line to the target memory region based on the first memory start pointer; The width data of the target second concatenation line is copied to the target memory area based on the second memory start pointer; wherein, the width data of the target second concatenation line is determined based on the difference between the total width pixels of the target second concatenation line and the number of overlapping pixels in the region, and the number of overlapping pixels in the region is equal to the number of overlapping pixels in the row; Based on the width data of the first and second target stitching rows, the image stitching rows are obtained.
[0010] Optionally, the dual-camera image stitching method provided in this application further includes: Defect detection is performed based on the product's inspection image data to obtain the detection results; Adjust the operating speed of the transmission product based on the defect detection results.
[0011] Secondly, this application provides a dual-camera image stitching system, comprising: The data acquisition module is used to acquire first image data and second image data of the product; wherein both the first image data and the second image data contain the same marker. The data stitching module is used to determine the number of overlapping pixels in the overlapping area of the first image data and the second image data based on the first image data, the second image data, and the marker; and to perform a line-by-line stitching operation based on the first image data and the second image data to obtain each image stitching line. The stitching operation includes: selecting a target first stitching line from the first image data and a target second stitching line from the second image data based on the height direction of the first or second image data; performing alignment processing on the target first stitching line and the target second stitching line to obtain the number of overlapping pixels in each line; obtaining image stitching lines based on the target first stitching line, the target second stitching line, the number of overlapping pixels in each line, and the number of overlapping pixels in the region; and obtaining the product's inspection image data based on each image stitching line.
[0012] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the dual-camera image stitching method described above.
[0013] Fourthly, this application provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the dual-camera image stitching method described above.
[0014] This invention provides a dual-camera image stitching method, system, device, and medium. It involves acquiring first and second image data of a product, both of which contain the same marker; determining the number of overlapping pixels in the overlapping area of the first and second image data based on the first, second, and marker data; performing a line-by-line stitching operation based on the first and second image data to obtain individual image stitching lines; and obtaining the product's inspection image data based on these image stitching lines, thereby improving inspection and production efficiency.
[0015] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart of a dual-camera image stitching method provided by an embodiment of the present invention is shown; Figure 2 A flowchart illustrating the splicing operation provided in an embodiment of the present invention is shown; Figure 3 This diagram illustrates the structure of a dual-camera image stitching system provided in an embodiment of the present invention. Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention is shown. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0019] This application provides a dual-camera image stitching method, see below. Figure 1 As shown, the dual-camera image stitching method provided in this application includes: Step 110: Obtain the first image data and the second image data of the product; wherein, both the first image data and the second image data contain the same marker.
[0020] In this embodiment of the application, the first image data and the second image data of the product can be obtained in the following ways: Image data of the product collected by a first sensor located on one side of the detection device is used as first image data; image data of the product collected by a second sensor located on the other side of the detection device is used as second image data; wherein, the data acquisition direction of the first sensor and the data acquisition direction of the second sensor are set opposite to each other, and the field of view of the acquisition covers the entire width of the product.
[0021] In practical implementation, both the first and second sensors are cameras. The two cameras are installed on opposite sides of the detection device to ensure that when capturing product images, their respective fields of view can partially overlap and jointly cover the full width of the product, thus solving the problem that a single sensor's field of view is insufficient to capture a wide product completely. The marker is placed within the common field of view of both cameras to ensure that both cameras can capture the marker when acquiring images. The marker serves as a reference for determining the overlapping area of the two images. By observing the marker in the two images, the extent of the overlapping part can be accurately located, laying the foundation for subsequent stitching operations. This application employs a dual-camera acquisition method, which, compared to single-camera acquisition, can fully acquire image information of wide-format products, avoiding image loss due to limited field of view. It also provides necessary raw data for subsequent stitching, ensuring the smooth progress of subsequent stitching work.
[0022] Step 120: Based on the first image data, the second image data, and the marker, determine the number of overlapping pixels in the overlapping area of the first image data and the second image data.
[0023] In this embodiment of the application, the number of overlapping pixels in the overlapping area of the first image data and the second image data can be determined in the following way: Based on pixel count, the first pixel position of the marker in the first image data is determined; based on pixel count, the second pixel position of the marker in the second image data is determined; based on the first pixel position and the second pixel position, the number of overlapping pixels in the overlapping area of the first image data and the second image data is determined.
[0024] In practice, pixel counting is used to count each pixel in the image, allowing for precise location of the marker. Specifically, in the first image data, pixel counting begins at the starting edge and proceeds horizontally and vertically until the pixel set corresponding to the marker is found. The starting and ending coordinates of this pixel set constitute the first pixel position of the marker in the first image data. Similarly, the same pixel counting operation is performed in the second image data to determine the second pixel position of the marker. Since the marker exists in both the first and second image data, and the fields of view of the two images overlap, the pixel position of the marker corresponds to the core of the overlapping area. To determine the number of overlapping pixels based on the first and second pixel positions, the horizontal coordinate ranges of the first and second pixel positions are extracted first. The intersection of these two coordinate ranges represents the horizontal pixel span of the overlapping area. Then, the vertical coordinate ranges of the two pixel positions are extracted, and their intersection represents the vertical pixel span of the overlapping area. Multiplying the horizontal and vertical pixel spans gives the result of the overlapping area. The method for calculating the number of overlapping pixels in a region, based on the pixel position of a marker, can directly correlate the core overlapping regions of two images, avoiding blind judgments without reference and ensuring the accuracy of the calculation. It requires no complex algorithms and can quickly obtain the pixel position of the marker, saving time for subsequent calculations. Alternatively, the method of calculating the number of overlapping pixels in a region by intersecting coordinate ranges is highly efficient and can accurately quantify the scale of the overlapping region, providing key parameter support for subsequent image stitching operations. This ensures that duplicate pixels are accurately removed during stitching, avoiding redundancy or missing pixels in the stitched image and guaranteeing the integrity and accuracy of the image stitching.
[0025] Step 130: Based on the first image data and the second image data, perform a line-by-line stitching operation to obtain each image stitching line; wherein, the stitching operation includes: selecting a target first stitching line from the first image data and a target second stitching line from the second image data based on the height direction of the first image data or the second image data respectively; using alignment processing to obtain the number of overlapping pixels in the rows based on the target first stitching line and the target second stitching line; and obtaining the image stitching line based on the number of overlapping pixels in the rows and the number of overlapping pixels in the regions of the target first stitching line and the target second stitching line.
[0026] In this embodiment of the application, the splicing operation further includes: converting the first image data and the second image data into a format that can be directly manipulated in memory using C++ code, and determining the first memory starting pointer of the first image data and the second memory starting pointer of the second image data respectively; wherein, the memory starting pointer is the memory address of the upper left corner of the image data.
[0027] Furthermore, the image stitching lines can be obtained by copying the width data of the target first stitching line to the target memory region based on the first memory start pointer; The width data of the target second stitching line is copied to the target memory area based on the second memory start pointer; wherein, the width data of the target second stitching line is determined based on the difference between the total width pixels of the target second stitching line and the number of overlapping pixels in the region, and the number of overlapping pixels in the region is equal to the number of overlapping pixels in the line; based on the width data of the target first stitching line and the width data of the target second stitching line, the image stitching line is obtained.
[0028] In practical implementation, firstly, C++ code is used to convert the first and second image data into a format that can be directly manipulated in memory, and a first memory starting pointer for the first image data and a second memory starting pointer for the second image data are determined respectively; the memory starting pointer is the memory address of the top left corner of the image data. C++ code has the characteristic of directly manipulating memory. By converting the format of the first and second image data through C++ code, redundant encapsulation information in the original image format can be stripped away, allowing the image data to be presented in a form that can be directly read and written to memory. This lays the foundation for subsequent direct manipulation of the underlying data. Compared with relying on third-party software or tools for format conversion, it is more efficient and reduces data loss. The memory starting pointer points to the starting position of the image data in memory, specifically the memory address corresponding to the top left corner of the image. Through the memory pointer, the storage area of the image data can be directly located without going through a complex index or search process, enabling quick access to every pixel data of the image, greatly improving data access efficiency and saving time for the stitching operation. Then, perform the splicing operation, where, for example... Figure 2 As shown, the splicing operation is as follows: Step 210: Based on the height direction of the first image data or the second image data, select the target first stitching row from the first image data and the target second stitching row from the second image data respectively. When selecting the target first stitching row and the target second stitching row, proceed sequentially according to the height direction of the first image data or the second image data, starting from the top of the image and selecting row by row downwards. This ensures that the target first stitching row and the target second stitching row selected each time correspond one-to-one in the height direction, thereby ensuring that the stitched image will not be misaligned in the vertical direction and ensuring the continuity of the image. Step 220: Based on the first target stitching row and the second target stitching row, the number of overlapping pixels in the rows is obtained by alignment processing. Specifically, based on the first memory start pointer and the first target stitching row, and the second memory start pointer and the second target stitching row, a 4-bit alignment processing is used to obtain the number of overlapping pixels in the rows. That is, the alignment processing is performed based on the memory storage rules of the C++ language. Since the memory of the C++ language is stored in a specific number of bits, the alignment processing of the overlapping pixels of the first target stitching row and the second target stitching row can keep the two sets of pixel data compatible at the memory level, avoiding data reading errors or image stitching distortion caused by mismatched storage formats. The number of overlapping pixels in the rows is determined based on the overlap range of the entire image. When stitching row by row, the overlap range of each row is consistent with the overall overlap range. Therefore, the number of overlapping pixels in the rows is equal to the number of overlapping pixels in the regions, ensuring the uniformity of the stitching logic. Step 230: Based on the target first stitching row, the target second stitching row, the number of row overlap pixels, and the number of region overlap pixels, obtain the image stitching row. Specifically, copy the width data of the target first stitching row to the target memory region based on the first memory start pointer; copy the width data of the target second stitching row to the target memory region based on the second memory start pointer. The width data of the target second stitching row is determined based on the difference between the total width pixels of the target second stitching row and the number of region overlap pixels, where the number of region overlap pixels is equal to the number of row overlap pixels. Based on the width data of the target first stitching row and the width data of the target second stitching row, obtain the image stitching row. That is, when copying the width data of the target first stitching row, directly access the memory region corresponding to the target first stitching row through the first memory start pointer, and completely copy all the width data of the target first stitching row to the pre-set memory region. A complete copy of the target memory region ensures that all pixel information of the left image is preserved without data loss. When copying the width data of the second stitching row, the difference between the total width pixels of the second stitching row and the number of overlapping pixels is calculated. This difference corresponds to the width data of the non-overlapping area in the second stitching row that does not overlap with the first stitching row. The memory location of this non-overlapping area is precisely located using the second memory start pointer, and the corresponding data is copied to the subsequent position of the width data of the first stitching row in the target memory region. Selective copying effectively removes duplicate pixels, avoiding redundancy in the stitched image, while ensuring that the effective data of the right image is presented completely. The width data of the first stitching row and the width data of the second stitching row are combined sequentially in the target memory region to form a complete image stitching row.
[0029] The entire stitching process directly manipulates the underlying memory data, skipping the complex image synthesis algorithms and intermediate processing steps of traditional stitching methods, significantly shortening the stitching time and solving the problem of long processing times in existing stitching methods. By using a line-by-line stitching approach, the complex image stitching task is decomposed into multiple simple single-line stitching operations, reducing the operational difficulty and facilitating the control of the stitching quality of each line, ensuring the accuracy of the final image stitching lines. Through a series of steps such as format conversion, memory pointer acquisition, alignment processing, and precise copying, efficient image stitching is achieved. Direct manipulation of the underlying memory data reduces the time spent in intermediate steps, alignment processing ensures data compatibility and stitching accuracy, and selective copying avoids image redundancy, resulting in a significant improvement in image stitching efficiency. This meets the image acquisition speed requirements of wide-format product inspection, providing efficient and reliable image support for subsequent product defect detection, thereby improving the efficiency of the entire inspection process and meeting customers' needs for speed enhancement.
[0030] Step 140: Based on each image stitching row, obtain the product's detection image data.
[0031] In this embodiment of the application, after obtaining the product's inspection image data, the method further includes: performing defect detection based on the product's inspection image data to obtain the detection result; and adjusting the operating speed of the transmitted product based on the detection result.
[0032] In practice, based on each image stitching row, the detection image data is obtained through stitching processing. Image analysis technology is used to comprehensively scan the detection image data, identifying various defects on the product surface such as damage, stains, and uneven coating. Simultaneously, key information such as the location and size of the defects is recorded, forming a complete detection result. If the detection result shows no defects or very few defects on the product surface that meet preset standards, it indicates that the current production status is stable, and the product transmission speed can be appropriately increased to improve production efficiency and meet customer demands for speed. If the detection result shows many defects or serious defects on the product surface, it indicates that there may be an anomaly in the current production process, and the product transmission speed needs to be reduced to allow sufficient time for subsequent defect handling and cause investigation, while also preventing the batch production of unqualified products, thus achieving closed-loop control of the production process.
[0033] The high quality of the inspection image data ensures the reliability of the defect detection results. Based on the speed adjustment of the inspection results, efficiency can be greatly improved during normal production, and risks can be managed in time to reduce losses when anomalies occur. At the same time, combined with the efficient image stitching technology in the early stage, the efficiency of the entire production inspection process is greatly improved. This solves the problem that the coating machine cannot speed up due to the excessive stitching time in the existing technology, further improving customer satisfaction and adapting to the production needs of the coating process in the lithium battery industry.
[0034] This application provides a dual-camera image stitching system, see below. Figure 3 As shown, the dual-camera image stitching system provided in this application embodiment includes: The data acquisition module 310 is used to acquire first image data and second image data of the product; wherein both the first image data and the second image data contain the same marker. The data stitching module 320 is used to determine the number of overlapping pixels in the overlapping area of the first image data and the second image data based on the first image data, the second image data, and the marker; and to perform a line-by-line stitching operation based on the first image data and the second image data to obtain each image stitching line. The stitching operation includes: selecting a target first stitching line from the first image data and a target second stitching line from the second image data based on the height direction of the first or second image data; performing alignment processing on the target first stitching line and the target second stitching line to obtain the number of overlapping pixels in the rows; obtaining image stitching lines based on the target first stitching line, the target second stitching line, the number of overlapping pixels in the rows, and the number of overlapping pixels in the area; and obtaining the product's inspection image data based on each image stitching line.
[0035] It should be noted that the principle of the dual-camera image stitching system provided in this application embodiment to solve the technical problem is similar to that of the dual-camera image stitching method provided in this application embodiment. Therefore, the implementation of the dual-camera image stitching system provided in this application embodiment can refer to the implementation of the dual-camera image stitching method provided in this application embodiment, and the repeated parts will not be described again.
[0036] After introducing the dual-camera image stitching method and apparatus provided in the embodiments of this application, the electronic device provided in the embodiments of this application will be briefly introduced next.
[0037] See Figure 4 As shown, the electronic device 500 provided in this application embodiment includes at least a processor 501, a memory 502, and a computer program stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program, it implements the dual-camera image stitching method provided in this application embodiment.
[0038] The electronic device 500 provided in this application embodiment may further include a bus 503 connecting different components (including processor 501 and memory 502). The bus 503 represents one or more types of bus structures, including memory bus, peripheral bus, local area bus, etc.
[0039] Memory 502 may include a readable storage medium in the form of volatile memory, such as random access memory (RAM) 5021 and / or cache memory 5022, and may further include read-only memory (ROM) 5023. Memory 502 may also include a program tool 5025 having a set (at least one) of program modules 5024, including but not limited to an operating subsystem, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0040] Processor 501 can be a single processing element or a collective term for multiple processing elements. For example, processor 501 can be a central processing unit (CPU) or one or more integrated circuits configured to implement the dual-camera image stitching method provided in the embodiments of this application. Specifically, processor 501 can be a general-purpose processor, including but not limited to CPUs, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0041] Electronic device 500 can communicate with one or more external devices 504 (e.g., keyboard, remote control, etc.), and also with one or more devices that enable a user to interact with electronic device 500 (e.g., mobile phone, computer, etc.), and / or with devices that enable electronic device 500 to communicate with one or more other electronic devices 500 (e.g., router, modem, etc.). This communication can be performed through input / output (I / O) interface 505. Furthermore, electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) through network adapter 506. Figure 4 As shown, network adapter 506 communicates with other modules of electronic device 500 via bus 503. It should be understood that, although... Figure 4As not shown, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to microcode, device drivers, redundant processors, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) subsystems, tape drives, and data backup storage subsystems.
[0042] It should be noted that, Figure 4 The electronic device 500 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0043] The computer-readable storage medium provided in the embodiments of this application is described below. The computer-readable storage medium provided in the embodiments of this application stores computer instructions, which, when executed by a processor, implement the dual-camera image stitching method provided in the embodiments of this application. Specifically, the computer instructions can be built into or installed in the processor, so that the processor can implement the dual-camera image stitching method provided in the embodiments of this application by executing the built-in or installed computer instructions.
[0044] In addition, the dual-camera image stitching method provided in this application embodiment can also be implemented as a computer program product, which includes program code. The program code implements the dual-camera image stitching method provided in this application embodiment when it is run on a processor.
[0045] The computer program product provided in this application embodiment may employ one or more computer-readable storage media, which may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. Specifically, more specific examples (a non-exhaustive list) of computer-readable storage media include electrical connections with one or more wires, portable disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM), optical fibers, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0046] The computer program product provided in this application embodiment can be a CD-ROM and include program code, and can also run on electronic devices such as computers. However, the computer program product provided in this application embodiment is not limited thereto. In this application embodiment, the computer-readable storage medium can be any tangible medium that contains or stores program code, which can be used by or in conjunction with an instruction execution system, device, or apparatus.
[0047] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.
[0048] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0049] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0050] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of the embodiments of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.
Claims
1. A method for stitching images from two cameras, characterized in that, include: Acquire first image data and second image data of the product; wherein both the first image data and the second image data contain the same marker; Based on the first image data, the second image data, and the marker, determine the number of overlapping pixels in the overlapping area of the first image data and the second image data; Based on the first image data and the second image data, a line-by-line stitching operation is performed to obtain each image stitching line; wherein, the stitching operation includes: selecting a target first stitching line from the first image data and a target second stitching line from the second image data based on the height direction of the first image data or the second image data, respectively; using alignment processing to obtain the number of overlapping pixels in the rows based on the target first stitching line and the target second stitching line; and obtaining the image stitching line based on the target first stitching line, the target second stitching line, the number of overlapping pixels in the rows, and the number of overlapping pixels in the region; Based on each of the image stitching rows, the detection image data of the product is obtained.
2. The dual-camera image stitching method according to claim 1, characterized in that, Acquire the first and second image data of the product, including: The image data of the product collected by the first sensor located on one side of the detection device is used as the first image data. Image data of the product collected by a second sensor located on the other side of the detection device is used as second image data; wherein, the data acquisition direction of the first sensor is set opposite to the data acquisition direction of the second sensor, and the acquisition field of view covers the entire width of the product.
3. The dual-camera image stitching method according to claim 1, characterized in that, Based on the first image data, the second image data, and the marker, determine the number of overlapping pixels in the overlapping area of the first image data and the second image data, including: Based on pixel count, the location of the marker in the first pixel of the first image data is determined; Based on the pixel count, the location of the marker in the second pixel of the second image data is determined; Based on the first pixel position and the second pixel position, determine the number of overlapping pixels in the overlapping area of the first image data and the second image data.
4. The dual-camera image stitching method according to claim 1, characterized in that, The splicing operation also includes: The first image data and the second image data are converted into a format that can be directly manipulated in memory using C++ code, and the first memory starting pointer of the first image data and the second memory starting pointer of the second image data are determined respectively; wherein, the memory starting pointer is the memory address of the upper left corner of the image data.
5. The dual-camera image stitching method according to claim 4, characterized in that, Based on the first and second target stitched rows, alignment processing is used to obtain the number of overlapping pixels in the rows, including: Based on the first memory start pointer and the target first concatenation row, as well as the second memory start pointer and the target second concatenation row, the number of overlapping pixels in the rows is obtained by 4-bit alignment processing.
6. The dual-camera image stitching method according to claim 5, characterized in that, Based on the target first stitching row, the target second stitching row, the number of overlapping pixels in the rows, and the number of overlapping pixels in the regions, image stitching rows are obtained, including: Copy the width data of the first concatenated line of the target memory to the target memory region based on the first memory start pointer; The width data of the target second stitched row is copied to the target memory region based on the second memory start pointer; wherein, the width data of the target second stitched row is determined based on the difference between the total width pixels of the target second stitched row and the number of overlapping pixels in the region, and the number of overlapping pixels in the region is equal to the number of overlapping pixels in the row; The image stitching rows are obtained based on the width data of the first target stitching row and the width data of the second target stitching row.
7. The dual-camera image stitching method according to any one of claims 1 to 6, characterized in that, Also includes: Defect detection is performed based on the inspection image data of the product to obtain the detection results; The operating speed of the product being transmitted is adjusted based on the test results.
8. A dual-camera image stitching system, characterized in that, include: The data acquisition module is used to acquire first image data and second image data of the product; wherein, both the first image data and the second image data contain the same marker; The data stitching module is used to determine the number of overlapping pixels in the overlapping area of the first image data and the second image data based on the first image data, the second image data, and the marker; and to perform a line-by-line stitching operation based on the first image data and the second image data to obtain various image stitching rows; wherein the stitching operation includes: selecting a target first stitching row from the first image data and a target second stitching row from the second image data based on the height direction of the first image data or the second image data; performing alignment processing on the target first stitching row and the target second stitching row to obtain the number of overlapping pixels in the rows; obtaining image stitching rows based on the target first stitching row, the target second stitching row, the number of overlapping pixels in the rows, and the number of overlapping pixels in the area; and obtaining the detection image data of the product based on each of the image stitching rows.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the dual-camera image stitching method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the dual-camera image stitching method as described in any one of claims 1 to 7.