Defect detection merging method, system, electronic device, and storage medium
Patent Information
- Application Number
- CN202610890673.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-10-30
AI Technical Summary
[0009]本发明的目的在于提供一种缺陷检测合并方法,以解决现有技术中线阵相机取图时缺陷跨帧分割导致的检测误差问题,实现对跨帧缺陷的准确识别和合并,提高膜类产品缺陷检测的准确性和可靠性
本发明有效解决了膜类产品缺陷检测中的跨帧缺陷分割问题。通过在缺陷检测过程中引入双缓冲区机制,分别存储当前帧图像和前一帧图像,并专门检测当前帧图像上边缘区域是否存在缺陷,当检测到上边缘区域存在缺陷时,判定该缺陷为跨帧缺陷,将前一帧图像中的对应区域与当前帧图像的上边缘区域进行拼接,从而获得跨帧缺陷的完整形态数据。这种方法从根本上解决了线阵相机按固定行数取图时缺陷被帧边界分割的技术问题,使得原本被分割成两部分的缺陷能够被完整地识别和分析。
Smart Images

Figure CN123015361A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automated optical inspection technology, and more specifically, to a defect detection merging method, system, electronic device, and storage medium. Background Technology
[0002] This section provides only background information relevant to this disclosure and is not necessarily prior art.
[0003] Membrane products are widely used in industrial production, such as lithium battery separators, optical films, and plastic films. The quality of these membrane products directly affects the performance and safety of downstream products; therefore, defect detection of membrane products is a crucial step in the production process. Currently, defect detection of membrane products is mainly achieved using line scan cameras in conjunction with image processing algorithms.
[0004] A line scan camera is an image acquisition device with a single or multiple rows of pixel arrays. Its working principle is to continuously scan along the movement direction of the membrane product, combining the acquired image data from multiple rows into a single frame for output. In practical applications, line scan cameras typically capture images according to a preset number of rows, for example, 1024 rows per frame. When the membrane product moves at a constant speed on the production line, the line scan camera acquires images at a fixed frequency, thus achieving continuous inspection of the product surface.
[0005] However, this detection method has a significant technical problem: when a defect happens to appear at the boundary between two frames, it is segmented into two parts. Assuming a defect's actual size is 100 pixels horizontally and 50 pixels vertically, when the defect crosses the boundary between two adjacent frames, it might appear as a 100-pixel horizontal and 20-pixel vertical portion in the previous frame, and as a 100-pixel horizontal and 30-pixel vertical portion in the current frame. This segmentation results in each part of the defect being smaller than the original defect's actual size.
[0006] This cross-frame segmentation phenomenon leads to the following technical problems: First, there is the issue of misclassification of defect levels. Defects in membrane products are typically categorized into different levels based on size, such as minor, moderate, and severe defects. When a defect is segmented, the size of each segment may fall below the threshold corresponding to the original defect level. For example, a large severe defect may be segmented into two smaller minor or moderate defects, leading to misclassification of the defect level and affecting the accuracy of product quality assessment.
[0007] Second, there is the issue of missed defects. When the testing system for membrane products has strict quality standards, minor defects may be judged as acceptable. However, if a large defect is precisely divided into two smaller parts by the frame boundary, and the size of each part is below the threshold of the testing system, the defect may be missed, resulting in defective products entering the market.
[0008] Third, there is the problem of inaccurate defect location. A segmented defect may be identified as two separate defects in consecutive frames, leading to confusion in defect location information. In subsequent quality tracking and problem analysis, it becomes impossible to accurately determine the true location of the defect, affecting the improvement and optimization of the production process. Summary of the Invention
[0009] The purpose of this invention is to provide a defect detection merging method to solve the detection error problem caused by cross-frame segmentation of defects when capturing images with a linear array camera in the prior art, so as to achieve accurate identification and merging of cross-frame defects and improve the accuracy and reliability of defect detection for membrane products.
[0010] To achieve the above objectives, the first aspect of this application proposes a defect detection merging method, comprising: Allocate a first buffer to store the current frame image, and allocate a second buffer to store the previous frame image; Detect whether there are defects in the upper edge region of the current frame image, where the upper edge region is the region adjacent to the previous frame image in the current frame image; If a defect exists, it is determined to be a cross-frame defect. The region in the previous frame image corresponding to the upper edge defect of the current frame image is then stitched together with the upper edge region of the current frame image to obtain a stitched image region. Defect analysis is performed on the stitched image region to obtain the complete morphological data of the cross-frame defect; Defect detection results are generated based on the complete morphological data.
[0011] According to the defect detection merging method provided in this application, after detecting whether there is a defect in the upper edge region of the current frame image, the method further includes: If no defects are found, the defect detection result of the current frame image is output, and the current frame image is transferred to the second buffer, and the data in the second buffer is updated.
[0012] According to the defect detection merging method provided in this application, the capacity of the first buffer and the second buffer is set according to the resolution of a single frame image.
[0013] According to the defect detection merging method provided in this application, the step of stitching together the region in the previous frame image corresponding to the upper edge defect of the current frame image with the upper edge region of the current frame image includes: Determine the x-coordinate region of the edge defect on the current frame image; Extract the region corresponding to the x-direction coordinate region from the previous frame image; The extracted region is pixel-aligned and stitched with the upper edge defect region of the current frame image.
[0014] According to the defect detection merging method provided in this application, the defect analysis of the stitched image region includes: using an edge detection algorithm to detect the stitched image region, extracting the length, width, and location information of the defects, and determining the defect level.
[0015] According to the defect detection merging method provided in this application, after generating the defect detection result based on the complete morphological data, the method further includes: transferring the current frame image to the second buffer, updating the previous frame image, and entering the detection process of the next frame image.
[0016] The second aspect of this application proposes a defect detection merging system that performs the defect detection merging method in any of the above-described technical solutions, including: The first buffer module is configured to store the current frame image. The second buffer module is configured to store the previous frame image. A defect detection module is configured to detect whether there is a defect in the upper edge region of the current frame image, wherein the upper edge region is the region of the current frame image adjacent to the previous frame image; A cross-frame judgment module is configured to determine that when the defect detection module detects a defect, the defect is a cross-frame defect. An image stitching module is configured to stitch together the region in the previous frame image that corresponds to the upper edge defect of the current frame image with the upper edge region of the current frame image to obtain a stitched image region. The analysis module is configured to perform defect analysis on the stitched image region to obtain the complete morphological data of the cross-frame defect; The result output module is configured to generate defect detection results based on the complete morphological data.
[0017] The defect detection merging system of this invention has the same advantages as the defect detection merging method described above, and will not be repeated here.
[0018] According to the defect detection merging system provided in this application, the defect detection module is further configured to: if no defect exists, output the defect detection result of the current frame image, transfer the current frame image to the second buffer, and update the data in the second buffer.
[0019] A third aspect of 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 program to implement the defect detection merging method of any of the above-described technical solutions.
[0020] The fourth aspect of this application proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the defect detection merging method of any of the above-described technical solutions.
[0021] The computer-readable storage medium of this invention has the same advantages as the above-described defect detection merging method, and will not be repeated here.
[0022] Compared with the prior art, the present invention has the following beneficial effects: This invention effectively solves the problem of cross-frame defect segmentation in defect detection of membrane products. By introducing a dual-buffer mechanism during defect detection, the current frame image and the previous frame image are stored separately. The current frame image is specifically tested for defects in its upper edge region. When a defect is detected in the upper edge region, it is determined to be a cross-frame defect. The corresponding region in the previous frame image is then stitched together with the upper edge region of the current frame image to obtain the complete morphological data of the cross-frame defect. This method fundamentally solves the technical problem of defects being segmented by frame boundaries when a line scan camera captures images with a fixed number of rows, enabling the complete identification and analysis of defects that were originally divided into two parts.
[0023] In traditional inspection methods, segmented defects, due to the small size of each part, may be misclassified as low-level defects or even missed altogether. This invention, by splicing and reanalyzing cross-frame defects, can accurately obtain the actual size information of the defects, thereby correctly determining their level and avoiding misclassification caused by defect segmentation. Furthermore, because it can identify cross-frame defects as a single, complete defect rather than two independent defects, it also effectively avoids missed detections. This is of great significance for ensuring the quality control of membrane products, especially in the production of high-end products with strict defect level requirements, such as the production of safety-critical materials like lithium-ion battery separators.
[0024] The technical solution of this invention fully covers the entire process of defect detection and merging, forming a complete technical closed loop from image buffer management, cross-frame defect judgment, image stitching, defect analysis to result output. The collaborative work among the various modules of the system ensures the reliability and stability of the detection results. Furthermore, this invention also provides specific implementation forms for electronic devices and computer-readable storage media, offering multiple optional paths for the commercial application of the technical solution. Attached Figure Description
[0025] The accompanying drawings, which form part of this application, are used to provide a further understanding of the application and to make other features, objects, and advantages of the application more apparent. The illustrative embodiments and descriptions of this application are used to explain the application and do not constitute an undue limitation of the application. In the drawings: Figure 1 This is a flowchart of the defect detection merging method provided in the embodiments of the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] In this application, the terms "upper," "lower," "left," "right," "front," "rear," "top," "bottom," "inner," "outer," "middle," "vertical," "horizontal," "lateral," and "longitudinal" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are primarily for the purpose of better describing this application and its embodiments, and are not intended to limit the indicated device, element, or component to having a specific orientation, or to be constructed and operated in a specific orientation.
[0029] Furthermore, in addition to indicating location or positional relationship, some of the aforementioned terms may also have other meanings. For example, the term "above" may also be used in some cases to indicate a certain dependency or connection relationship. Those skilled in the art can understand the specific meaning of these terms in this application based on the specific circumstances.
[0030] Furthermore, the terms "installation," "setup," "equipped with," "connection," "linked," and "socketing" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral structure; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or an internal connection between two devices, components, or parts. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0031] like Figure 1 As shown, the defect detection merging method provided by this invention is applicable to any production line. In this application, the surface defect detection scenario applicable to the production process of membrane products is used as an example for illustration. Membrane products include, but are not limited to, industrial materials such as thin films, separators, and films. Taking the lithium battery separator detection scenario as an example, the quality of the lithium battery separator, as one of the key components of a lithium battery, directly affects the safety performance and cycle life of the lithium battery. On the separator production line, the high-speed rotating separator rolls need to undergo strict surface quality inspection. Any tiny defects, such as holes, scratches, stains, foreign objects, etc., may lead to serious consequences such as short circuits or even fires during the use of the lithium battery. Therefore, developing a technical solution that can accurately and efficiently detect cross-frame defects has important practical significance.
[0032] The system involved in this invention uses a line scan camera to acquire real-time images of moving membrane products. Line scan cameras have advantages such as high resolution and fast response speed, making them suitable for surface defect detection on high-speed production lines. However, since line scan cameras acquire images line by line, each frame can only capture a local area of the membrane product surface. When a defect crosses the boundary between two adjacent frames, only a portion of the defect's morphological information can be captured in a single frame, posing a challenge to accurate defect identification and classification. This invention addresses this technical problem by proposing a method for cross-frame defect detection merging. Through effective processing of the upper edge region and image stitching, it achieves accurate acquisition of the complete morphology of cross-frame defects.
[0033] Specifically, the defect detection merging method includes the following basic steps: First, a first buffer is established to store the current frame image, and a second buffer is established to store the previous frame image. In practical applications of lithium battery separator inspection, the capacity of the first and second buffers is set according to the resolution of a single frame image. Taking a line scan camera image with 1024 rows and 768 columns of pixels per frame as an example, the capacity of each buffer is set to 1024×768 pixels, which can completely store one frame of image data. The independent setting of the first and second buffers allows the system to simultaneously retain the complete image data of the current and previous frames, providing the necessary data foundation for subsequent cross-frame defect detection and image stitching. The first buffer is used to receive the current frame image data acquired by the line scan camera in real time, while the second buffer receives the current frame image data after detection and uses it as the previous frame reference image for the next round of detection.
[0034] Next, the system detects whether there are defects in the upper edge region of the current frame image, which is defined as the area adjacent to the previous frame. Since the upper edge region is the boundary between the current and previous frames, any defects extending across frames will inevitably be reflected in this region. Therefore, accurate detection of this region is crucial for identifying cross-frame defects. The system performs image processing and feature analysis on the upper edge region to determine whether defect features exist within this area.
[0035] When a defect is detected in the upper edge region, the system determines that the defect is a cross-frame defect. In the practical application of this invention, a cross-frame defect refers to a defect whose complete shape spans the boundary between two adjacent image frames, meaning a single image frame cannot fully represent all the features of the defect. This type of defect is common in high-speed production line inspection, especially when the defect size is large or the product moves at a high speed, making it more likely to cross frame boundaries. In such cases, the system needs to obtain complete morphological data of the defect to accurately classify and determine its severity level.
[0036] After determining the existence of a cross-frame defect, the system performs an image stitching operation, stitching the region corresponding to the upper edge defect of the current frame image in the previous frame image with the upper edge region of the current frame image to obtain a stitched image region. In some embodiments of the present invention, the specific implementation of image stitching includes the following process: First, determine the x-coordinate region of the upper edge defect of the current frame image. The x-direction refers to the extension direction of the scanning line of the linear scan camera, that is, the direction perpendicular to the movement direction of the membrane product. By analyzing the position of the defect features in the upper edge region of the current frame, determine the start and end coordinates of the defect in the x-direction, thereby delineating the x-coordinate region covered by the defect. Then, extract the region corresponding to the x-coordinate region from the previous frame image. Since there is a fixed time interval and spatial displacement between the previous and current frames, and the product movement speed is relatively stable, the precise position of the corresponding region in the previous frame image can be accurately calculated using the frame interval and movement speed parameters. Finally, stitch the extracted region with the upper edge defect region of the current frame image pixel-aligned. In the embodiment of lithium battery separator inspection, the splicing area has a total of 40 rows of pixels, including the last 20 rows of the previous frame image and the first 20 rows of the current frame image. Through pixel-level precise alignment, it is ensured that the spliced image is visually coherent and without any breaks.
[0037] Taking a line scan camera with 1024 rows of pixels per frame as an example, the upper edge region specifically refers to the first 20 rows of pixels in the current frame. The stitching area can be adjusted according to the parameters set by the customer to adapt to various film-type product inspection scenarios. For example, a fixed stitching area of 100 rows, or a stitching area that is half the image height, etc.
[0038] After image stitching is completed, the system performs defect analysis on the stitched image region to obtain complete morphological data of defects across frames. In a specific implementation of this invention, defect analysis is processed using an edge detection algorithm. Specifically, the Canny edge detection algorithm is first used to extract edge features from the stitched image region. The Canny algorithm can effectively detect abrupt changes in grayscale in the image, accurately delineating the boundary contour of the defect. Based on the edge contour, the defect region is determined, and the system can extract the length, width, and location information of the defect. The length extends along the x-direction, the width is perpendicular to the x-direction, and the location information includes the absolute coordinates of the defect on the film surface and its relative coordinates relative to the frame boundary. Subsequently, based on the extracted defect morphological parameters and a preset defect level judgment standard, the defect level is determined. Defect levels are usually divided into multiple levels based on the defect size and its impact on product quality, such as minor defects, moderate defects, and severe defects.
[0039] After acquiring complete morphological data of defects across frames, the system generates and outputs defect detection results based on this data. The defect detection results include information such as defect type determination, size measurement, grade classification, and precise location marking on the membrane surface.
[0040] In some embodiments of the present invention, when no defects are detected in the upper edge region, i.e., the entire upper edge region of the current frame image is a normal region, the system directly outputs the defect detection result of the current frame image without the need for cross-frame stitching. After output, the system transfers the current frame image to the second buffer, updating the data in the second buffer so that the current frame image participates in the cross-frame detection logic as the previous frame image in the next detection cycle. This processing flow ensures the continuity and consistency of inter-frame data.
[0041] After outputting the defect detection results, the system needs to update the buffer to prepare for the detection process of the next frame image. Specifically, the system transfers the current frame image to the second buffer, updates the data of the previous frame image, and ensures that the image stored in the second buffer is always the most recently successfully detected frame image. Simultaneously, the system releases the storage space in the first buffer to prepare for receiving the next frame of newly acquired image data. After completing the buffer update, the system enters the detection process for the next frame image, repeating the aforementioned steps of defect detection, cross-frame judgment, image stitching, and defect analysis to achieve continuous, real-time detection of the surface of membrane products.
[0042] The method of this invention provides a data foundation for cross-frame defect detection through a dual-buffer architecture; it achieves automatic identification of cross-frame defects by detecting the upper edge region; it ensures accurate acquisition of the complete defect shape through a high-precision image stitching algorithm; it achieves precise extraction of defect morphology parameters through edge detection processing; and it ensures the rationality of defect classification through a multi-dimensional comprehensive evaluation mechanism for defect level determination. The technical solution of this invention has significant technological advancements and practical value in the field of surface defect detection for membrane products.
[0043] The specific structure and working principle of the defect detection merging system implementing this method will be further explained below. The defect detection merging system comprises multiple functional modules working collaboratively to achieve accurate detection and complete morphological acquisition of cross-frame defects. The first buffer module is a storage unit in the system used to temporarily store the image data of the currently acquired frame from the line scan camera. This module continuously receives real-time image data streams from the line scan camera and completely saves each frame of image data in its storage space. The capacity design of the first buffer module needs to meet the storage requirements of a single frame of image data. In a preferred embodiment of the present invention, the buffer capacity is set to 1024×768 pixels, which is sufficient to completely store one frame of image acquired by the line scan camera.
[0044] The second buffer module corresponds to the first buffer module, and its function is to store the image data of the previous frame. At the end of each detection cycle, this module receives the image data transferred from the first buffer module and uses it as a reference frame in subsequent detection processes. The existence of the second buffer module allows the system to access the image data of the previous frame at any time while processing the current frame, providing necessary data support for the detection of cross-frame defects. The independent setting and alternating update mechanism of the two buffer modules ensures seamless connection and continuity of data between frames.
[0045] The defect detection module is one of the core processing units of the system. This module is configured to detect whether there are defects in the upper edge region of the current frame image. As mentioned earlier, the upper edge region is the area adjacent to the previous frame image in the current frame image. In this specific implementation, the upper edge region is defined as the first 20 rows of pixels in the current frame image. The defect detection module identifies whether there are defect features in the upper edge region by performing image processing and feature analysis. When a defect is detected, the defect detection module outputs a defect presence indicator and triggers the subsequent cross-frame judgment processing flow. When no defect is detected, the defect detection module outputs a normal indicator, and the system continues to execute according to the defect-free processing logic.
[0046] The cross-frame judgment module starts working after receiving the defect presence identifier from the defect detection module. This module is configured to determine the nature of the defect. Specifically, when the defect detection module detects a defect in the upper edge region, the cross-frame judgment module determines whether the defect is a cross-frame defect, i.e., whether the complete shape of the defect crosses the boundary between the current frame and the previous frame. The cross-frame judgment module analyzes the distribution and morphological characteristics of the defect in the upper edge region, combined with preset judgment rules, to determine whether the defect is a cross-frame defect. If it is determined to be a cross-frame defect, the cross-frame judgment module triggers the image stitching module; if it is determined to be an intra-frame defect, it directly enters the single-frame defect analysis and processing flow.
[0047] The image stitching module is a key module for acquiring the complete shape of defects across frames. This module is configured to stitch the region corresponding to the upper edge defect of the current frame image in the previous frame image with the upper edge region of the current frame image to obtain a stitched image region. The working process of the image stitching module includes three main steps: coordinate region determination, previous frame region extraction, and pixel alignment stitching. In the coordinate region determination step, the image stitching module first determines the coordinate region range of the upper edge defect in the current frame image in the x-direction. This range is precisely defined by analyzing the start and end positions of the defect edge. In the previous frame region extraction step, the image stitching module calculates the spatial position corresponding to the defect region in the current frame image in the previous frame image based on the frame interval and product movement speed parameters, and extracts the image data of this region from the second buffer module. In the pixel alignment stitching step, the image stitching module performs pixel-level alignment and stitching between the extracted previous frame region image and the upper edge defect region of the current frame. After stitching, the image stitching module outputs the stitched image region data for subsequent analysis and processing.
[0048] The analysis module is configured to perform defect analysis on the stitched image region to obtain complete morphological data of defects across frames. In a specific implementation of this invention, the analysis module employs an edge detection algorithm for defect analysis. The edge detection algorithm uses the Canny operator to extract image edges. This algorithm smooths image noise through Gaussian filtering, calculates the image gradient, finds local maxima of the gradient magnitude, and finally obtains an accurate edge image. The analysis module can accurately extract the morphological feature data of defects, including the length of the defect in the x-direction, the width in the perpendicular x-direction, the absolute coordinate position of the defect region on the membrane surface, and the relative coordinate position with respect to the frame boundary. Subsequently, based on the extracted morphological feature data, the analysis module determines the defect's level classification by comparing it with a preset defect level judgment standard.
[0049] The results output module is configured to generate and output defect detection results based on complete morphological data. It integrates data such as defect type, size parameters, location information, and grade classification obtained by the analysis module to generate a complete defect detection report. The output format of the results output module can be configured according to actual application needs; it can output structured data for subsequent data processing systems or as a visual image displayed on the user interface, providing quality management personnel with intuitive defect information.
[0050] In some embodiments of the present invention, the defect detection module is further configured to handle the case of no defects. Specifically, when the defect detection module detects that there are no defects in the upper edge region of the current frame image, the defect detection module outputs the defect detection result of the current frame image, indicating that no cross-frame defects were detected in this frame image. Simultaneously, the defect detection module triggers a buffer update operation, transferring the current frame image from the first buffer to the second buffer and updating the image data stored in the second buffer. This mechanism ensures that the second buffer always stores the image data of the most recent frame, providing an accurate reference for cross-frame detection in subsequent frames.
[0051] Furthermore, after the system outputs the defect detection results for the current frame, regardless of whether there are cross-frame defects, the system will perform a buffer update operation. Specifically, the system transfers the current frame image to the second buffer, replacing the previous frame image data in the second buffer with the current frame image data, thus updating the data in the second buffer. Simultaneously, the system prepares to receive the next frame of new image data for the detection process. This cyclical update mechanism ensures that the system can perform continuous and uninterrupted defect detection on the surface of membrane products.
[0052] The defect detection and merging system of this invention, through the collaborative work of the aforementioned functional modules, achieves automatic identification, image stitching, and complete shape acquisition of cross-frame defects, solving the technical problem that traditional single-frame detection methods cannot accurately identify cross-frame defects. The various modules of the system exchange information through standardized data interfaces, ensuring data flow consistency and processing continuity. Simultaneously, the system supports flexible parameter configuration, enabling adaptation to different product specifications and production line conditions, demonstrating good versatility and practicality.
[0053] The following will further describe the specific implementation of the electronic device for implementing the defect detection merging method of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The memory is used to store the computer program and related data. The capacity of the memory needs to meet the requirements of system operation and data caching. In a preferred embodiment of the present invention, the memory capacity is set to be able to simultaneously accommodate two frame buffers and the workspace required for program execution. The processor is the core computing unit of the electronic device, responsible for executing the computer program stored in the memory and implementing the various functions of the defect detection merging method of the present invention. The processor can be a general-purpose central processing unit, or a dedicated image processing chip or digital signal processor, selected according to the computing power requirements of the actual application scenario.
[0054] When the processor executes the computer program stored in memory, the processor performs the following functions: First, it initializes the first and second buffers, allocating storage space for frame image data; then, it receives the current frame image data acquired by the line scan camera and stores it in the first buffer; next, it performs defect detection on the upper edge region of the current frame image to determine whether defect features exist; if a defect is detected, it extracts the corresponding region from the previous frame image and performs pixel-level stitching with the upper edge region of the current frame; subsequently, it performs edge detection processing on the stitched image region to extract the complete morphological parameters of the defect; finally, it generates and outputs the defect detection result based on the morphological parameters, and simultaneously performs a buffer update operation to prepare for the detection of the next frame.
[0055] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the defect detection and merging system and its control method of any of the above embodiments.
[0056] The aforementioned computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. Computer-readable storage media include, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CDROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0057] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0058] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0059] Computer program code for performing the operations of embodiments of the present invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0060] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0061] Obviously, those skilled in the art should understand that the various units or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0062] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A defect detection merging method, characterized in that, include: Allocate a first buffer to store the current frame image, and allocate a second buffer to store the previous frame image; Detect whether there are defects in the upper edge region of the current frame image, where the upper edge region is the region adjacent to the previous frame image in the current frame image; If a defect exists, it is determined to be a cross-frame defect. The region in the previous frame image corresponding to the upper edge defect of the current frame image is then stitched together with the upper edge region of the current frame image to obtain a stitched image region. Defect analysis is performed on the stitched image region to obtain the complete morphological data of the cross-frame defect; Defect detection results are generated based on the complete morphological data.
2. The defect detection merging method according to claim 1, characterized in that, After detecting whether there are defects in the upper edge region of the current frame image, the method further includes: If no defects are found, the defect detection result of the current frame image is output, and the current frame image is transferred to the second buffer, and the data in the second buffer is updated.
3. The defect detection merging method according to claim 1, characterized in that, The capacities of the first buffer and the second buffer are set according to the resolution of a single frame image.
4. The defect detection merging method according to claim 1, characterized in that, The step of stitching the region in the previous frame image corresponding to the upper edge defect of the current frame image with the upper edge region of the current frame image includes: Determine the x-coordinate region of the edge defect on the current frame image; Extract the region corresponding to the x-direction coordinate region from the previous frame image; The extracted region is pixel-aligned and stitched with the upper edge defect region of the current frame image.
5. The defect detection merging method according to claim 1, characterized in that, The defect analysis of the stitched image region includes: using an edge detection algorithm to detect the stitched image region, extracting the length, width, and location information of the defects, and determining the defect level.
6. The defect detection merging method according to claim 1, characterized in that, After generating the defect detection result based on the complete morphological data, the process further includes: transferring the current frame image to the second buffer, updating the previous frame image, and proceeding to the detection process of the next frame image.
7. A defect detection merging system, characterized in that, include: The first buffer module is configured to store the current frame image. The second buffer module is configured to store the previous frame image. A defect detection module is configured to detect whether there is a defect in the upper edge region of the current frame image, wherein the upper edge region is the region of the current frame image adjacent to the previous frame image; A cross-frame judgment module is configured to determine that when the defect detection module detects a defect, the defect is a cross-frame defect. An image stitching module is configured to stitch together the region in the previous frame image that corresponds to the upper edge defect of the current frame image with the upper edge region of the current frame image to obtain a stitched image region. The analysis module is configured to perform defect analysis on the stitched image region to obtain the complete morphological data of the cross-frame defect; The result output module is configured to generate defect detection results based on the complete morphological data.
8. The system according to claim 7, characterized in that, The defect detection module is further configured to: if no defect exists, output the defect detection result of the current frame image, transfer the current frame image to the second buffer, and update the data in the second buffer.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the defect detection merging method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the defect detection merging method as described in any one of claims 1 to 6.
