Mask edge distance detection method and device, computer equipment and storage medium

By accurately positioning the edge area of ​​the mask from the target image and using the ear belt interference removal technology, the problem of low detection accuracy of edge spacing in the existing technology is solved, and higher detection accuracy and production quality are achieved.

CN119991562APending Publication Date: 2025-05-13SHENZHEN SMARTMORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411925047.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The existing mask edge spacing detection methods have low detection accuracy, which limits the improvement of mask production quality.

Method used

By acquiring the target image, the marking area, the area to be detected, the background area and the target area, the ear belt interference removal technology is used to accurately locate the edge area of ​​the mask, and then realize mask margin detection.

Benefits of technology

The accuracy of mask margin detection is improved, the detection accuracy of mask edge areas is ensured, and the quality of mask production is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991562A_ABST
    Figure CN119991562A_ABST
Patent Text Reader

Abstract

The invention relates to a mask edge distance detection method and device, computer equipment / a computer readable storage medium and a computer program product. The method comprises the steps that a target image obtained by shooting a to-be-detected mask is acquired, a marked area is determined from the target image, and the marked area comprises an edge fixed point array of the to-be-detected mask; obtaining a to-be-detected area according to a coverage area between the marked area and a mask boundary line of the to-be-detected mask in the target image; determining a background area of the to-be-detected mask from the target image based on the marked area; when the background area has the ear band interference area, performing ear band interference elimination on the to-be-detected area based on the ear band interference area to obtain a target area; and determining an edge area of the to-be-detected mask according to the target area and the mark area, and obtaining a mask edge distance detection result of the to-be-detected mask based on the edge area. According to the invention, the accuracy of mask edge distance detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a mask margin detection method, device, computer equipment, computer-readable storage medium and computer program product. Background Art

[0002] In the mask production process, the edge spacing of the mask is an important indicator of mask quality, which has a direct impact on the sealing and protective effect, functionality, comfort, appearance quality and overall quality of the mask. Therefore, ensuring that the mask edge spacing is appropriate and consistent is a key link that cannot be ignored in the mask production process. However, the existing mask edge spacing detection method has low detection accuracy, which to a certain extent restricts the improvement of mask production quality. Summary of the invention

[0003] Based on this, it is necessary to provide a mask margin detection method, device, computer equipment, computer readable storage medium and computer program product to address the above-mentioned technical problems, which can improve the accuracy of mask margin detection.

[0004] In a first aspect, the present application provides a mask margin detection method, comprising:

[0005] Obtain a target image captured for the mask to be detected, and determine a marked area from the target image, where the marked area includes an array of edge fixed points of the mask to be detected;

[0006] Obtaining the area to be detected according to the coverage area between the marked area and the mask edge boundary of the mask to be detected in the target image;

[0007] Determine the background area of ​​the mask to be detected from the target image based on the marked area;

[0008] When there is an ear band interference area in the background area, the ear band interference is eliminated from the detection area based on the ear band interference area to obtain the target area;

[0009] Determine the edge area of ​​the mask to be detected according to the target area and the marked area, where the edge area is the area between the boundary line of the area in the marked area close to the edge boundary of the mask and the edge boundary of the mask;

[0010] The mask margin detection result of the mask to be detected is obtained based on the edge area.

[0011] In a second aspect, the present application provides a mask margin detection device, comprising:

[0012] A marking area determination module is used to obtain a target image captured for the mask to be detected, and determine a marking area from the target image, where the marking area includes an array of edge fixed points of the mask to be detected;

[0013] A module for determining an area to be detected, used to obtain the area to be detected according to the coverage area between the marked area and the mask edge boundary of the mask to be detected in the target image;

[0014] A background area determination module, used to determine the background area of ​​the mask to be detected from the target image based on the marked area;

[0015] A target area acquisition module is used to remove the ear band interference from the detection area based on the ear band interference area when there is an ear band interference area in the background area to obtain the target area;

[0016] An edge region detection module is used to determine the edge region of the mask to be detected according to the target region and the marked region, wherein the edge region is the region between the boundary line of the region in the marked region close to the edge boundary of the mask and the edge boundary of the mask;

[0017] The margin detection module is used to obtain the mask margin detection result of the mask to be detected based on the edge area.

[0018] In a third aspect, the present application provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method when executing the computer program.

[0019] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.

[0020] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps in the above method.

[0021] The above-mentioned mask margin detection method, device, computer equipment, computer-readable storage medium and computer program product determine the marking area including the edge fixed point array of the mask to be detected from the target image obtained by shooting the mask to be detected, determine the background area of ​​the mask to be detected from the target image based on the marking area, and when there is an ear band interference area in the background area, remove the ear band interference from the area to be detected obtained according to the covering area between the marking area and the mask edge boundary of the mask to be detected to obtain the target area, and determine the edge area of ​​the mask to be detected according to the target area and the marking area, and then obtain the mask margin detection result of the mask to be detected based on the edge area. Compared with the traditional mask margin detection technology, the background area of ​​the mask to be detected is determined from the target image based on the marking area, and the ear band interference area in the background area is used to remove the ear band interference for the area to be detected, so as to determine the edge area of ​​the mask to be detected according to the obtained target area, and the ear band interference can be accurately removed by using the marking area where the mask edge fixed point array is located to ensure the detection accuracy of the mask edge area, thereby improving the accuracy of mask margin detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 An application environment diagram of a mask margin detection method provided in an embodiment of the present application;

[0023] Figure 2 A schematic diagram of a process for detecting a mask margin provided in an embodiment of the present application;

[0024] Figure 3 A schematic diagram of a process for determining an edge area provided in an embodiment of the present application;

[0025] Figure 4 A structural block diagram of a mask margin detection device provided in an embodiment of the present application;

[0026] Figure 5 A schematic diagram of a mask array in a mask margin detection method provided in an embodiment of the present application;

[0027] Figure 6 A schematic diagram of a marking area in a mask margin detection method provided in an embodiment of the present application;

[0028] Figure 7 A schematic diagram of a background area in a mask margin detection method provided in an embodiment of the present application;

[0029] Figure 8 A schematic diagram of a background area in a mask margin detection method provided in an embodiment of the present application;

[0030] Fig. 9 A schematic diagram of an analysis area in a mask margin detection method provided in an embodiment of the present application;

[0031] Fig.10 A schematic diagram of an analysis area in a mask margin detection method provided in an embodiment of the present application;

[0032] Fig.11 A schematic diagram of the ear band interference area in a mask margin detection method provided in an embodiment of the present application;

[0033] Fig.12 A schematic diagram of an edge area in a mask margin detection method provided in an embodiment of the present application;

[0034] Fig.13 A schematic diagram of an edge area in a mask margin detection method provided in an embodiment of the present application;

[0035] Fig.14 A schematic diagram of an elliptical area in a mask margin detection method provided in an embodiment of the present application;

[0036] Fig.15 A schematic diagram of a process for detecting a mask margin provided in an embodiment of the present application;

[0037] Fig.16 A structural block diagram of a mask margin detection device provided in an embodiment of the present application;

[0038] Fig.17 An internal structure diagram of a computer device provided in an embodiment of the present application;

[0039] Fig.18 An internal structure diagram of another computer device provided in an embodiment of the present application;

[0040] Fig.19 An internal structure diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0042] The mask margin detection method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through a communication network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 can obtain the target image obtained by shooting the mask to be detected, and send the target image to the server 104 through the communication network, so that the server 104 performs mask margin detection processing. Specifically, the server 104 determines the marked area including the edge fixed point array of the mask to be detected from the obtained target image, determines the background area of ​​the mask to be detected from the target image based on the marked area, and when there is an ear band interference area in the background area, the ear band interference is eliminated for the area to be detected according to the coverage area between the marked area and the mask edge boundary of the mask to be detected, and obtains the target area, and determines the edge area of ​​the mask to be detected according to the target area and the marked area, and then obtains the mask margin detection result of the mask to be detected based on the edge area, wherein the mask margin can be the spacing between the marked area where the edge fixed point array of the mask to be detected is located and the mask edge boundary. The server 104 can feed back the mask margin detection result to the terminal 102.

[0043] In some embodiments, the mask margin detection method can also be implemented independently by the terminal 102 or the server 104. Specifically, the terminal 102 can directly perform mask margin detection based on the captured target image, or the server 104 can directly obtain the target image from the data storage system for mask margin detection.

[0044] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0045] like Figure 2 As shown, the embodiment of the present application provides a mask margin detection method, which is applied to Figure 1 The computer device such as the terminal 102 or the server 104 in the example is used for explanation. It can be understood that the computer device may include at least one of a terminal and a server. The method includes the following steps:

[0046] S202, obtaining a target image captured for the mask to be detected, and determining a marking area from the target image, where the marking area includes an edge fixed point array of the mask to be detected.

[0047] Among them, the mask to be detected is a mask that needs to be detected for margin detection, and specifically can include masks produced and output by the production line. The target image is an image taken for the mask to be detected, and specifically multiple images taken for the mask to be detected from different viewing angles. For example, in order to ensure the comprehensive detection of the mask surface, the masks to be detected produced and output by the production line can be photographed by setting multiple cameras at different positions, thereby obtaining multiple target images. The marking area is an area in the target image that includes the edge fixed point array of the mask to be detected, and the edge fixed point array is an array formed by the fixed points in the edge area of ​​the mask. The fixed points can specifically include the welding points of the mask, such as the welding points formed based on the ultrasonic welding technology in the mask production process, which are used to tightly connect the various parts of the mask together to form a complete protective layer. In the image obtained by shooting the mask, the edge fixed point array will appear as a white point array in the image. Based on the edge fixed point array, the edge of the mask can be positioned to achieve mask margin detection. The mask margin can be the spacing between the marking area where the edge fixed point array is located and the mask edge boundary, which can be specifically obtained according to the distance between the regional boundary close to the mask edge boundary in the analysis area and the mask edge boundary.

[0048] Specifically, the mask to be detected can be photographed to obtain a target image for mask margin detection. In specific applications, a camera can be set in the production line of the mask to perform margin detection on the mask produced by the production line. In some embodiments, at least two candidate images can be photographed for the same mask to be detected, and the computer device can use each candidate image as the target image to perform margin detection on each target image respectively. The computer device can also filter out at least part of the target image from each candidate image obtained by the shooting for margin detection. In some embodiments, for at least two candidate images obtained by each camera, the computer device can analyze the target camera corresponding to the viewing angle that is prone to margin abnormality based on the historical margin detection results of the mask production line, and use the image taken by the target camera as the target image. The computer device can obtain the target image obtained by the camera, and perform edge fixed point array recognition on the target image. Specifically, object recognition can be performed on the target to identify the marking area including the edge fixed point array.

[0049] In some embodiments, for the target image obtained, the computer device can perform preprocessing on the target image and then determine the marked area. The preprocessing may include scaling, filtering and denoising, grayscale processing, binarization processing and other processing, so that the mask area of ​​the mask to be detected can be preliminarily extracted from the target image. For the processed target image, the computer device can solve the problem of uneven illumination through histogram equalization, and then extract the marked area of ​​the mask to be detected through dynamic threshold segmentation and morphological operations. The extracted marked area can be used as the Mark area for mask margin detection. In some embodiments, in order to prevent the wrong positioning of the Mark area, the minimum distance between each Mark area and the mask area can be calculated. Since the Mark area is located at the edge of the mask, the interference area can be filtered by setting the distance threshold, so that the Mark area can be accurately extracted.

[0050] S204, obtaining the area to be detected according to the covered area between the marked area and the mask edge boundary of the mask to be detected in the target image.

[0051] The mask edge boundary refers to the edge line of the mask to be detected in the target image, and the area enclosed by the mask edge boundary is the mask to be detected in the target image. The area to be detected is the area in the target image used for mask margin detection, which is specifically obtained by the area enclosed by the marked area and the mask edge boundary.

[0052] Exemplarily, the computer device can determine the mask edge boundary of the mask to be detected in the target image, and the specific computer device can further extract the distribution area of ​​the mask to be detected in the target image after pre-processing such as scaling, filtering and denoising, grayscale processing, and binarization processing for the target image, and the computer device can determine the mask edge boundary of the mask to be detected according to the distribution area of ​​the mask to be detected in the target image. The computer device can determine the coverage area between the marked area and the mask edge boundary, and obtain the area to be detected according to the coverage area. In some embodiments, the computer device can determine the coverage area enclosed between the marked area and the mask edge boundary, and use the coverage area as the area to be detected for mask margin detection in the target image.

[0053] S206: Determine the background area of ​​the mask to be detected from the target image based on the marked area.

[0054] The background area is an area in the target image that is the background of the mask to be detected, that is, the background area belongs to an area in the target image that does not include the mask to be detected. Optionally, the computer device can determine the background area of ​​the mask to be detected from the target image based on the marked area, and the computer device can perform an expansion operation based on the marked area, and extract the background area of ​​the mask to be detected based on the expansion result.

[0055] S208: When there is an ear band interference area in the background area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain a target area.

[0056] The earband interference area is the area where the earband exists. The earband is the band that connects the mask body to the wearer's ears in the mask to be tested. If there is an earband interference area in the background area, there may also be earband interference in the area to be tested, which will interfere with the margin detection of the mask to be tested. It needs to be removed in advance to ensure the accuracy of the mask margin detection. The target area is the area obtained by removing the earband interference from the area to be tested.

[0057] Optionally, the computer device may perform ear band detection on the background area to determine whether there are ear bands in the background area. When it is determined that there is an ear band interference area in the background area, the computer device may perform ear band interference elimination on the area to be detected based on the ear band interference area, thereby removing the ear band interference in the area to be detected and obtaining the target area.

[0058] S210, determining the edge area of ​​the mask to be detected according to the target area and the marked area, where the edge area is the area between the boundary line of the area in the marked area close to the edge boundary of the mask and the edge boundary of the mask.

[0059] The edge region is the region in the mask to be detected for determining the margin, that is, the margin of the mask to be detected can be determined based on the width of the edge region. Specifically, the edge region is the region between the region boundary line close to the mask edge boundary in the marking region and the mask edge boundary. The edge region can be used as the region between the edge fixed point array and the mask edge boundary in the mask to be detected, and the mask margin of the mask to be detected can be determined based on the width of the edge region.

[0060] Exemplarily, the computer device can determine the edge area of ​​the mask to be detected based on the target area and the marked area, and the computer device can further remove the marked area from the target area to obtain the edge area of ​​the mask to be detected. For example, the computer device can determine the region boundary line in the marked area close to the edge boundary line of the mask, and determine the area enclosed between the region boundary line and the edge boundary line of the mask, so as to obtain the edge area of ​​the mask to be detected.

[0061] S212. Obtaining a mask margin detection result of the mask to be detected based on the edge area.

[0062] Specifically, the computer device can perform margin detection based on the edge area. For example, the computer device can measure the width of the edge area to obtain the mask margin detection result of the mask to be detected.

[0063] It can be seen that in the embodiment of the present application, from the target image obtained by shooting the mask to be detected, the marking area including the edge fixed point array of the mask to be detected is determined, and the background area of ​​the mask to be detected is determined from the target image based on the marking area. When there is an ear band interference area in the background area, the ear band interference is eliminated for the area to be detected obtained according to the covering area between the marking area and the mask edge boundary of the mask to be detected, and the target area is obtained, and the edge area of ​​the mask to be detected is determined according to the target area and the marking area, and then the mask margin detection result of the mask to be detected is obtained based on the edge area. Compared with the traditional mask margin detection technology, the background area of ​​the mask to be detected is determined from the target image based on the marking area, and the ear band interference area in the background area is used to eliminate the ear band interference for the area to be detected, so as to determine the edge area of ​​the mask to be detected according to the obtained target area, and the ear band interference can be accurately eliminated by using the marking area where the mask edge fixed point array is located, so as to ensure the detection accuracy of the mask edge area, thereby improving the accuracy of mask margin detection.

[0064] In some embodiments, when there is an ear band interference area in the background area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain the target area, including: offsetting the background area in a direction away from the mask to be detected to obtain the offset background area; obtaining the analysis area based on the intersection area between the background area and the offset background area; when there is an ear band interference area in the analysis area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain the target area.

[0065] The direction away from the mask to be detected may be a direction formed by taking the center point of the mask to be detected as the starting point and the center point of the marked area as the end point. The analysis area is an area determined from the background area for analyzing ear band interference.

[0066] Exemplarily, the computer device may offset the background area to the outer direction of the mask to be detected by a certain distance, specifically in the direction away from the mask to be detected, to obtain the offset background area. The computer device can extract the analysis area of ​​the mask to be detected based on the offset background area for the background area. In some embodiments, the computer device can determine the intersection area between the background area and the offset background area, and obtain the analysis area away from the mask to be detected according to the intersection area. The computer device can perform ear band interference identification for the analysis area to determine whether there is an ear band interference area in the analysis area. When it is determined that there is an ear band interference area in the analysis area, the computer device can remove the ear band interference from the area to be detected based on the ear band interference area. Specifically, the area to be removed from the area to be detected can be determined based on the ear band interference area. After the computer device removes the ear band interference in the area to be detected, the target area can be obtained.

[0067] It can be seen that in this embodiment, after the computer device offsets the background area in the direction away from the mask to be detected, the analysis area is determined based on the intersection area between the background area and the offset background area, and when there is an ear band interference area in the analysis area, the ear band interference of the area to be detected is eliminated based on the ear band interference area to obtain the target area, so that the ear band interference area in the background area can be used to accurately eliminate the ear band interference of the area to be detected, thereby ensuring the accuracy of the target area, thereby improving the accuracy of the mask margin detection based on the target area.

[0068] In some embodiments, when there is an ear band interference area in the analysis area, ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain a target area, including: when there is an ear band interference area in the analysis area, an interference fitting area is constructed based on the ear band interference area; an intersection area with the interference fitting area is eliminated from the area to be detected to obtain the area to be detected after the ear band interference is eliminated; and a target area is obtained based on the area to be detected after the ear band interference is eliminated.

[0069] The interference fitting area is constructed based on the ear band interference area in the analysis area, and is used to remove the ear band interference from the area to be detected. The construction method, shape and size of the interference fitting area can be flexibly set according to actual needs.

[0070] Optionally, the computer device can identify ear band interference for the analysis area, specifically based on an object recognition algorithm, such as Blob (Binary Large Object, binary large object) analysis method, target recognition algorithm based on deep learning, template matching method, object recognition method based on feature points and other various algorithms at least one. In some embodiments, when there is an ear band in the analysis area, the ear band and the background area will have a large contrast due to the imaging of the backlight source, and the ear band area of ​​interference can be well segmented by threshold segmentation and morphology, thereby determining the ear band interference area. The computer device can construct an interference fitting area based on the ear band interference area, specifically, the center point of the ear band interference area can be used as the starting point, and the center point of the mask to be detected can be used as the end point to perform rectangular fitting, thereby obtaining a rectangular interference fitting area. The computer device can determine the intersection area between the interference fitting area and the area to be detected, and the intersection area is the area where there is ear band interference in the area to be detected. The computer device can remove the intersection area from the area to be detected, thereby obtaining the area to be detected after the ear band interference is removed. The computer device can obtain the target area according to the area to be detected after the ear band interference is removed. In some embodiments, the computer device can directly use the area to be detected after the ear band interference is eliminated as the target area, or can obtain the target area after smoothly connecting the area to be detected after the ear band interference is eliminated. For example, the target area can be obtained by performing Blob analysis based on the area to be detected after the ear band interference is eliminated.

[0071] It can be seen that in this embodiment, the computer device constructs an interference fitting area based on the ear band interference area in the analysis area, eliminates the intersection area between the area to be detected and the interference fitting area, and obtains the target area based on the area to be detected after the ear band interference is eliminated. Therefore, the ear band interference in the area to be detected can be accurately eliminated based on the ear band interference area in the analysis area, thereby ensuring the accuracy of the target area, thereby improving the accuracy of mask margin detection based on the target area.

[0072] In some embodiments, Figure 3 As shown, the process of determining the edge area, i.e. determining the edge area of ​​the mask to be detected according to the target area and the marked area, includes the following steps:

[0073] S302: Eliminate the marked area from the target area to obtain an updated target area.

[0074] For example, after obtaining the target area without ear band interference, the computer device can further remove the marked area to update the target area and obtain an updated target area. The target area is obtained by removing the ear band interference from the area to be detected, and the area to be detected is obtained according to the coverage area between the marked area and the edge boundary of the mask. After removing the marked area from the target area, an area for detecting margin detection can be obtained.

[0075] S304: Perform region connectivity processing based on the updated target region to obtain a connected region.

[0076] For example, after removing the ear band interference and the marked area, there may be interruptions in the updated target area, and the computer device may connect the updated target area, such as by using a Blob analysis algorithm to connect the updated target area to obtain a connected area.

[0077] S306: Perform smoothing processing based on the edges of the connected area to obtain the edge area of ​​the mask to be detected.

[0078] Optionally, the computer device may smooth the edges of the connected area. Specifically, the computer device may fit an externally rotated rectangle based on the connected area, and obtain the edge area of ​​the mask to be detected based on the fitted rectangle. The computer device may perform mask margin detection based on the edge area.

[0079] It can be seen that in this embodiment, the computer device removes the marked area from the target area and then performs regional connectivity and smoothing processing in sequence, thereby obtaining an edge area for mask margin detection. By using the marked area to accurately remove ear band interference to ensure the detection accuracy of the mask edge area, the accuracy of mask margin detection is improved.

[0080] In some embodiments, a mask margin detection result of a mask to be detected is obtained based on an edge area, including: dividing the edge area into multiple sub-areas, and fitting a corresponding elliptical area for each sub-area; determining the main axis direction of the corresponding sub-area based on the elliptical area, and for each sub-area, obtaining the spacing data of the sub-area according to the distance between a point on the main axis of the sub-area and the intersection of the sub-area in the vertical direction; screening and optimizing the spacing data of each sub-area to obtain the respective area spacing of each sub-area; and obtaining the mask margin detection result of the mask to be detected based on the respective area spacing of each sub-area.

[0081] Among them, the sub-region is obtained by dividing the edge region, so that the curvature of the edge region can be reduced, and the number of divided sub-regions can be determined according to the curvature of the edge region. The elliptical region is fitted based on the sub-region, so that the edge of the sub-region can be further smoothed to ensure the detection accuracy of the mask margin. The main axis direction can be the direction corresponding to the major axis of the elliptical region, the main axis can be a line segment constructed according to the main axis direction, and the spacing data is the distance between the points on the main axis and the intersection of the sub-region in the vertical direction. For each point on the main axis, the corresponding spacing data can be determined respectively, so as to serve as the spacing data of the sub-region to which it belongs. The regional spacing corresponding to each sub-region can be determined based on the spacing data corresponding to the sub-region, such as can be obtained after screening and optimization based on each spacing data.

[0082] Exemplarily, the computer device may divide the edge area to obtain a plurality of sub-areas, and specifically, at least two sub-areas may be divided. In some embodiments, the computer device may determine the number of sub-areas to be divided based on the area length and curvature of the edge area, and divide each sub-area according to the determined number. The computer device may perform fitting for each sub-area to construct a corresponding elliptical area. For the constructed elliptical area, the computer device may determine the main axis direction of the sub-area based on the elliptical area, such as the direction of the long axis of the elliptical area may be used as the main axis direction of the sub-area. For each sub-area, the computer device may construct a corresponding main axis based on the main axis direction of the sub-area, and traverse the points on the main axis, determine the intersection of the points on the main axis with the sub-area in the vertical direction, and obtain the spacing data of the sub-area based on the distance between the points on the main axis and the corresponding intersection. For each point on the main axis, the spacing data may be determined based on the corresponding intersection, so that a plurality of spacing data may be obtained. For each sub-area, a plurality of spacing data may be determined respectively, and the computer device may determine the regional spacing of the sub-area according to the plurality of spacing data corresponding to the sub-area. Specifically, the computer device can screen and optimize multiple spacing data, such as removing the end position data, removing the maximum and minimum values, and other extreme values, and determining the regional spacing of the sub-regions by statistical average values ​​and other screening optimization methods. After the computer device traverses each sub-region, the computer device can perform statistics based on the respective regional spacing of each sub-region to obtain the mask margin detection result of the mask to be detected according to the statistical results. The mask margin detection result may include at least one of the average value, maximum value, minimum value, standard deviation or variance of the mask margin.

[0083] It can be seen that in this embodiment, the computer device divides the edge area into multiple sub-areas and then constructs corresponding elliptical areas respectively, determines the main axis direction of the corresponding sub-area based on the elliptical area, and for the main axis direction of each sub-area, obtains the spacing data of the sub-area according to the distance between the point of the sub-area on the main axis and the intersection of the sub-area in the vertical direction, and screens and optimizes the spacing data to obtain the regional spacing of each sub-area, thereby determining the mask margin detection result of the mask to be tested. By dividing the edge area into multiple sub-areas and then performing mask margin detection, the impact of the detection accuracy caused by the curvature of the edge area can be reduced, thereby improving the accuracy of the mask margin detection.

[0084] In some embodiments, determining a marked area from a target image includes: determining a mask area including a mask to be detected from the target image; determining an edge fixed point array of the mask to be detected from the mask area, and obtaining the marked area based on a distribution area of ​​the edge fixed point array in the mask area.

[0085] Among them, the mask area is the area covered by the mask to be detected in the target image, which can be obtained by performing object recognition on the target image. Exemplarily, the computer device can perform mask detection on the target image to determine the mask area including the mask to be detected in the target image. The computer device can perform edge fixed point array detection on the mask area, such as edge welding points in the mask to be detected to determine the distribution area of ​​the edge fixed point array in the mask area, and the computer device can obtain the marked area according to the distribution area.

[0086] It can be seen that in this embodiment, after the computer device determines the mask area from the target image, it determines the marked area where the edge fixed point array is located from the mask area, so that the background area of ​​the mask to be detected can be determined from the target image based on the marked area, and the background area can be used to perform mask margin detection, which can improve the accuracy of mask margin detection.

[0087] In some embodiments, after obtaining the mask margin detection result of the mask to be detected based on the edge area, the mask margin detection method also includes: comparing the spacing statistics in the mask margin detection result with a preset spacing threshold to obtain a spacing comparison result; and determining the mask quality detection result of the mask to be detected based on the spacing comparison result.

[0088] Wherein, the mask margin detection result includes a spacing statistic value, and the spacing statistic value may include but is not limited to at least one of the average value, maximum value, minimum value, standard deviation or variance of the mask margin. The spacing threshold is used to determine the quality of the mask, and the specific value of the spacing threshold can be flexibly set according to actual needs. Optionally, the computer device can obtain a preset spacing threshold, and compare the spacing statistic value in the mask margin detection result with the spacing threshold to obtain a spacing comparison result. The computer device can obtain a mask quality detection result for the mask to be detected based on the spacing comparison result.

[0089] It can be seen that in this embodiment, the computer device compares the spacing threshold with the spacing statistics in the mask margin detection result to perform mask quality detection on the mask to be detected, thereby ensuring the accuracy of the mask quality detection result.

[0090] The present application also provides an application scenario, which applies the above-mentioned mask margin detection method. Specifically, the application of the mask margin detection method in this application scenario is as follows:

[0091] In recent years, with the intensification of global environmental pollution and the spread of infectious diseases, masks have become an important product for people to protect their health. The edge spacing of masks is an important indicator of mask quality, which has a direct impact on the sealing and protective effect, functionality, comfort, appearance quality and overall quality of masks. Therefore, ensuring that the edge spacing of masks is appropriate and consistent is a key link that cannot be ignored in the mask production process.

[0092] The existing technology mainly includes the following detection methods:

[0093] 1. Mechanical measurement method: Use manual or automated mechanical probes to measure the distance between the edges of the mask. This method uses a probe to contact the edge of the mask and records the distance through a sensor. The specific implementation steps are that the mechanical probe is designed to be fixed in a specific position, and is applied to the edge of the mask by moving or rotating to obtain the maximum and minimum edge spacing.

[0094] 2. Optical measurement method: Use a photosensitive sensor or laser device to measure the distance between the edge of the mask and the standard reference point. These optical devices convert light into data records by reflecting or refracting light. The specific implementation steps are to place the mask on the detection platform under a specific light environment, and the optical device emits light and detects the reflected light distance to calculate the width data.

[0095] 3. Image processing method: Use a camera to obtain the edge image of the mask, and detect the edge spacing through an image processing algorithm. This includes the use of image processing techniques such as edge detection and contour extraction. Specific implementation steps: The mask is placed under the camera, continuous images are obtained, and the edges in the image are analyzed through a specific software algorithm to calculate the corresponding spacing parameters.

[0096] Although the above methods can realize mask edge spacing detection to a certain extent, they have the following defects:

[0097] 1. Disadvantages of mechanical measurement: Contact measurement can easily damage the mask. Since the probe needs to physically contact the edge of the mask, the mask material may be damaged, especially for disposable masks. The measurement accuracy is limited. The mechanical probe has a certain error in the detection of small distances. In particular, the wear of mechanical parts and the stability of the probe will affect the measurement results. Low efficiency. Mechanical measurement generally requires detection one by one, which is inefficient and difficult to adapt to an efficient production environment.

[0098] 2. Disadvantages of optical measurement: Ambient light influence, optical equipment is highly sensitive to ambient light, light intensity changes or external interference will affect the measurement accuracy. Surface reflection limitation, different materials on the surface of the mask have inconsistent reflection characteristics, which can easily cause measurement errors.

[0099] 3. Disadvantages of image processing: The algorithm is highly complex and has high requirements for the position of the mask. The mask needs to be placed accurately during detection. Displacement and angle changes may lead to deviations in image analysis results. The biggest interference comes from the influence of the ear straps, which are connected to the edge of the mask. Due to the unstable position and different placement of the ear straps in real-time detection, they often appear in the measurement area and are easily mistaken for the edge of the mask, resulting in inaccurate edge detection results.

[0100] In summary, various existing mask margin detection methods have their own advantages and disadvantages, but they all have certain shortcomings in practical applications. Based on this, this embodiment proposes a highly robust mask margin measurement method through image processing, which can effectively improve detection accuracy and efficiency and reduce environmental and equipment errors, which is very necessary.

[0101] This embodiment aims to propose a highly robust mask margin detection method, which realizes accurate detection and measurement of mask edge spacing through image processing technology. The method combines a variety of image processing methods, including Blob analysis, inter-region distance measurement, region segmentation filtering, region width calculation along the main axis and other algorithms and data processing optimization to solve the problems of low accuracy, poor real-time performance and poor adaptability to complex scenes in existing mask margin measurement methods. By improving the accuracy, stability and robustness of mask margin measurement, the present invention aims to optimize the mask quality inspection process on the mask production line, improve mask production efficiency and quality standards, thereby promoting the development of the mask manufacturing industry and improving the quality level of mask products.

[0102] Specifically, in order to improve compatibility, the detection device designed in this embodiment is used to be installed on the original mask production line, and can be seamlessly connected with the mask production site. The discharge port of a general mask production line is transported by belt clamping. Therefore, a clamping belt and a sensor are designed at the discharge port, and the motor drives the belt for transmission. After calculating the motor movement distance, the camera is triggered to take pictures at each point. After the flying shot is completed, the algorithm processing is summarized to control the movement of the unloading sorting component to achieve the function of classifying good and defective products. Due to the existence of the belt, there is a blind spot in the field of vision of the product photographed by the camera. Therefore, the belt is designed into two sections of different heights, one section clamps the upper edge of the mask, and the other section clamps the lower edge of the mask, so as to cover all the fields of vision of the product in the camera imaging.

[0103] In order to achieve full inspection of the mask surface, 4 cameras are used to take pictures, and 2 cameras on each of the two belts take images of the mask. In order to improve the image acquisition time, a USB3.0 camera is used. The theoretical maximum transmission rate of USB3.0 is five times that of the Gigabit network port. The bandwidth is larger, so the camera takes pictures faster, which can speed up the production line. In terms of light source design, for the purpose of mask spacing measurement, a backlight solution is adopted. The backlight can create high-contrast lighting conditions between the object to be detected and its surroundings. By making the outline of the object to be detected present a bright edge in the image, the details and boundaries of the object can be highlighted. This makes the measurement items clearer and more accurate, which is conducive to reducing the error of spacing measurement. In addition, in order to improve the scalability of the mask machine, each camera assumes 2 strip lights in addition to the backlight. The strip light source can produce alternating light and dark shadows, making the defects such as tiny bumps, dirt or foreign matter on the flat surface more obvious. It can be used to image other defects of the mask, and reserve detection items to improve the scalability of the equipment. Therefore, when the material passes by, each camera controls the backlight to light up for the first time, and turns it off after taking the picture. It controls the light bar to light up for the second time, and turns it off after taking the picture, thus completing the image acquisition process of a product.

[0104] like Figure 4 As shown, in the application of this embodiment, the motor drives the belt to transmit the masks produced by the production line, and the camera detection component takes pictures of the masks to obtain the corresponding target image. Among them, the material sorting component can be used to sort materials, the industrial computer is used for software control, the display and keyboard bracket are used for detection result display and command input, and the gas source inlet is used to control gas in and out.

[0105] Since the detection mechanism in the present embodiment is a flying shooting scheme, in order to keep up with the speed of the mask production line, the response time of the software must be compressed. The software adopts a multi-threaded parallel execution scheme in design. Each camera has an independent picture acquisition thread. After receiving the photo signal, the software controls the light source to light up, the camera actively collects pictures, and executes the image of the backlight and the strip light twice in a loop. The entire sequence of actions is completed in a sub-thread. The algorithm adopts a producer-consumer mode. When the producer monitors that there is a new image, it sends it to the data queue and notifies the consumer thread. The consumer pops up the first data from the queue, processes the image algorithm, and after the operation is completed, the result is notified to other threads in an asynchronous manner. The interactive design communication class of the software and the electrical class is designed to be asynchronously executed in the same way as the algorithm class. Therefore, the software architecture is a three-level pipeline mode, with interactive communication between thread queues, the picture acquisition thread obtains the image, runs the algorithm thread until the algorithm processing result, and notifies the communication thread to control the electrical material sorting component to run to achieve the classification purpose. The project uses 4 cameras and each camera takes pictures at a different time. To realize the summary of product results, the results of each material need to be saved in each communication thread according to time. After the last camera is processed, the first data of each camera queue result is taken out. Since the products are fed in the order of the assembly line, the order of the products in the result queue of each camera is consistent. The first data of all cameras is summarized to finally control the product classification. After testing and verification, the action CT (Cycle Time) of the entire equipment can reach 0.4s / pcs (seconds / piece).

[0106] The computer equipment can perform preprocessing on the target image taken by the detection mechanism. In order to improve the measurement accuracy, a 20 million pixel camera is selected to scale the image length and width to one-third for preprocessing and positioning, which can effectively improve the detection speed. Specifically, the collected images can be filtered, denoised, grayed, binarized, and other processes to extract the mask area first. In order to eliminate the influence of the pattern in the middle of the mask, the edge area of ​​the mask can be located first. A large filter core is used to corrode the mask area, and the mask edge area is obtained by differentially comparing it with the original area. Most masks on the market have an array of white dots on the edge area, and this feature can be used as the Mark point information of the image for positioning. The uneven illumination problem is solved by histogram equalization, and then the mask Mark point area can be extracted by dynamic threshold segmentation and morphological operations, that is, the marked area including the edge fixed point array is determined from the target image. In order to prevent the wrong positioning of the Mark area, the minimum distance between each Mark area and the mask area is calculated. Since the Mark area is located at the edge of the mask, the interference area can be filtered by the card distance threshold, so that the Mark area can be accurately extracted. As Figure 5As shown, 501 is a mask to be detected in the target image, 502 is an edge fixed point distributed in the edge area of ​​the mask to be detected, and a plurality of edge fixed points included in the edge area form an array. Figure 6 As shown, 601 is the marked area identified from the target image, and the marked area covers the edge fixed point array of the mask to be detected.

[0107] Furthermore, the target is located based on the marked area, specifically looping through each Mark area and performing a large coefficient dilation operation, and extracting the background area in the area through blob analysis. Figure 7 As shown, 701 is the background area of ​​the mask to be detected determined from the target image; Figure 8 As shown, 801 is also the background area of ​​the mask to be detected determined in the target image, that is, at least one background area can be identified from the target image. Further, first determine whether the Mark area is interfered by the ear strap, that is, determine whether the marked area is interfered by the ear strap. Specifically, take the center point of the mask as the starting point, the center point of the Mark area as the end point, and the connecting line as the direction, and offset it a certain distance toward the outer side of the mask. Through the intersection operation with the original area, a new judgment area is generated to identify whether there is ear strap interference. This area is the bottom edge area of ​​the background area, that is, the analysis area of ​​the mask to be detected is obtained. As shown Fig. 9 As shown, 901 is an analysis area determined from the background area and away from the mask to be detected; Fig.10 As shown, 1001 is another analysis area determined from the background area and away from the mask to be detected.

[0108] For the bottom area, when there is an ear band, the contrast between the ear band and the background area is large due to the imaging of the backlight source. The interfering ear band area can be well segmented through threshold segmentation and morphology. Fig.11 As shown, 1101 is the ear band interference area determined from the analysis area. If the ear band interference area is detected, the center point of the ear interference area is the starting point, the center point of the mask is the end point, and the connecting line is the direction. This direction is used as the new coordinate system to perform rectangular fitting on the ear band interference area. The area in the direction of the connecting line is extended to intersect with the area to be inspected, and the ear band interference area is removed through regional operations to prevent mispositioning errors. The difference between the area to be inspected and the Mark area is calculated to obtain a new target area. After the above operations, it is ensured that there are no interference areas such as ear bands in this area. Then, the real area of ​​the mask edge outside the Mark array points is obtained through Blob analysis. Fig.12As shown, 1201 is the edge area of ​​the mask to be detected determined based on the target area and the marked area. The edge area is the area between the boundary line of the area close to the edge boundary of the mask in the marked area and the edge boundary of the mask. Since the ends of the edge area are uneven, there will be errors in calculating the spacing, so the end data needs to be removed. Specifically, the circumscribed rotated rectangle is fitted, and a new area is generated by reducing the value in the long axis direction and intersecting with the original area to obtain a new edge area with the ends removed. Fig.13 As shown, 1301 is the edge area obtained after smoothing.

[0109] Furthermore, the final area of ​​positioning is calculated from the reduced image. It is necessary to restore the area to the original pixel size and multiply the area by a coefficient to enlarge it to restore it to the original image size. Re-execute the Blob analysis and traverse the target area to calculate the distance to the center point of the mask. Filter the misidentified area through the distance threshold to ensure that the final target area is extracted.

[0110] First, the larger target area is cut into several small areas at equal lengths to reduce the curvature of the area. For each area, the geometric moment is calculated, and the geometric moment parameters M11, M20 and M02 of the area are obtained. Then, the main axis direction of the area is calculated from the geometric moment parameters. Input the geometric parameters and output the main axis length, direction and center position of the fitted ellipse. The following formula:

[0111]

[0112] Phi=-0.5atan2(2M 11 ,M 02 -M 20 )

[0113] Among them, Phi is the calculated main axis angle. The center point of the calculation area Row, Column is the center point of the main axis. According to the main axis parameters major axis radius Ra and main axis angle Phi, the main axis can be obtained:

[0114] Coordinates of the starting point of the main axis: (StartRow, StartColumn) = (Row + sin(Phi)*Ra, Column - cos(Phi)*Ra);

[0115] Coordinates of the end point of the main axis: (EndRow, EndColumn) = (Row-sin(Phi)*Ra, Column+cos(Phi)*Ra).

[0116] The edge area has jagged edges due to the characteristics of the Mark array. To reduce errors, the edges need to be smoothed. Fig.14As shown, 1401 is the main axis, and 1402 is the elliptical area used to determine the area spacing.

[0117] Further, the regional thickness is calculated for the elliptical area. Specifically, the distance between each point on the main axis and the intersection of the regional contour in the vertical direction is the regional spacing at this position. Traverse each point on the main axis to calculate the spacing value, obtain an array with a large amount of data, and record the regional spacing of each point along the main axis. When further optimizing the data, specifically, by looping through the spacing data, specify the starting index and the ending index to remove the end data. The end data has errors due to the calculation method, so it is eliminated by the index number. The average value within multiple continuous values ​​is calculated starting from the starting index. The number of consecutive intervals is the smoothing size, which can be adjusted according to demand. The average value in the current window is obtained by dividing the accumulated value in the interval by the smoothing size. In this way, the average thickness information within a certain range can be obtained, so that the data is smoothed and the influence of noise is reduced. Finally, by traversing the average values ​​of all intervals, the elements with the maximum and minimum average values ​​and the corresponding indexes are found. In this way, the maximum spacing and the minimum spacing of the area can be determined. The maximum and minimum spacing of all areas are traversed, and the final minimum and maximum spacing of the output mask is compared, and the threshold card control can be used to determine whether the mask has a qualified spacing.

[0118] In this embodiment, the overall process is as follows Fig.15As shown, after obtaining the captured image, pre-processing is performed, specifically, scaling processing can be performed, specifically resizing the image to reduce the size; extracting the edge area of ​​the mask and locating the Mark array feature, expanding the Mark array feature area, merging adjacent Mark points into one area, and obtaining the marked area. Further, for target positioning processing, specifically expanding the Mark area and performing Blob analysis to obtain the background area, obtaining the bottom area of ​​the background area along the center point of the mask, that is, obtaining the analysis area. Based on threshold segmentation, it is determined whether there is ear band interference in the bottom area. If so, a rotating rectangle is fitted based on the ear band area along the center point of the mask, and the rotating rectangle is calculated with the Mark area to eliminate the ear band area to obtain the target area; if there is no ear band interference, the target area can be directly obtained according to the bottom area. For the target area, it can be restored to the original size for resize, and threshold segmentation can be performed based on the Mark area to locate the edge area of ​​the mask, and the end area of ​​the edge area of ​​the mask is eliminated, so as to obtain the edge area of ​​the mask to be detected. When calculating and measuring the margin of the edge area, a circumscribed rectangle can be fitted based on the edge area, and it can be divided into multiple sub-areas equidistantly along the long axis direction, and an ellipse can be fitted to obtain the main axis direction and angle. For the fitted elliptical area, the starting point and end point of the main axis are calculated based on the center point of the elliptical area, and the edge of the area is smoothed. Each point on the main axis is traversed to obtain the distance between the two intersection points of the vertical direction and the area contour to obtain the regional thickness of the elliptical area. Data optimization is performed on the obtained test results, including smoothing and extreme value processing. After traversing all sub-areas, the final extreme value is obtained, and the minimum spacing and maximum spacing are output, so as to obtain the mask margin detection result of the mask to be tested.

[0119] The mask margin measurement method of the present embodiment can realize the full inspection of the entire edge of the mask. Ignoring the random placement of the mask, the extreme value of the mask margin is determined by algorithm processing of the image and combining data optimization, thereby improving the accuracy, stability and robustness of mask quality detection, optimizing the quality inspection process on the mask production line, and improving the mask production efficiency and quality standards. This will have a positive impact on the development of the mask manufacturing industry and the quality level of mask products.

[0120] It should be understood that, although the steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0121] Based on the same inventive concept, the embodiment of the present application also provides a mask margin detection device. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more mask margin detection device embodiments provided below can refer to the limitations of the mask margin detection method above, and will not be repeated here.

[0122] like Fig.16 As shown, the embodiment of the present application provides a mask margin detection device 1600, comprising:

[0123] A marking area determination module 1602 is used to obtain a target image captured for the mask to be detected, and determine a marking area from the target image, where the marking area includes an array of edge fixed points of the mask to be detected;

[0124] A module 1604 for determining an area to be detected is used to obtain an area to be detected according to a coverage area between the marked area and a mask edge boundary of the mask to be detected in the target image;

[0125] A background region determination module 1606, for determining the background region of the mask to be detected from the target image based on the marked region;

[0126] The target region obtaining module 1608 is used to remove the ear band interference from the detection region based on the ear band interference region when there is an ear band interference region in the background region, so as to obtain the target region;

[0127] The edge region detection module 1610 is used to determine the edge region of the mask to be detected according to the target region and the marked region, where the edge region is the region between the boundary line of the region in the marked region close to the edge boundary of the mask and the edge boundary of the mask;

[0128] The margin detection module 1612 is used to obtain the mask margin detection result of the mask to be detected based on the edge area.

[0129] In some embodiments, when there is an ear band interference area in the background area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain the target area. The target area acquisition module 1608 is specifically used to: offset the background area in a direction away from the mask to be detected to obtain the offset background area; based on the intersection area between the background area and the offset background area, determine the analysis area away from the mask to be detected from the background area; when there is an ear band interference area in the analysis area, eliminate the ear band interference from the area to be detected based on the ear band interference area to obtain the target area.

[0130] In some embodiments, when there is an ear band interference area in the analysis area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain the target area. The target area acquisition module 1608 is specifically used to: when there is an ear band interference area in the analysis area, construct an interference fitting area based on the ear band interference area; eliminate the intersection area with the interference fitting area from the area to be detected to obtain the area to be detected after the ear band interference is eliminated; obtain the target area based on the area to be detected after the ear band interference is eliminated.

[0131] In some embodiments, in terms of determining the edge area of ​​the mask to be detected based on the target area and the marked area, the edge area detection module 1610 is specifically used to: remove the marked area from the target area to obtain an updated target area; perform regional connectivity processing based on the updated target area to obtain a connected area; perform smoothing processing based on the edge of the connected area to obtain the edge area of ​​the mask to be detected.

[0132] In some embodiments, in terms of obtaining the mask margin detection result of the mask to be detected based on the edge area, the margin detection module 1612 is specifically used to: divide the edge area into multiple sub-areas, and fit a corresponding elliptical area for each sub-area; determine the main axis direction of the corresponding sub-area based on the elliptical area, and for each sub-area, obtain the spacing data of the sub-area according to the distance between the point on the main axis of the sub-area and the intersection of the sub-area in the vertical direction; screen and optimize the spacing data of each sub-area to obtain the regional spacing of each sub-area; based on the regional spacing of each sub-area, obtain the mask margin detection result of the mask to be detected by statistics.

[0133] In some embodiments, in terms of determining the marked area from the target image, the marked area determination module 1602 is specifically used to: determine the mask area including the mask to be detected from the target image; determine the edge fixed point array of the mask to be detected from the mask area, and obtain the marked area based on the distribution area of ​​the edge fixed point array in the mask area.

[0134] In some embodiments, a mask quality detection module is also included, which is used to compare the spacing statistics in the mask margin detection result with a preset spacing threshold to obtain a spacing comparison result; and determine the mask quality detection result of the mask to be detected based on the spacing comparison result.

[0135] Each module in the above mask margin detection device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0136] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Fig.17 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Wherein, the processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. Wherein, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store various data involved in the mask margin detection method. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in the above-mentioned mask margin detection method are implemented.

[0137] In some embodiments, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.18As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless method can be implemented by WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, the steps in the above-mentioned mask margin detection method are implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen; the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

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

[0139] In some embodiments, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps in the above method embodiments are implemented.

[0140] In some embodiments, Fig.19 The figure shows an internal structure diagram of a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0141] In some embodiments, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0143] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0145] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A mask margin detection method, characterized in that: include: Acquire a target image captured for the mask to be detected, and determine a marked area from the target image, wherein the marked area includes an edge fixed point array of the mask to be detected; Obtaining an area to be detected according to the marked area and the covering area between the mask edge boundary of the mask to be detected in the target image; Determine the background area of ​​the mask to be detected from the target image based on the marked area; When there is an ear band interference area in the background area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain a target area; Determine the edge area of ​​the mask to be detected according to the target area and the marked area, wherein the edge area is the area between the boundary line of the area in the marked area close to the edge boundary of the mask and the edge boundary of the mask; A mask margin detection result of the mask to be detected is obtained based on the edge area.

2. The method according to claim 1, characterized in that When there is an ear band interference area in the background area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain the target area, including: The background area is offset in a direction away from the mask to be detected to obtain a offset background area; Obtaining an analysis area based on an intersection area between the background area and the offset background area; When there is an ear band interference area in the analysis area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain a target area.

3. The method according to claim 2, characterized in that When there is an ear band interference area in the analysis area, the ear band interference is eliminated from the area to be detected based on the ear band interference area to obtain a target area, including: When there is an ear band interference region in the analysis region, constructing an interference fitting region based on the ear band interference region; Eliminate the intersection area with the interference fitting area from the area to be detected, and obtain the area to be detected after the ear band interference is eliminated; The target area is obtained based on the area to be detected after the ear band interference is eliminated.

4. The method according to claim 1, characterized in that The step of determining the edge area of ​​the mask to be detected according to the target area and the marked area includes: Eliminate the marked area from the target area to obtain an updated target area; Performing regional connectivity processing based on the updated target region to obtain a connected region; Smoothing is performed based on the edge of the connected area to obtain the edge area of ​​the mask to be detected.

5. The method according to claim 1, characterized in that The mask margin detection result of the mask to be detected is obtained based on the edge area, including: Dividing the edge region into a plurality of sub-regions, and fitting a corresponding elliptical region for each sub-region; Determine the main axis direction of the corresponding sub-region based on the elliptical region, and for each main axis direction of the sub-region, obtain the spacing data of the sub-region according to the distance between the point on the main axis of the sub-region and the intersection point of the sub-region in the vertical direction; Screening and optimizing the spacing data of each sub-region to obtain the region spacing of each sub-region; Based on the area spacings of the sub-areas, the mask margin detection results of the mask to be detected are statistically obtained.

6. The method according to claim 1, characterized in that Determining the marked area from the target image includes: Determine a mask area including the mask to be detected from the target image; An edge fixed point array of the mask to be detected is determined from the mask area, and a marking area is obtained according to a distribution area of ​​the edge fixed point array in the mask area.

7. The method according to any one of claims 1 to 6, characterized in that: After obtaining the mask margin detection result of the mask to be detected based on the edge area, the method further includes: Comparing the spacing statistics in the mask margin detection result with a preset spacing threshold to obtain a spacing comparison result; The mask quality inspection result of the mask to be inspected is determined based on the spacing comparison result.

8. A mask margin detection device, characterized in that: include: A marking area determination module is used to obtain a target image captured for the mask to be detected, and determine a marking area from the target image, wherein the marking area includes an edge fixed point array of the mask to be detected; A module for determining an area to be detected, used for obtaining an area to be detected according to a coverage area between the marked area and a mask edge boundary of the mask to be detected in the target image; A background area determination module, used to determine the background area of ​​the mask to be detected from the target image based on the marked area; A target area acquisition module, used for, when there is an ear band interference area in the background area, removing the ear band interference from the area to be detected based on the ear band interference area to obtain a target area; An edge region detection module is used to determine the edge region of the mask to be detected according to the target region and the marked region, wherein the edge region is the region between the region boundary line in the marked region close to the mask edge boundary and the mask edge boundary; A margin detection module is used to obtain a mask margin detection result of the mask to be detected based on the edge area.

9. A computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.