A method and system for automatically generating a sample of incomplete silk-screen characters and a storage medium
By generating abundant incomplete silkscreen character samples, the problem of low efficiency in manual inspection and insufficient deep learning samples is solved, thereby improving the accuracy and stability of inspection and making it suitable for industrial automated production lines.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 深圳市智弦科技有限公司
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, screen printing character detection relies on manual visual inspection, which is inefficient and highly subjective. Furthermore, deep learning-based detection systems lack sufficient defect samples, especially for incomplete character defect samples, resulting in insufficient detection accuracy.
This paper presents an automatic method for generating defective silkscreen character samples. It uses a deep learning object detection model to locate text regions, generate defect candidate regions, and randomly fill background pixels to simulate real defect morphology. The method includes text mask extraction, defect mask generation, and smoothing processing to generate rich defect samples.
It improves the accuracy and stability of silkscreen character defect detection, reduces the false negative rate and false positive rate, adapts to the rapid modeling needs of industrial automation production lines, and reduces the cost and time of manual sample collection.
Smart Images

Figure CN122156242A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of industrial appearance defect detection, and more specifically, to a method, system, and storage medium for automatically generating incomplete silkscreen character samples. Background Technology
[0002] In the product manufacturing process, silkscreen characters serve as a carrier of critical information such as product details, usage instructions, and safety warnings. Their integrity directly impacts product quality, product certification, and safety alerts. Therefore, defect detection of silkscreen characters on product surfaces is a crucial step in industrial production.
[0003] Traditionally, screen printing character inspection relies on manual visual inspection, which is inefficient, highly subjective, and prone to fatigue. In recent years, the industrial quality inspection field has introduced deep learning-based intelligent industrial appearance defect detection systems to replace traditional manual visual inspection methods. This reduces the influence of subjective factors caused by manual inspection and improves the accuracy and efficiency of detection. However, deep learning-based appearance inspection systems face challenges such as a limited number of defect samples and difficulties in collecting training samples. This is especially true for screen printing character defects with many characters; even with relatively stable processes, it is difficult to collect a sufficient number of character defect samples to build a deep learning model. Collecting defect images by manually destroying normal materials on a large scale cannot cover all types of defects for various characters and incurs the cost of damaging materials. Therefore, there is an urgent need for a method that can generate image samples of defects for all characters in the screen printing area based on existing defect features, to build a deep learning model and achieve defect detection in screen printing characters. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method, system and storage medium for automatically generating incomplete silkscreen character samples, in view of the above-mentioned defects of the prior art.
[0005] The technical solution adopted by this invention to solve its technical problem is as follows: On one hand, the present invention provides a method for automatically generating incomplete silkscreen character samples, which includes the following steps: S101: Obtain the original image of the product surface containing the silkscreen characters to be processed; S102: Locate the silkscreened text area in the original image and straighten the tilted text area to obtain the straightened text area image. S103: The straightened text region image is binarized to extract the text mask image representing the text pixels, and the contour of each character is extracted by the contour tracking algorithm. S104: On the text mask image, generate at least one defect candidate region mask for each individual character; S105: Based on the text mask image, determine the background pixel set from the straightened text region image, and use the pixels in the background pixel set to fill the image region corresponding to the defect candidate region mask to obtain the basic defect image. S106: Smooth the basic defect image to eliminate abnormal pixels caused by filling; S107: Save the post-processed image as a sample of incomplete silkscreen characters.
[0006] The generation method of the present invention, wherein step S102, the text region positioning and alignment step includes: A deep learning object detection model was used to detect multiple corner characters in the silkscreened text region of the original image. Based on the center point coordinates of the corner characters, a quadrilateral region encompassing the entire silkscreen text area is determined; The quadrilateral region is corrected into a rectangular region by perspective transformation, and the corrected text region image is then cropped from it.
[0007] The generation method of the present invention, wherein step S104, the defect mask generation step includes: A morphological erosion operation is performed on the text mask to separate connected characters; Extract the bounding rectangle of each individual character, and determine multiple preset region center points for each character based on the bounding rectangle; Based on the center point of each preset region, a mask region with a preset shape and size is randomly generated as the defect candidate region mask.
[0008] In the generation method of the present invention, the plurality of preset region center points include the upper left, upper right, lower left, lower right and center point of the character, and the position of the preset region center point, the shape and size of the defect candidate region mask are adjusted by introducing random parameters.
[0009] The generation method of the present invention, wherein step S105, the defect filling step includes: For the character to be processed, a background sampling region is determined with it as the center; Based on the text mask image, pixels belonging to any character are removed from the background sampling area to obtain a candidate background pixel set; Pixel values are randomly selected from the candidate background pixel set and filled into the image position corresponding to the defect candidate region mask.
[0010] The generation method of the present invention includes: statistically analyzing the distribution of pixel values in the candidate background pixel set, classifying the pixel values into three categories: extremely large values, extremely small values, and normal background values; and randomly selecting a corresponding number of pixels from the three categories of pixel values according to a preset ratio for filling.
[0011] In the generation method of the present invention, the smoothing process in step S106 is as follows: Threshold segmentation is performed on the basic defect image to identify and remove dark pixel anomalies with gray values below a set threshold. The edges of the filled area of the basic defect image are subjected to Gaussian blurring to make them transition smoothly with the surrounding background.
[0012] Secondly, this aspect also provides an automatic generation system for incomplete silkscreen character samples, comprising: The image loading module is used to acquire the original image of the product surface containing the silkscreen characters to be processed. The text region positioning module is used to locate the silkscreened text region in the original image and straighten the tilted text region to obtain the straightened text region image. The text mask module is used to perform binarization processing on the straightened text region image, extract the text mask image representing the text pixels, and extract the contour of each character through a contour tracking algorithm. A defect mask generation module is used to generate at least one defect candidate region mask for each individual character on the text mask image. The defect filling module is used to determine a set of background pixels from the aligned text region image based on the text mask image, and use the pixels in the set of background pixels to fill the image region corresponding to the defect candidate region mask to obtain a basic defect image. The post-processing module is used to smooth the basic defect image and eliminate abnormal pixels caused by filling. The result saving module is used to save the post-processed image as a sample of incomplete silkscreen characters.
[0013] In the generation system of the present invention, in the text region positioning module, the deep learning target detection algorithm is trained by marking the four corners of the four edge characters of the silkscreen text as categories; the perspective transformation module constructs a regular rectangle by calculating the center points of the four edge characters and solves the perspective transformation matrix H to realize the transformation from oblique rectangle to regular rectangle.
[0014] Thirdly, this aspect also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the generation method described above.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The automatic generation method, system, and storage medium for screen-printed character defect samples of this invention are ingeniously designed, solving the problems of high cost and low efficiency of manual defect sample collection. By randomly generating defects of different shapes and sizes in multiple key areas of the character and adopting a layered random sampling background filling strategy, it can simulate rich defect morphologies close to those in the real world. By combining the defect samples generated by this invention with a small number of real samples for training, the detection accuracy of the model for screen-printed character defects can be effectively improved, reducing the false negative rate and the false positive rate. It also improves the accuracy and stability of screen-printed character defect detection. The entire sample generation process requires no manual intervention and can be seamlessly embedded into the deep learning model training process to achieve rapid modeling and iteration. It is suitable for the needs of industrial automated production lines for large-volume, high-consistency quality control, and promotes the application of intelligent detection technology in industrial quality inspection. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort: Figure 1 This is an overall flowchart of the method for automatically generating incomplete silkscreen character samples in Embodiment 1 of the present invention.
[0017] Figure 2 This is a schematic diagram of the original image of the product surface to be processed in Embodiment 1 of the present invention.
[0018] Figure 3 This is a schematic diagram of the tilted text area of the product in Embodiment 1 of the present invention.
[0019] Figure 4 This is a schematic diagram of the ROI region for deep learning object detection in Embodiment 1 of the present invention.
[0020] Figure 5 This is a schematic diagram of the four edge characters obtained by the target detection model in the first embodiment of the present invention.
[0021] Figure 6 This is a schematic diagram showing the connection between the center points of the four edge characters in Embodiment 1 of the present invention.
[0022] Figure 7 This is a schematic diagram of the perspective transformation result in Embodiment 1 of the present invention.
[0023] Figure 8 This is a schematic diagram of the silkscreen characters in the original image of Embodiment 1 of the present invention.
[0024] Figure 9 This is a schematic diagram of the mask for silkscreening characters in Embodiment 1 of the present invention.
[0025] Figure 10 This is a schematic diagram of the character mask adhered in Embodiment 1 of the present invention.
[0026] Figure 11 This is a schematic diagram of the outer rectangular region for extracting characters after etching in Embodiment 1 of the present invention.
[0027] Figure 12 This is a schematic diagram of the extreme pixel filling logic in Embodiment 1 of the present invention.
[0028] Figure 13 This is a schematic diagram of the original normal text silkscreen printing in Embodiment 1 of the present invention.
[0029] Figure 14 This is a schematic diagram of character defects generated by the method of this application in Embodiment 1 of the present invention.
[0030] Figure 15 This is a schematic diagram of the structure of an automatic generation system for incomplete silkscreen character samples according to Embodiment 2 of the present invention. Detailed Implementation
[0031] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0032] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0033] "Multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0034] Furthermore, the terms indicating orientation, such as "up, down, front, back, left, right, upper end, lower end, longitudinal," etc., are all based on the posture and position of the device or equipment described in this solution during normal use.
[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, a clear and complete description will be provided below in conjunction with the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the protection scope of the present invention.
[0036] Example 1 This embodiment provides a method for automatically generating incomplete silkscreen character samples, such as... Figure 1 As shown, the method includes the following steps: Step S101: Obtain the original image with silkscreen printing.
[0037] In appearance inspection equipment, high-definition industrial cameras (such as existing line scan cameras) are used to photograph the product itself and generate images, such as... Figure 2 As shown, the black area represents the non-product area, the gray area represents the product area, and the lower right corner represents the silkscreen text area of the product. This image includes the product itself and the silkscreen characters printed on it. The image format can be BMP, JPEG, etc., and the resolution can be set according to the actual detection accuracy, for example, 8194×4001 pixels.
[0038] Step S102: Positioning and aligning the text area.
[0039] Because the material may shift slightly during the process of transporting it, the product itself and the silkscreened text will be slightly offset in the image after line scanning. The relative position of the silkscreen will also shift, and the characters will appear tilted, affecting the extraction of text areas. Figure 3 As shown. Therefore, the text area needs to be positioned and aligned before text processing.
[0040] Specifically, this embodiment uses a deep learning object detection model (such as lightweight networks like YOLO and SSD in existing technologies) to locate the four corner characters of the silkscreen text area. The characters at the four corners of the silkscreen text are pre-labeled and assigned to categories 1, 2, 3, and 4 respectively, and the lower right red area is designated as the ROI. Training is then performed, as follows: Figure 4 , Figure 5 As shown. After training, the object detection model weights are obtained. Using these model weights, inference is performed on the image input by the method to obtain the characters with four edges. Then, the center points of the four characters are found, and four center points are constructed. , , , Connect the lines clockwise, then apply Euclidean algorithm: Calculate the lengths of the four sides of the rectangle representing the target region, and then calculate the coordinates of the four target points after perspective transformation based on the lengths of the four sides. , , , Next, a two-dimensional to two-dimensional perspective transformation is used to solve for the perspective transformation matrix H, using homogeneous coordinates for the source point. (Cartesian coordinates) converted to homogeneous coordinates Transformed homogeneous coordinates To restore Cartesian coordinates, satisfy the following formula (1). Then through Construct a system of linear equations based on the correspondences, and for each set of corresponding points... The transformation yields two linear equations, as shown in formula (2) below. Four sets of point pairs generate eight equations, forming... (where h is the column vector of elements of H). After solving the system of equations through singular value decomposition, the initial matrix H obtained needs to be normalized to ensure the consistency of homogeneous coordinates. Finally, based on the inverse matrix of H... Iterate through each pixel Back to the original image coordinates As shown in the following formula (3). Then for Perform bilinear interpolation, calculate pixel values, and assign them to the target image. The position is adjusted so that each pixel can be transformed from a slanted rectangle to a regular rectangle, thus aligning the silkscreen text paragraph area. Figure 6 , Figure 7 As shown. Based on the positions of the detection boxes where the four characters are located after perspective transformation, the coordinates of the top left of the first character, the top right of the second character, the bottom left of the third character, and the bottom right of the fourth character are taken in sequence. A fixed pixel value is added outward to crop out the image area, which is the area where the silkscreen character paragraph is located.
[0041] (1) (2) (3) Step S103: Extract the text mask.
[0042] Since there are various background interference pixels in the original image, it is more accurate to generate a mask from the original image and use the mask to locate a single character. In order to accurately locate each character, it is necessary to separate the text from the complex background. This embodiment adopts an adaptive threshold segmentation method to find each character in the silkscreen paragraph, laying the foundation for which region of each character to generate defects. First, the text region image obtained in step S102 is preprocessed, such as removing the extremely bright spots with great background interference. Then, the Gaussian noise reduction algorithm is used to reduce the noise in the image and reduce the influence of noise. After the above operations, the overall pixel distribution of the image is more reasonable. Then, binary segmentation is used, a threshold T is set, the text region is set to 255 and the non-text region is set to 0, and a basic binary mask is generated, as shown in the following formula (4), where For the original grayscale image in Pixel value at coordinates For the binarized image in The pixel values at that location are used. Morphological opening and closing operations are applied to the mask for denoising and dilation, reducing fine noise.
[0043] (4) Furthermore, using a contour tracking algorithm, each highlighted contour of the binary mask is calculated, and the area of each contour is calculated, retaining contours with an area greater than 2. After the above operations, the mask can eliminate small pixel interference, retaining only each character in the paragraph, such as... Figure 8 , Figure 9 As shown.
[0044] Step S104: Defect mask generation.
[0045] This step aims to plan the defect areas to be filled for each character, simulating character incompleteness. First, a slight erosion operation is performed on the text mask image to reduce character adhesion. Then, a contour tracking algorithm is used to traverse the contour of each character, obtaining its bounding rectangle. Defect masking is then performed on each character individually. Based on the character's bounding rectangle, the center point of the character is obtained. Top left Top right Bottom left Bottom right The coordinates of these five points represent the center points of the current character defect generation area. To prevent each defect from concentrating in these five positions, a random offset is added, causing the center points to shift randomly and increasing the diversity of defects. Figure 10 , Figure 11As shown. Taking the center point of these five points as the center of the ellipse, randomly generate an elliptical area no larger than the size of the character itself, which is the background filling area. In order to simulate a more realistic defect shape, the irregularity of the defect is randomly increased, and random noise is added to the edge area of the ellipse to increase the difference in the edge area and avoid the transition area being all elliptical in shape.
[0046] Step S105: Defect filling.
[0047] After obtaining the candidate defect regions for each character, pixels need to be sampled from the background area of the image to fill these regions. For the current character, a preset range (e.g., 30×30 pixels) is extended outward from the center of its bounding rectangle as the background sampling area. Based on the text mask image obtained in step S103, the area containing the current character is removed from this sampling area, and the pixel positions of the remaining area are mapped to the original image to obtain the pixel values of the original image, which are the pixel values for filling the background. These pixels are used to fill the original image area corresponding to the defect region in step S104 to generate the basic defect image. It is worth noting that in the original image, the background area may have some extreme bright spots due to different material characteristics, and due to the problem of line scan imaging, there may be differences in the optical background of different areas of the entire image. If the pixels surrounding the character are directly used as fill pixels, extreme values may be overfilled, or the filling may be uneven. Therefore, the fill pixels need to be allocated during filling. Take the pixel values of a 30*30 pixel interval outward from the center of the character in the original image, remove the original image area corresponding to the mask 255, and then calculate the pixel value distribution of the remaining area. The range of ±5 between the maximum and minimum values is taken as the extreme maximum and extreme minimum values, respectively. The remaining values are considered as the normal background values. These three types of pixels are used as candidate intervals. The fill pixel values are selected from the extreme maximum, extreme minimum, and normal background value candidate intervals. Assuming 50 pixels need to be filled, the corresponding number of pixels is obtained from the candidate intervals according to the extreme maximum, extreme minimum, and normal background values in a ratio of 0.2, 0.2, and 0.6, randomly shuffled, and then randomly filled in the area to be filled.
[0048] Step S106: Post-processing.
[0049] The basic defect image generated in step S105 may have some imperfections and requires further post-processing. First, extreme pixels are removed to make the filling effect closer to the background and the transition areas smoother, resulting in a more realistic filling effect. Removing extreme pixels mainly targets small black dots with excessively low grayscale values appearing in the filled area. These black dots are caused by extreme values randomly sampled in the filling strategy and are considered visual defects. A threshold T is set, and pixels below this threshold are found through threshold segmentation and defined as dark pixels. Then, the dark pixels are traversed, and these black dots are eliminated by replacing them with the median or mean of their neighboring pixels, such as... Figure 12 As shown. The smooth transition region utilizes Gaussian blur and mask fusion to allow the edges of the filled region to transition naturally with the original image. The operation logic is as follows: the entire generated defect image is Gaussian blurred; the mask of the filled region is mapped onto the Gaussian-blurred entire image; the corresponding blurred region is cropped and merged into the filled image, achieving the goal of blurring the filled region while preserving the original background image. To further improve the smoothness of the transition region, the mask of the filled region can be expanded outward by a certain number of pixels, mapped to the Gaussian-blurred entire image, and the corresponding region is cropped and merged with the original background image, resulting in a larger transition region and improved smoothness. The generated local effect is shown below. Figure 13 , Figure 14 As shown.
[0050] Step S107: Save the results.
[0051] The image processed in step S106, especially the area containing the silkscreen characters, is saved in a preset format (such as BMP) and provided to the subsequent silkscreen character defect detection deep learning model for training.
[0052] Effect verification To verify the effectiveness of this method, three different training sets were set up for training on the generated defect effect: a training set consisting only of silkscreen character defects generated from real materials, a training set consisting only of defect samples generated by the algorithm, and a mixed training set consisting of real defects and defects generated by the algorithm. A real defect test set was used for testing to verify the effectiveness of the defect samples generated by the silkscreen character defect generation algorithm in detecting silkscreen character defects. After training, inference, and testing, the weights trained using the algorithm-generated defect samples could detect some real samples, with both the over-detection rate and the under-detection rate being slightly higher than the model trained using real defect samples. The weights trained using a mixture of real defect samples and algorithm-generated defect samples showed the lowest under-detection rate and over-detection rate, as shown in Table 1.
[0053] Table 1 Test results for different training set combinations
[0054] The present invention proposes an automatic generation method for screen-printed character defect samples, which can better simulate real screen-printed defects and generate corresponding screen-printed text defect samples. It solves the problems of high difficulty and high cost in collecting product screen-printed samples in the prior art, provides samples for deep learning defect detection algorithms, and achieves the goal of quickly establishing basic models.
[0055] Example 2 This embodiment provides an automatic generation system for incomplete silkscreen character samples, such as... Figure 15 As shown, the system includes: Image loading module 10 is used to acquire the original image of the product surface containing the silkscreen characters to be processed; The text region positioning module 20 is used to locate the silkscreen text region in the original image and straighten the tilted text region to obtain the straightened text region image. The text mask module 30 is used to perform binarization processing on the straightened text region image, extract the text mask image representing the text pixels, and extract the contour of each character through a contour tracking algorithm. Defect mask generation module 40 is used to generate at least one defect candidate region mask for each individual character on the text mask image; The defect filling module 50 is used to determine a set of background pixels from the straightened text region image based on the text mask image, and use the pixels in the set of background pixels to fill the image region corresponding to the defect candidate region mask to obtain a basic defect image. Post-processing module 60 is used to smooth the basic defect image and eliminate abnormal pixels caused by filling. The result saving module 70 is used to save the post-processed image as a sample of incomplete silkscreen characters.
[0056] Example 3 This embodiment provides a computer-readable storage medium on which a computer program / instructions are stored. When executed by a processor, the program / instructions can perform the steps of the method described in Embodiment 1.
[0057] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for automatically generating incomplete silkscreen character samples, characterized in that, Includes the following steps: S101: Obtain the original image of the product surface containing the silkscreen characters to be processed; S102: Locate the silkscreened text area in the original image and straighten the tilted text area to obtain the straightened text area image. S103: The straightened text region image is binarized to extract the text mask image representing the text pixels, and the contour of each character is extracted by the contour tracking algorithm. S104: On the text mask image, generate at least one defect candidate region mask for each individual character; S105: Based on the text mask image, determine the background pixel set from the straightened text region image, and use the pixels in the background pixel set to fill the image region corresponding to the defect candidate region mask to obtain the basic defect image. S106: Smooth the basic defect image to eliminate abnormal pixels caused by filling; S107: Save the post-processed image as a sample of incomplete silkscreen characters.
2. The generation method according to claim 1, characterized in that, In step S102, the text region positioning and alignment steps include: A deep learning object detection model was used to detect multiple corner characters in the silkscreened text region of the original image. Based on the center point coordinates of the corner characters, a quadrilateral region encompassing the entire silkscreen text area is determined; The quadrilateral region is corrected into a rectangular region by perspective transformation, and the corrected text region image is then cropped from it.
3. The generation method according to claim 1 or 2, characterized in that, In step S104, the defect mask generation step includes: A morphological erosion operation is performed on the text mask to separate connected characters; Extract the bounding rectangle of each individual character, and determine multiple preset region center points for each character based on the bounding rectangle; Based on the center point of each preset region, a mask region with a preset shape and size is randomly generated as the defect candidate region mask.
4. The generation method according to claim 3, characterized in that, The preset region center points include the upper left, upper right, lower left, lower right and center points of the character, and the positions of the preset region center points, the shape and size of the defect candidate region mask are adjusted by introducing random parameters.
5. The generation method according to claim 4, characterized in that, In step S105, the defect filling step includes: For the character to be processed, a background sampling region is determined with it as the center; Based on the text mask image, pixels belonging to any character are removed from the background sampling area to obtain a candidate background pixel set; Pixel values are randomly selected from the candidate background pixel set and filled into the image position corresponding to the defect candidate region mask.
6. The generation method according to claim 5, characterized in that, The distribution of pixel values in the candidate background pixel set is statistically analyzed, and the pixel values are divided into three categories: extremely large values, extremely small values, and normal background values. According to a preset ratio, a corresponding number of pixels are randomly selected from the three categories of pixel values for filling.
7. The generation method according to claim 1, characterized in that, In step S106, the smoothing process is as follows: Threshold segmentation is performed on the basic defect image to identify and remove dark pixel anomalies with gray values below a set threshold. The edges of the filled area of the basic defect image are subjected to Gaussian blurring to make them transition smoothly with the surrounding background.
8. An automatic generation system for incomplete silkscreen character samples, characterized in that, include: The image loading module is used to acquire the original image of the product surface containing the silkscreen characters to be processed. The text region positioning module is used to locate the silkscreened text region in the original image and straighten the tilted text region to obtain the straightened text region image. The text mask module is used to perform binarization processing on the straightened text region image, extract the text mask image representing the text pixels, and extract the contour of each character through a contour tracking algorithm. A defect mask generation module is used to generate at least one defect candidate region mask for each individual character on the text mask image. The defect filling module is used to determine a set of background pixels from the aligned text region image based on the text mask image, and use the pixels in the set of background pixels to fill the image region corresponding to the defect candidate region mask to obtain a basic defect image. The post-processing module is used to smooth the basic defect image and eliminate abnormal pixels caused by filling. The result saving module is used to save the post-processed image as a sample of incomplete silkscreen characters.
9. The generation system according to claim 1, characterized in that, In the text region positioning module, the deep learning target detection algorithm is trained by marking the four corners of the four edge characters of the silkscreen text as categories; the perspective transformation module constructs a regular rectangle by calculating the center points of the four edge characters and solves the perspective transformation matrix H to realize the transformation from an oblique rectangle to a regular rectangle.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-7.