Character stroke disconnection defect detection method and device, electronic equipment and medium

By combining global automatic thresholding and secondary binarization with centerline grayscale verification, the problem of missing detection of subtle breakage defects in character detection is solved, and efficient and accurate detection is achieved under complex conditions.

CN121963213APending Publication Date: 2026-05-01BEIJING LUSTER LIGHTTECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING LUSTER LIGHTTECH
Filing Date
2025-12-04
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately identify subtle character stroke breakage defects while maintaining alignment deviation tolerance in character detection, and are prone to missed detection, especially under complex imaging conditions.

Method used

The method employs global automatic threshold segmentation and character region-based secondary binarization processing, combined with connected component comparison and centerline grayscale verification. It uses overlap judgment to output stroke breakage defect results, eliminates non-character region interference, and improves detection accuracy.

Benefits of technology

The detection sensitivity and accuracy of character stroke breakage defects were improved under complex imaging conditions, the false judgment rate was reduced, and the robustness and efficiency of the detection were ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121963213A_ABST
    Figure CN121963213A_ABST
Patent Text Reader

Abstract

The invention discloses a character stroke disconnection defect detection method and device, electronic equipment and a medium, and relates to the technical field of image recognition. The method comprises the following steps: acquiring a real-time character image and a template character image; performing global automatic threshold segmentation on the real-time character image to obtain a first binary image, and performing defect detection operation on the first binary image to obtain a few-print defect detection result of the first binary image; performing secondary binarization processing based on a character region on the real-time character image to obtain a second binary image, and performing defect detection operation on the second binary image to obtain a damage defect detection result of the second binary image; and based on the underprint defect detection result and the damage defect detection result, executing overlapping judgment, and outputting a stroke disconnection defect detection result of the real-time character image. With the adoption of the method, the detection precision can be ensured, the tiny disconnection defects of character strokes can be accurately identified, and the reliability and precision of character defect detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and in particular to a method, apparatus, electronic device, and medium for detecting character stroke breakage defects. Background Technology

[0002] Character defect detection technology plays an important role in various industrial scenarios. By identifying character defects such as incompleteness, reprinting, and deformation in character images, it verifies the quality of characters to ensure their clarity and readability, thereby meeting stringent product quality requirements.

[0003] In related technologies, detection methods typically identify defects by comparing the image of the character to be detected with a template character image. The accuracy of this character comparison depends on the precise alignment of the real-time character with the template character. However, slight deviations in character position, posture, or imaging conditions are unavoidable during actual acquisition. Even if the character itself is acceptable, alignment errors can lead to significant differences in the comparison area, resulting in misjudgment as a defect. To balance detection rate and tolerance, a relatively lenient detection threshold is often set. However, this makes it difficult to reliably identify small character break defects, especially when the break size is small and the grayscale change is insignificant, easily leading to missed detections. Therefore, improving the detection capability for minute break defects while ensuring robustness against alignment errors remains a significant challenge. Summary of the Invention

[0004] This invention aims to at least partially solve one of the technical problems in related technologies. Therefore, the object of this invention is to provide a method, apparatus, electronic device, and medium for detecting character stroke breakage defects, so as to improve the accuracy of detecting minute character breakage defects while maintaining alignment deviation tolerance.

[0005] To achieve the above objectives, a first aspect of the present invention provides a method for detecting character stroke breakage defects, comprising: Obtain real-time character images and template character images; Global automatic thresholding is performed on the real-time character image to obtain a first binary image, and a defect detection operation is performed on the first binary image to obtain the missing print defect detection result of the first binary image; The real-time character image is subjected to secondary binarization processing based on the character region to obtain a second binary image, and a defect detection operation is performed on the second binary image to obtain the damage defect detection result of the second binary image; Based on the missing print defect detection results and the damage defect detection results, an overlap judgment is performed, and the stroke break defect detection results of the real-time character image are output. The defect detection operation includes: The input binary image is compared with the template character image by the number of connected components or holes. If the quantities are inconsistent, perform centerline grayscale verification on the input binary image to determine the defect location.

[0006] In addition, the character stroke breakage defect detection method of the above embodiments of the present invention may also have the following additional technical features: According to an embodiment of the present invention, performing centerline grayscale verification on the input binary image includes: Extract the center line of the template character image; Traverse the coordinate positions on the center line, check whether the gray value of the coordinate position in the input binary image is a non-character region gray value, and mark the coordinate position of the non-character region gray value as the break point in the marked image; Morphological operations and region clustering analysis are performed on the marked image to obtain the pixel region of the abnormal center line.

[0007] According to one embodiment of the present invention, determining the defect location includes: Within the pixel region of the abnormal center line, a connectivity analysis is performed on the input binary image; If the connected component analysis verification result contains multiple connected components, then the abnormal center line pixel region is confirmed to be a stroke break defect.

[0008] According to one embodiment of the present invention, extracting the center line of the template character image includes: The template character image is binarized and thinned to obtain a skeleton image.

[0009] According to one embodiment of the present invention, performing morphological operations on the marked image includes: If the pixel value of the character region in the input binary image is the first set gray value, then a dilation operation is performed; if the pixel value of the character region in the input binary image is the second set gray value, then an erosion operation is performed.

[0010] According to one embodiment of the present invention, the overlapping determination includes: Determine whether the area of ​​the damage defect detection result intersects with the area of ​​the missing print defect detection result; Based on the intersection of regions, record all the detection results of the missing printing defects and the detection results of the damage defects in the non-intersecting parts.

[0011] According to one embodiment of the present invention, the defect detection operation further includes: The template character image is processed to obtain a mask image of the non-character region; The input binary image is ANDed with the mask image to remove non-character regions from the binary image.

[0012] To achieve the above objectives, a second aspect of the present invention provides a character stroke breakage defect detection device, comprising: The character image acquisition module is used to acquire real-time character images and template character images; The defect detection module is used to perform global automatic threshold segmentation on the real-time character image to obtain a first binary image, and to perform defect detection operation on the first binary image to obtain the missing print defect detection result of the first binary image; and to perform secondary binarization processing based on character regions on the real-time character image to obtain a second binary image, and to perform defect detection operation on the second binary image to obtain the damage defect detection result of the second binary image; The output module is used to perform overlap judgment based on the missing print defect detection result and the damage defect detection result, and output the stroke break defect detection result of the real-time character image; The defect detection operation includes: The input binary image is compared with the template character image by the number of connected components or holes. If the quantities are inconsistent, perform centerline grayscale verification on the input binary image to determine the defect location.

[0013] To achieve the above objectives, a third aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described character stroke disconnection defect detection method.

[0014] To achieve the above objectives, a fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed, implements the steps of the above-described character stroke breakage defect detection method.

[0015] The character stroke breakage defect detection method, apparatus, electronic device, and medium of this invention perform global automatic thresholding and character region-based secondary binarization on real-time character images, enabling different types of defects to be fully highlighted under corresponding grayscale feature conditions. Accurate location of suspected breakage positions is achieved through connected component comparison and centerline grayscale verification. Furthermore, using the overlap between the results of missing print defects and the results of broken defects as a comprehensive judgment criterion not only effectively reduces misjudgments caused by errors but also improves the recognition ability of small stroke breaks without increasing alignment accuracy requirements. Therefore, this invention maintains stable detection performance under complex imaging conditions, achieving higher detection sensitivity and accuracy. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating a method for detecting character stroke breakage defects in one embodiment; Figure 2 This is a schematic diagram of a print defect and binarization processing in one embodiment; Figure 3 This is a flowchart illustrating the defect detection operation in one embodiment; Figure 4 This is a schematic diagram of a connected component representing a disconnect defect in one embodiment; Figure 5 This is a schematic diagram of another connected component in one embodiment of the disconnection defect; Figure 6 This is a schematic diagram of the damage defect and binarization processing in one embodiment; Figure 7 This is a schematic diagram illustrating a misjudgment of the centerline in one embodiment; Figure 8 This is a binary image of template characters and defects outside the masked area in one embodiment; Figure 9 This is a schematic diagram of the stroke disconnection defect detection results in one embodiment; Figure 10 This is a structural block diagram of a character stroke disconnection defect detection device in one embodiment. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0018] The implementation details of the technical solutions of the embodiments of the present invention are described in detail below.

[0019] In one embodiment, such as Figure 1 The diagram shows a flowchart of a method for detecting character stroke breakage defects. This method may include the following steps: Step S101: Obtain the real-time character image and the template character image.

[0020] Real-time character images can be acquired through an image acquisition device, while corresponding template character images are read from a preset character template library. The real-time character image is a grayscale image of the character being detected under the current imaging conditions, while the template character image is a reference grayscale image of a standard character, used for subsequent feature comparison and defect analysis.

[0021] Step S102: Perform global automatic thresholding on the real-time character image to obtain a first binary image, and perform a defect detection operation on the first binary image to obtain the missing print defect detection result of the first binary image.

[0022] Character breakage defects can be categorized into underprinting defects and broken defects. Underprinting defects typically manifest as high contrast in character strokes and insufficient ink coverage across the entire imaging area. To maintain high recognizability of this type of defect after binarization, Otsu's method can be used to perform global automatic thresholding segmentation on the real-time character image. Since underprinting defects are sensitive to global grayscale, only one global binarization of the entire character image is needed to effectively highlight the defect, such as... Figure 2 As shown, by automatically calculating the global optimal threshold, the real-time character image is converted into a first-order binary image, making the stroke boundaries clearer and facilitating the accurate extraction of underprinting defects with obvious contrast.

[0023] A defect detection operation is performed on the obtained first binary image to determine whether there are missing print type break features in the characters. Figure 3 The flowchart illustrates the defect detection operation, which includes comparing the number of connected components or holes in the first binary image with the template character image. If the number of connected components or holes in the real-time character image is inconsistent with that in the template character image, it indicates that there may be a stroke interruption in that area. In practical applications, if a character stroke breakage defect exists, the number of connected components or holes in the real-time character image and the template character image will not be completely consistent. Figure 4 and Figure 5 This is a schematic diagram of the connected components with disconnected defects. Figure 4 In the two character images, the number of connected components is the same, but the number of holes is different; Figure 5 In the image, the two character images have the same number of holes, but different numbers of connected components.

[0024] In cases of abnormal numbers, centerline grayscale verification can be performed on the input binary image to further locate stroke interruption positions, thereby determining the missing print defect detection result of the first binary image. It should be noted that during the comparison of the number of connected components or holes, the template character image needs to be converted into a binary image to ensure the comparability of their structural features.

[0025] When the number of connected components and the number of holes are consistent with the template, it can be determined that the real-time character image does not have structural breaks. At this time, there is no need to perform center line grayscale verification, and the character can be directly determined to be free of missing or broken printing defects.

[0026] Step S103: Perform secondary binarization processing based on character regions on the real-time character image to obtain a second binary image, and perform defect detection operation on the second binary image to obtain the damage defect detection result of the second binary image.

[0027] For damaged defects with low contrast and uneven grayscale distribution, global automatic thresholding alone is often insufficient to effectively distinguish strokes from the background. For example, in situations with localized changes in image illumination, insufficient ink distribution in certain characters, or high background grayscale, ... Figure 6 As shown, the damaged location may remain connected in the first and second value images, causing the damage defect to go undetected.

[0028] To improve the identifiability of such defects, a secondary binarization process based on local grayscale characteristics can be performed within the character region. Specifically, using the character region as the binarization range, an automatic thresholding method suitable for local grayscale calculation (such as Otsu's method or iterative methods) is used to perform a second binarization process on the real-time character image. Since this process only performs threshold calculation within the character region, it can respond more sensitively to local grayscale inhomogeneities than global segmentation, causing the stroke center line at the damaged defect to appear broken in the second binary image.

[0029] After obtaining the second binary image, perform the following operations on the second binary image: Figure 3 The defect detection operation shown determines the break location of the damage type by comparing the number of connected components or the hole structure ratio, and verifying the grayscale of the center line, and generates the damage defect detection result of the second binary image.

[0030] In one embodiment, such as Figure 3 As shown, during the centerline grayscale verification process, it is necessary to locate abnormal centerline pixel regions. The specific processing flow may include: First, the center line is extracted from the template character image, and the coordinate set of the center line is obtained. Then, a marker image (Image) with the same size as the input binary image is created; this marker image is initially empty. In practical applications, the character grayscale (btCharGrey) is set according to the font color (e.g., 0 for black strokes and 255 for white strokes).

[0031] When traversing the centerline coordinates, the grayscale value of the centerline position in the input binary image is compared with the btCharGrey value of the binarized template character image. When the grayscale value of a pixel in the binary image does not match the btCharGrey value, it can be determined to belong to a non-character region and can be considered a possible breakpoint. In this case, the pixel at that location can be assigned an inverted grayscale value (i.e., 255) in the labeled image Image. btCharGrey) is used to mark the break point.

[0032] After labeling, a 3×3 morphological operation is performed on the labeled image to appropriately expand the labeled area and enhance the continuity of subsequent region detection. Then, region clustering analysis is performed on the morphologically processed labeled image, for example, by identifying connected regions through connected component analysis, thereby obtaining the clustered region of abnormal centerline pixels, i.e., the abnormal centerline pixel region. This process can effectively reflect the break position of the actual stroke, achieving the purpose of centerline grayscale verification.

[0033] In one embodiment, such as Figure 3 As shown, connectivity verification is performed on the input binary image based on the abnormal centerline pixel region to check whether the abnormal centerline pixel region is a break defect, thereby improving the accuracy of locating character stroke break defects. When locating the break position in the binary image using the template centerline pixels, the template centerline should be within the actual width range of the character stroke. However, since the width of the template character stroke may differ from the real-time character stroke width, the local position of the template centerline may deviate from the real-time stroke center, causing some centerline positions to fall in blank areas outside the character stroke, thus creating a risk of misjudgment, such as... Figure 7 As shown.

[0034] To avoid the aforementioned misjudgments, after obtaining the abnormal centerline pixel region, connected component analysis can be performed on the corresponding input binary image. Specifically, the abnormal centerline region is taken as the region of interest, and connectivity calculation is performed on the binary pixels within it. When the connected component analysis result contains only a single connected component, it indicates that the strokes within that region remain connected, and the abnormal region is a false break caused by template offset. The next abnormal centerline pixel region is then detected. Conversely, when the analysis result contains two or more connected components, it indicates that the stroke has actually been interrupted at that location, and the region can be identified as a stroke break defect.

[0035] By using a verification mechanism based on the number of connected components, misjudgments caused by inconsistencies between the template and the real-time character stroke width can be effectively eliminated, ensuring that the detection of disconnection defects is more robust and reliable.

[0036] In one embodiment, the centerline of the template character image can be obtained by binarizing the template character image and then performing an image thinning operation on the binarized image. The thinning operation can gradually shrink the stroke region to a single pixel width, thereby obtaining a skeleton image of the character strokes. This skeleton image can then be used as the centerline of the template character image for subsequent centerline verification processing.

[0037] In one embodiment, to make the marking of the break point more stable and clear, morphological operations can be performed on it after marking the break point. Specifically, for the character representation of the input binary image, when the pixel value of the character region is a first preset grayscale value (e.g., black text), a 3×3 dilation operation is performed on the marked region to expand the marked region to surrounding pixels, thereby enhancing the salience of the break point. When the pixel value of the character region is a second preset grayscale value (e.g., white text), a 3×3 erosion operation is performed on the marked region to shrink the marked region according to the inverse color mode of the character.

[0038] By using the above mechanism of selecting dilation or erosion based on character color, it can be ensured that regardless of whether the character is black on a white background or white on a black background, the break point can be uniformly and reliably enlarged or standardized, thus improving the stability of the marking results.

[0039] In one embodiment, such as Figure 3 As shown, to improve the accuracy of defect detection, a mask image for non-character regions can be generated based on the template character image before analyzing the input binary image. Specifically, the template character image is converted into a binary image, and by determining whether a pixel belongs to a character stroke region, all non-character regions are marked as mask pixels, thus forming a mask image for non-character regions.

[0040] Subsequently, a bitwise AND operation is performed between the input binary image and the mask image. This removes the non-character regions in the input binary image that correspond to the mask, retaining only the valid regions corresponding to the stroke structure of the template characters. Figure 8 As shown. This operation reduces the interference of background noise or invalid areas on disconnection defect detection, thus improving the accuracy of defect detection.

[0041] Step S104: Based on the missing print defect detection results and the damage defect detection results, perform overlap judgment and output the stroke break defect detection results of the real-time character image.

[0042] After obtaining the detection results of missing print defects and broken defects in the first binary image, the overlapping areas of the two types of defects can be further judged. Through this overlapping judgment, the detection results of the two types of defects can be combined to form the corresponding stroke break defect detection result, and the final real-time character image stroke break defect judgment result can be output. Figure 9 As shown, the processed stroke breakage defect detection results can be visualized.

[0043] In one embodiment, overlap determination can be achieved through region intersection analysis. Specifically, spatial intersection determination is performed on the regions of the damage defect detection results and the regions of the missing print defect detection results to determine whether the two types of defects point to the same break position in the character structure.

[0044] When the damaged defect area intersects with the underprinted defect area, it indicates that the damaged defect belongs to the same disconnection event within the coverage area of ​​the underprinted defect. To avoid duplicate statistics, this damaged defect can be omitted from the record. Conversely, when the damaged defect area does not intersect with the underprinted defect area, all underprinted defect detection results and the portion of the damaged defect that does not overlap with the underprinted defect are recorded together as the final disconnection defect output.

[0045] By using the above-mentioned region intersection analysis, disconnection features from different sources can be effectively integrated, avoiding duplicate counting and improving the stability and accuracy of defect output results.

[0046] In the above embodiments, contrast-sensitive global threshold segmentation and local quadratic binarization targeting uneven grayscale areas enable the separate detection of two types of breakage defects: missing prints and broken prints. This allows for the accurate capture of subtle breaks that are difficult to detect with traditional single thresholds. Simultaneously, by using a mask of the non-character region of the template character to remove interference areas and comparing the number of connected components or holes between real-time characters and template characters, potential broken characters can be preliminarily screened, providing candidate regions for centerline grayscale verification and thus improving the efficiency of breakage detection. During defect detection, centerline grayscale verification is introduced. By comparing the real-time grayscale of template skeleton points point by point and combining morphological expansion and connected component clustering, suspicious areas of stroke breaks can be accurately located, further improving the accuracy of breakage location. Finally, by filtering the overlap between missing print defect areas and broken print defect areas, duplicate or false judgments are avoided, making the output breakage defect results more reliable.

[0047] In one embodiment, a character stroke break defect detection device is provided, with reference to... Figure 10 As shown, the character stroke breakage defect detection device 100 may include: a character image acquisition module 10, a defect detection module 20, and an output module 30.

[0048] The character image acquisition module 10 is used to acquire real-time character images and template character images; The defect detection module 20 is used to perform global automatic threshold segmentation on the real-time character image to obtain a first binary image, and to perform defect detection operation on the first binary image to obtain the missing print defect detection result of the first binary image; and to perform secondary binarization processing based on character region on the real-time character image to obtain a second binary image, and to perform defect detection operation on the second binary image to obtain the damage defect detection result of the second binary image; The output module 30 is used to perform overlap judgment based on the missing print defect detection results and the damage defect detection results, and output the stroke break defect detection results of the real-time character image. The defect detection operation includes: The input binary image is compared with the template character image by the number of connected components or holes. If the quantities are inconsistent, perform centerline grayscale verification on the input binary image to determine the defect location.

[0049] In one embodiment, the defect detection module 20 is specifically used for: Extract the center line of the template character image; Traverse the coordinate positions on the center line, check whether the gray value of the coordinate position in the input binary image is a non-character region gray value, and mark the coordinate position with the non-character region gray value as the break point in the marked image; Morphological operations and region clustering analysis were performed on the labeled image to obtain the pixel region of the anomaly center line.

[0050] In one embodiment, the defect detection module 20 is specifically used for: Within the pixel region of the abnormal center line, perform connectivity analysis on the input binary image; If the connected component analysis verification result contains multiple connected components, then the abnormal center line pixel region is confirmed as a stroke break defect.

[0051] In one embodiment, the defect detection module 20 is specifically used for: The template character image is binarized and thinned to obtain the skeleton image.

[0052] In one embodiment, the defect detection module 20 is specifically used for: If the pixel value of the character region in the input binary image is the first set gray value, then a dilation operation is performed; if the pixel value of the character region in the input binary image is the second set gray value, then an erosion operation is performed.

[0053] In one embodiment, the output module is specifically used for: Determine whether the area of ​​the damage / defect detection result intersects with the area of ​​the missing print defect detection result; Based on the intersection of regions, record all the results of missing print defects and the results of damage defects in the non-intersecting parts.

[0054] In one embodiment, the defect detection module 20 is specifically used for: The template character image is processed to obtain a mask image of the non-character region; Perform an AND operation between the input binary image and the mask image to remove non-character regions from the binary image.

[0055] Specific limitations regarding the character stroke breakage defect detection device 100 can be found in the limitations of the character stroke breakage defect detection method described above, and will not be repeated here. Each module in the aforementioned character stroke breakage defect detection device 100 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0056] In one embodiment, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a method for detecting character stroke breakage defects.

[0057] In one embodiment, a computer storage medium is provided on which a computer program is stored, which, when executed by a processor, implements a method for detecting character stroke breakage defects.

[0058] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0059] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0060] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0061] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0062] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for detecting character stroke breakage defects, characterized in that, include: Obtain real-time character images and template character images; Global automatic thresholding is performed on the real-time character image to obtain a first binary image, and a defect detection operation is performed on the first binary image to obtain the missing print defect detection result of the first binary image; The real-time character image is subjected to secondary binarization processing based on the character region to obtain a second binary image, and a defect detection operation is performed on the second binary image to obtain the damage defect detection result of the second binary image; Based on the missing print defect detection results and the damage defect detection results, an overlap judgment is performed, and the stroke break defect detection results of the real-time character image are output. The defect detection operation includes: The input binary image is compared with the template character image by the number of connected components or holes. If the quantities are inconsistent, perform centerline grayscale verification on the input binary image to determine the defect location.

2. The method for detecting character stroke breakage defects according to claim 1, characterized in that, The process of performing centerline grayscale verification on the input binary image includes: Extract the center line of the template character image; Traverse the coordinate positions on the center line, check whether the gray value of the coordinate position in the input binary image is a non-character region gray value, and mark the coordinate position of the non-character region gray value as the break point in the marked image; Morphological operations and region clustering analysis are performed on the marked image to obtain the pixel region of the abnormal center line.

3. The method for detecting character stroke breakage defects according to claim 2, characterized in that, Determining the location of the defect includes: Within the pixel region of the abnormal center line, a connectivity analysis is performed on the input binary image; If the connected component analysis verification result contains multiple connected components, then the abnormal center line pixel region is confirmed to be a stroke break defect.

4. The method for detecting character stroke breakage defects according to claim 2, characterized in that, Extracting the center line of the template character image includes: The template character image is binarized and thinned to obtain a skeleton image.

5. The method for detecting character stroke breakage defects according to claim 2, characterized in that, The morphological operations performed on the labeled image include: If the pixel value of the character region in the input binary image is the first set gray value, then a dilation operation is performed; if the pixel value of the character region in the input binary image is the second set gray value, then an erosion operation is performed.

6. The method for detecting character stroke breakage defects according to claim 1, characterized in that, The execution overlap determination includes: Determine whether the area of ​​the damage defect detection result intersects with the area of ​​the missing print defect detection result; Based on the intersection of regions, record all the detection results of the missing printing defects and the detection results of the damage defects in the non-intersecting parts.

7. The method for detecting character stroke breakage defects according to claim 1, characterized in that, The defect detection operation further includes: The template character image is processed to obtain a mask image of the non-character region; The input binary image is ANDed with the mask image to remove non-character regions from the binary image.

8. A device for detecting character stroke breakage defects, characterized in that, include: The character image acquisition module is used to acquire real-time character images and template character images; The defect detection module is used to perform global automatic threshold segmentation on the real-time character image to obtain a first binary image, and to perform defect detection operation on the first binary image to obtain the missing print defect detection result of the first binary image; and to perform secondary binarization processing based on character regions on the real-time character image to obtain a second binary image, and to perform defect detection operation on the second binary image to obtain the damage defect detection result of the second binary image; The output module is used to perform overlap judgment based on the missing print defect detection result and the damage defect detection result, and output the stroke break defect detection result of the real-time character image; The defect detection operation includes: The input binary image is compared with the template character image by the number of connected components or holes. If the quantities are inconsistent, perform centerline grayscale verification on the input binary image to determine the defect location.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the character stroke breakage defect detection method according to any one of claims 1 to 7.

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 character stroke breakage defect detection method according to any one of claims 1 to 7.