OCR recognition method and system for PCB component printing screen printing

Through multi-spectral imaging technology and mass coefficient calculation, combined with multi-step image analysis algorithm, efficient and accurate automated detection of PCB silk screen quality is achieved, solving the problems of low detection accuracy and insufficient adaptability in the existing technology, and improving the flexibility and accuracy of detection.

CN119478644BActive Publication Date: 2025-04-01HUAYI INTELLIGENT EQUIP (HANGZHOU) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510065672.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-04-01
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently and accurately detect the quality of PCB silkscreen in complex backgrounds, low contrast or high reflection environments, and it is especially difficult to identify minor errors or shape distortions, resulting in a high rate of misdetection or missed detection.

Method used

Multispectral imaging technology is used to collect PCB images, combine visible light, near-infrared, and ultraviolet light bands, evaluate image quality through mass coefficient calculation, automatically adjust the light angle and intensity, divide high-quality image areas, extract contrast, brightness and sharpness data, conduct comprehensive analysis to determine the effective character area, and identify printing errors through silkscreen feature extraction and design file comparison.

Benefits of technology

It realizes efficient and accurate automated detection of PCB silk screen quality, reduces false detection and missed detection rates, improves detection flexibility and accuracy, adapts to the differences between different PCB boards and design files, and significantly improves production efficiency and product quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478644B_ABST
    Figure CN119478644B_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of printed silk screen recognition, and specifically discloses an OCR recognition method and system for printed silk screen of PCB components. The multispectral imaging technology is used to collect PCB images under visible light, near infrared and ultraviolet light bands, so as to improve the visibility of characters and suppress the interference of high reflection or shadow areas. The quality coefficient of the image is obtained by calculating the structural similarity of the image at different scales, and compared with a preset threshold value, so as to automatically screen out high-quality images. The contrast, brightness and sharpness data of the high-quality image are extracted, and each area is comprehensively analyzed to determine the effective character area and mark it. The dynamic time warping algorithm is used to calculate the deviation coefficient between the actual silk screen feature and the design file feature, and by comparing with the preset threshold value, it is accurately identified whether there is a printing error in the silk screen.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of printed silk screen recognition, and in particular to an OCR recognition method and system for printed silk screen of PCB components. Background Art

[0002] With the rapid development of electronic technology, printed circuit boards (PCBs), as an important part of electronic equipment, play a vital role in the manufacturing process of various electronic products. Especially in the precision production of modern electronic products, silk screen printing, as a key process in PCB manufacturing, is responsible for printing logos, characters and lines on PCB boards, which directly affects the quality and reliability of the final product. Especially in the application of PCB surface mounting technology, the accuracy and quality of silk screen printing are crucial to the correct assembly of components. However, with the increasing complexity of PCB design and manufacturing processes, traditional silk screen quality inspection methods are increasingly difficult to meet the requirements of high efficiency and high precision. Therefore, how to achieve efficient and accurate automated inspection of PCB silk screen printing has become an important challenge in modern electronic manufacturing.

[0003] The prior art has the following deficiencies:

[0004] Some existing automated image processing technologies, such as traditional methods based on edge detection or grayscale analysis, have limited effects in complex backgrounds, low contrast or high reflection environments. In particular, when there are reflections, shadows or other complex interference factors on the PCB surface, traditional methods often cannot extract clear characters or logo information, resulting in reduced detection accuracy. Traditional silk screen detection methods often have difficulty identifying those tiny silk screen errors or shape distortions, especially for small characters or complex pattern designs. Existing technologies cannot efficiently capture and correct these subtle differences, resulting in a high false detection or missed detection rate. Existing detection methods are usually based on fixed rules or templates, which are difficult to adapt to the diversity of different PCB boards and the differences in design. With the diversification and complexity of PCB design, traditional detection methods are not versatile enough and cannot flexibly respond to changes between different design files and actual silk screen images, resulting in insufficient robustness and adaptability of the system. Summary of the invention

[0005] The object of the present invention is to provide an OCR recognition method and system for PCB component printing screen printing to solve the above-mentioned background problems.

[0006] The purpose of the present invention can be achieved through the following technical solutions:

[0007] The OCR recognition method for printed silk screen of PCB components includes the following steps:

[0008] S1: Collect PCB images through multispectral imaging technology, combine visible light, near infrared, and ultraviolet light bands to improve character quality, and automatically adjust the lighting angle and intensity according to the PCB reflection characteristics to evaluate the adjusted PCB image acquisition quality;

[0009] S2: According to the evaluation results, the PCB image acquisition quality is divided into high-quality images and low-quality images, the high-quality images are extracted, the high-quality images are divided into several identical areas, and the contrast data, brightness data and sharpness data in each area are obtained respectively;

[0010] S3: Perform a comprehensive analysis on the contrast, brightness and sharpness of each area, determine the valid character area according to the analysis results, and mark the valid character area;

[0011] S4: Extract silk screen features from the effective character area, generate geometric features and morphological features of silk screen, compare and analyze the geometric features and morphological features of silk screen with the design file, and identify whether there are printing errors in silk screen.

[0012] As a further solution of the present invention: the evaluating the adjusted PCB image acquisition quality specifically includes:

[0013] The quality coefficient of PCB image acquisition is obtained by calculating the structural similarity of the adjusted PCB image at multiple scales. The quality change of the adjusted image at different scales is evaluated by comparing the quality coefficient with a preset threshold.

[0014] As a further solution of the present invention: the process of obtaining the quality coefficient is:

[0015] Preprocess the acquired PCB image, measure the height and width of the PCB image, and set the PCB image as:

[0016] ;

[0017] In the formula, Represents the input PCB image, Indicates the height of the image. Indicates the width of the image. Indicates the number of channels of the image, Represents PCB image The numerical range of is the real number domain;

[0018] Through multiple convolutional layers, features of different scales are extracted. The calculation expression is:

[0019] ;

[0020] In the formula, Representation scale The input image is Representation scale The feature map extracted below, represents the number of scales, represents a convolutional neural network;

[0021] Calculate the structural similarity at multiple scales, specifically including: for each pair of adjusted images and the original image In scale The structural similarity on , calculate the value of structural similarity, the calculation expression is:

[0022] ;

[0023] In the formula, The value representing the structural similarity, Represents the average brightness value of the original image, Represents the average brightness value of the adjusted image. represents the local variance of the original image, represents the local variance of the adjusted image, represents the covariance between images, and represents the constant added for stability;

[0024] The structural similarity of each scale is integrated, and the weighted average value of the structural similarity of each scale is taken to obtain the quality coefficient of the collected PCB image. The calculation expression is:

[0025] ;

[0026] In the formula, Indicates the quality coefficient of the acquired PCB image, Indicates The weight coefficient of the layer scale, N represents the total number of scales.

[0027] As a further solution of the present invention: the PCB image acquisition quality is divided into high-quality images and low-quality images according to the evaluation results, specifically including:

[0028] Determine whether the quality coefficient of the PCB image is greater than or equal to a preset threshold, and if so, record it as a high-quality image;

[0029] If not, it is recorded as a low-quality image.

[0030] As a further solution of the present invention: the high-quality image is divided into a number of identical regions, and contrast data, brightness data and sharpness data in each region are obtained respectively. The specific acquisition process is:

[0031] The contrast data represents the degree of change of the grayscale value of pixels in the image, and is obtained by calculating the local grayscale difference. The calculation expression is:

[0032] ;

[0033] in, Indicates the number of regions, Indicates Contrast data in the area, represents the total number of pixels in each region, In each area pixels, represents the average gray value in each area. In each sub-area The gray value of pixels;

[0034] Brightness data represents the overall grayscale of the image area, which is calculated by averaging the grayscale values ​​of all pixels in the area. Brightness data is recorded as ;

[0035] Sharpness data indicates the clarity of edges and details in an image. The sharpness is expressed by calculating the gradient of the image in the horizontal and vertical directions and taking the sum of the absolute values. The calculation expression of sharpness data is:

[0036] ;

[0037] In the formula, Indicates Sharpness data in the area, Indicates The gradient operator of the region in the horizontal direction, Indicates The gradient operator of the region in the vertical direction, Represents the pixel coordinates within each region.

[0038] As a further solution of the present invention: the contrast, brightness and sharpness of each area are comprehensively analyzed, and the effective character area is determined according to the analysis result, and the effective character area is marked, which specifically includes:

[0039] The contrast data, brightness data and sharpness data of each region are expressed as a feature vector of the corresponding region;

[0040] The eigenvectors of all regions are combined into a feature matrix;

[0041] In order to eliminate the differences between different feature dimensions, the feature matrix X is standardized;

[0042] Calculate the covariance matrix between features to measure the correlation between different features;

[0043] Among them, the calculation expression of the covariance matrix is:

[0044] ;

[0045] In the formula, represents the covariance matrix, represents the transpose of the normalized feature matrix, represents the total number of regions, Represents the standardized data;

[0046] Perform eigendecomposition on the covariance matrix to obtain the eigenvalues ​​and corresponding eigenvectors;

[0047] Among them, the characteristic decomposition calculation expression is:

[0048] ;

[0049] In the formula, represents the eigenvalue, represents the corresponding eigenvector;

[0050] Sort the eigenvalues ​​of the covariance matrix, select the maximum eigenvalue and its corresponding eigenvector to form the principal component direction;

[0051] Map the standardized data to the principal component direction and calculate the effectiveness score of each region. The calculation expression is:

[0052] ;

[0053] In the formula, Indicates The validity score of the region, Indicates the number of regions, The eigenvector representing the direction of the first principal component, Indicates The normalized feature vector of the region;

[0054] comparing the validity score within each region to a preset threshold;

[0055] If the validity score is greater than or equal to the preset threshold, the corresponding area is recorded as a valid character area and marked.

[0056] As a further solution of the present invention: the step of identifying whether there is a printing error in the silk screen printing specifically includes:

[0057] By extracting edge contour features from the actual silk-screen image and the design file, the difference between each pair of corresponding feature points is calculated;

[0058] The recursive formula is used to calculate the cumulative minimum distance of each pair of feature points, and the shortest path distance is obtained through the final element of the cumulative distance matrix;

[0059] The characteristic deviation coefficient is calculated by the ratio of the shortest path distance to the maximum distance;

[0060] By comparing the characteristic deviation coefficient with the preset threshold, it is possible to identify whether there is printing error in the silk screen.

[0061] As a further solution of the present invention: the acquisition logic of the characteristic deviation coefficient is:

[0062] Extract geometric features and morphological features from the actual PCB silk-screen image and design file, and extract edge contour data;

[0063] The sequence of contour points obtained by image edge detection includes:

[0064] Actual silk-screen feature sequence, contour feature sequence extracted from actual image;

[0065] Design file feature sequence, the expected sequence of profile features in the design file;

[0066] By calculating the distance between the two sequences, we can get the similarity between the two sequences.

[0067] Constructing a cumulative distance matrix, wherein the cumulative distance matrix is ​​used to record the minimum cumulative distance between each pair of points in the sequence;

[0068] After completing the cumulative distance matrix, the cumulative distance of the shortest path is obtained through the last element of the matrix;

[0069] The cumulative distance of the shortest path is: the total deviation between the actual screen printing feature sequence and the design file feature sequence;

[0070] The feature deviation coefficient is obtained by calculating the ratio of the shortest path distance between the actual screen printing feature and the design file feature to the maximum Euclidean distance corresponding to the maximum length of the two sequences.

[0071] OCR recognition system for PCB component printing screen printing, including:

[0072] A multispectral image acquisition and illumination adjustment module, which uses multispectral imaging technology to acquire PCB images, and automatically adjusts the illumination angle and intensity according to the reflective characteristics of the PCB to evaluate the image acquisition quality;

[0073] An image quality assessment and region division module, wherein the image quality assessment and region division module divides the quality of the PCB image into two categories: high quality and low quality, extracts the high quality image, and divides it into a number of identical regions;

[0074] A regional effective character analysis and marking module, which performs a comprehensive analysis on the contrast, brightness and sharpness data of each region, determines the effective character regions based on the analysis results, and marks these regions;

[0075] The silk screen feature extraction and comparison analysis module extracts silk screen features from the effective character area, generates geometric features and morphological features, and compares and analyzes them with the silk screen features in the design file to identify whether there are printing errors.

[0076] Beneficial effects of the present invention:

[0077] (1) The present invention establishes an accurate and intelligent image quality assessment mechanism by introducing a quality coefficient calculation method; the mechanism combines a multi-scale structural similarity calculation method, which can comprehensively measure the quality changes of images at different scales, and then automatically distinguish high-quality images from low-quality images by comparing with a preset threshold; this method can effectively screen out high-quality images suitable for further analysis, reduce the interference of low-quality images, avoid subjective bias or inconsistency that may be caused by traditional manual screening, and significantly improve the degree of automation of image processing; through the introduction of the quality coefficient, the entire image processing process becomes more intelligent, and automated screening and evaluation greatly improve the processing efficiency, saving the time and cost of manual operation; the accurate calculation of the quality coefficient not only optimizes the image screening process, but also effectively improves the accuracy of image analysis, so that subsequent tasks such as character recognition, feature extraction and error analysis can be performed on the basis of high-quality images, ensuring the reliability of the entire system in terms of efficiency and accuracy;

[0078] (2) The present invention realizes the automation and efficiency of screen printing error detection by combining multi-step analysis algorithms such as image quality assessment, region division, feature extraction and structural similarity calculation; using the dynamic time warping algorithm, we accurately calculate the deviation coefficient between the actual screen printing features and the design file features, which can quantitatively evaluate the difference between the two, and further accurately determine whether there is a screen printing error by comparing with the preset threshold; this method can not only identify tiny geometric errors in the printing process, but also adapt to various complex situations and handle the differences between different PCB boards and design files; its superiority lies in the ability to finely analyze the deviation between the screen printing features and the design requirements, thereby improving the flexibility and accuracy of printing quality detection and avoiding the errors and limitations of traditional manual detection. In addition, the adaptability and automation characteristics of the algorithm enable it to perform quality control efficiently and accurately on the production line, which not only improves production efficiency, but also reduces the error rate of manual operation, further improving the overall quality of PCB screen printing. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] The present invention will be further described below in conjunction with the accompanying drawings.

[0080] Figure 1 It is a flowchart of the specific steps of the OCR recognition method for PCB component printing and silk screen printing of the present invention;

[0081] Figure 2 It is a flow chart of the OCR recognition system used for PCB component printing and silk screen printing in the present invention. DETAILED DESCRIPTION

[0082] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0083] See also Figure 1 As shown, the present invention is an OCR recognition method for PCB component printing screen printing, comprising the following steps:

[0084] S1: Collect PCB images through multispectral imaging technology, combine visible light, near infrared, and ultraviolet light bands to improve character quality, and automatically adjust the lighting angle and intensity according to the PCB reflection characteristics to evaluate the adjusted PCB image acquisition quality;

[0085] S2: According to the evaluation results, the PCB image acquisition quality is divided into high-quality images and low-quality images, the high-quality images are extracted, the high-quality images are divided into several identical areas, and the contrast data, brightness data and sharpness data in each area are obtained respectively;

[0086] S3: Perform a comprehensive analysis on the contrast, brightness and sharpness of each area, determine the valid character area according to the analysis results, and mark the valid character area;

[0087] S4: Extract silk screen features from the effective character area, generate geometric features and morphological features of silk screen, compare and analyze the geometric features and morphological features of silk screen with the design file, and identify whether there are printing errors in silk screen.

[0088] In S1, PCB images are collected through multispectral imaging technology, combining visible light, near-infrared, and ultraviolet light bands to improve character visibility, and the lighting angle and intensity are automatically adjusted according to the PCB reflection characteristics to evaluate the quality of the adjusted PCB image collection, including:

[0089] It should be noted that the specific steps for collecting PCB images through multispectral imaging technology are as follows:

[0090] First, multispectral imaging equipment is used to capture images of the PCB board, and images under visible light, near-infrared and ultraviolet light bands are obtained respectively; secondly, the images of different bands are processed separately through spectral separation technology to highlight the character features under different spectra; then, according to the reflective characteristics of the PCB, the illumination angle and illumination intensity are dynamically adjusted to suppress the interference of high reflection or shadow areas; finally, the multispectral images are fused and compared to comprehensively extract the high contrast and high visibility information of the character area to provide clear and complete input data for subsequent character recognition.

[0091] According to the calculated structural similarity of the adjusted PCB image at multiple scales, the quality coefficient of the PCB image acquisition is obtained, and according to the comparison between the quality coefficient and the preset threshold, the quality change of the adjusted image at different scales is evaluated;

[0092] The process of obtaining the quality coefficient is as follows:

[0093] Preprocess the acquired PCB image, measure the height and width of the PCB image, and set the PCB image as: ;

[0094] In the formula, Represents the input PCB image, Indicates the height of the image. Indicates the width of the image. Indicates the number of channels of the image, Represents PCB image The numerical range of is the real number domain;

[0095] Through multiple convolutional layers, features of different scales are extracted. The calculation expression is:

[0096] ;

[0097] In the formula, Representation scale The input image is Representation scale The feature map extracted below, represents the number of scales, represents a convolutional neural network;

[0098] Compute the structural similarity at multiple scales, specifically, for each pair of adjusted images and the original image In scale The structural similarity on , calculate the value of structural similarity, the calculation expression is:

[0099] ;

[0100] In the formula, The value representing the structural similarity, Represents the average brightness value of the original image, Represents the average brightness value of the adjusted image. represents the local variance of the original image, represents the local variance of the adjusted image, represents the covariance between images, and represents the constant added for stability;

[0101] The structural similarity of each scale is integrated, and the weighted average value of the structural similarity of each scale is taken to obtain the quality coefficient of the collected PCB image. The calculation expression is:

[0102] ;

[0103] In the formula, Indicates the quality coefficient of the acquired PCB image, Indicates The weight coefficient of the layer scale, N represents the total number of scales;

[0104] According to the evaluation results, the PCB image acquisition quality is divided into high-quality images and low-quality images, including:

[0105] Compare the quality factor of each PCB image with a preset threshold;

[0106] If the quality coefficient of the PCB image is greater than or equal to the preset threshold, it means that the corresponding PCB image has high quality and is recorded as a high-quality image;

[0107] If the quality coefficient of the PCB image is less than the preset threshold, it means that the corresponding PCB image has low quality and is recorded as a low-quality image;

[0108] It should be noted that the quality coefficient is an evaluation index obtained by quantitatively calculating the structural similarity of the image at different scales. It is used to measure whether the quality of the adjusted PCB image meets the expected standard. The larger the value of the quality coefficient, the higher the corresponding PCB image quality.

[0109] Extract high-quality images, divide the high-quality images into several identical areas, and obtain the contrast data, brightness data and sharpness data in each area, including:

[0110] The contrast data represents the degree of change of the grayscale value of pixels in the image, which is obtained by calculating the local grayscale difference. The calculation expression is:

[0111] ;

[0112] in, Indicates the number of regions, Indicates Contrast data in the area, represents the total number of pixels in each region, In each area pixels, represents the average gray value in each area. In each sub-area The gray value of pixels;

[0113] The brightness data reflects the overall grayscale of the image area, which is calculated by averaging the grayscale values ​​of all pixels in the area. The brightness data is recorded as ;

[0114] The sharpness data indicates the clarity of the edges and details in the image. The sharpness is expressed by calculating the gradient of the image in the horizontal and vertical directions and taking the sum of the absolute values. The calculation expression of the sharpness data is:

[0115] ;

[0116] In the formula, Indicates Sharpness data in the area, Indicates The gradient operator of the region in the horizontal direction, Indicates The gradient operator of the region in the vertical direction, Represents the pixel coordinates within each region.

[0117] In S3, the contrast, brightness and sharpness of each area are comprehensively analyzed, and the valid character area is determined based on the analysis results, and the valid character area is marked, including:

[0118] The contrast data, brightness data and sharpness data of each region are expressed as a feature vector of the corresponding region;

[0119] The eigenvectors of all regions are combined into a feature matrix;

[0120] In order to eliminate the differences between different feature dimensions, the feature matrix X is standardized;

[0121] Calculate the covariance matrix between features to measure the correlation between different features;

[0122] Among them, the calculation expression of the covariance matrix is:

[0123] ;

[0124] In the formula, represents the covariance matrix, represents the transpose of the normalized feature matrix, represents the total number of regions, Represents the standardized data;

[0125] Perform eigendecomposition on the covariance matrix to obtain the eigenvalues ​​and corresponding eigenvectors;

[0126] Among them, the characteristic decomposition calculation expression is:

[0127] ;

[0128] In the formula, represents the eigenvalue, represents the corresponding eigenvector;

[0129] Sort the eigenvalues ​​of the covariance matrix, select the maximum eigenvalue and its corresponding eigenvector to form the principal component direction;

[0130] Map the standardized data to the principal component direction and calculate the effectiveness score of each region. The calculation expression is:

[0131] ;

[0132] In the formula, Indicates The validity score of the region, Indicates the number of regions, The eigenvector representing the direction of the first principal component, Indicates The normalized feature vector of the region;

[0133] comparing the validity score within each region to a preset threshold;

[0134] If the validity score is greater than or equal to the preset threshold, the corresponding area is recorded as a valid character area and marked.

[0135] In S4, the silk screen features are extracted from the valid character area to generate the geometric features and morphological features of the silk screen. The geometric features and morphological features of the silk screen are compared and analyzed with the design file to identify whether there are printing errors in the silk screen, including:

[0136] By extracting edge contour features from the actual silk-screen image and design file, calculating the difference between each pair of corresponding feature points, and using the recursive formula to calculate the cumulative minimum distance of each pair of feature points, the shortest path distance is obtained through the final element of the cumulative distance matrix, and the feature deviation coefficient is calculated by the ratio of the shortest path distance to the maximum distance. The feature deviation coefficient is compared with the preset threshold to identify whether there is a printing error in the silk-screen;

[0137] Among them, the acquisition logic of the characteristic deviation coefficient is:

[0138] Extract geometric features and morphological features from the actual PCB silk-screen image and design file, and extract edge contour data;

[0139] The sequence of contour points obtained by image edge detection (such as Canny algorithm) includes:

[0140] Actual silk-screen feature sequence, contour feature sequence extracted from actual image;

[0141] Design file feature sequence, the expected sequence of profile features in the design file;

[0142] By calculating the distance between the two sequences, we can get the similarity between the two sequences. The calculation expression is:

[0143] ;

[0144] In the formula, Indicates the number of actual silk screen feature points. Indicates the number of feature points in the design file, Indicates The actual silk screen feature points and The Euclidean distance between the feature points of the design files, , and , Represents the feature points and of and coordinate;

[0145] Constructing a cumulative distance matrix, wherein the cumulative distance matrix is ​​used to record the minimum cumulative distance between each pair of points in the sequence;

[0146] Among them, the recursive formula of the cumulative distance matrix is:

[0147] ;

[0148] In the formula, The feature sequence representing the actual silk screen and design file is at position and The matching cumulative distance between ;

[0149] After the cumulative distance matrix is ​​completed, the cumulative distance of the shortest path is obtained through the last element of the matrix, and the cumulative distance of the shortest path is the total deviation between the actual screen printing feature sequence and the design file feature sequence;

[0150] The feature deviation coefficient is obtained by calculating the ratio of the shortest path distance between the actual screen printing feature and the design file feature to the maximum Euclidean distance corresponding to the maximum length of the two sequences;

[0151] Compare the characteristic deviation coefficient of each actual silk screen with the preset threshold value;

[0152] If the characteristic deviation coefficient is greater than or equal to the preset threshold, the deviation between the corresponding silk screen and the design file is high, indicating that there is a printing error in the actual silk screen;

[0153] If the characteristic deviation coefficient is less than the preset threshold, the deviation between the corresponding silk screen and the design file is low, indicating that there is no printing error in the actual silk screen.

[0154] See also Figure 2 As shown, the OCR recognition system for PCB component printing screen printing includes:

[0155] A multispectral image acquisition and illumination adjustment module, which uses multispectral imaging technology to acquire PCB images, and automatically adjusts the illumination angle and intensity according to the reflective characteristics of the PCB to evaluate the image acquisition quality;

[0156] An image quality assessment and region division module, wherein the image quality assessment and region division module divides the quality of the PCB image into two categories: high quality and low quality, extracts the high quality image, and divides it into a number of identical regions;

[0157] A regional effective character analysis and marking module, which performs a comprehensive analysis on the contrast, brightness and sharpness data of each region, determines the effective character regions based on the analysis results, and marks these regions;

[0158] The silk screen feature extraction and comparison analysis module extracts silk screen features from the effective character area, generates geometric features and morphological features, and compares and analyzes them with the silk screen features in the design file to identify whether there are printing errors.

[0159] The working principle of the present invention is as follows: through multi-spectral imaging technology, PCB images are collected respectively using visible light, near-infrared and ultraviolet light bands, and the illumination angle and intensity are automatically adjusted in combination with the reflection characteristics, so as to improve the visibility of characters and optimize the image quality; by calculating the structural similarity at multiple scales, the quality coefficient of the image is obtained, and compared with the preset threshold, the image quality is evaluated, and then the image is graded and divided into high-quality images and low-quality images; the high-quality image is divided into regions, the contrast, brightness and sharpness data of each region are extracted, and the mark of the effective character region is obtained by comprehensive analysis; based on the characteristics of the effective character region, the geometric features and morphological features of the silk screen are extracted, and compared and analyzed with the design file; through The characteristic deviation coefficient between the actual silk screen and the design file is calculated through a dynamic time warping algorithm to identify whether there is a printing error in the silk screen; specifically, an edge detection algorithm is used to extract the contour feature sequence in the actual silk screen and the design file, the Euclidean distance between the two sequences is calculated, a cumulative distance matrix is ​​constructed, and the similarity between the two is calculated through the shortest path distance; the characteristic deviation coefficient is calculated and compared with a preset threshold. If the deviation coefficient is greater than the threshold, it means that there is a printing error. If it is less than the threshold, it means that the silk screen meets the design requirements; the present invention provides an efficient and accurate PCB silk screen quality detection solution through a multi-level image processing and analysis method, which is widely applicable to the fields of automated detection and quality control of PCB boards.

[0160] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.

[0161] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.

[0162] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.

[0163] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0164] The above is a detailed description of an embodiment of the present invention, but the content is only a preferred embodiment of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.

Claims

1. An OCR recognition method for printed silk screen of PCB components, characterized in that: The following steps are involved: S1: Collect PCB images through multispectral imaging technology, combine visible light, near infrared, and ultraviolet light bands to improve character quality, and automatically adjust the lighting angle and intensity according to the PCB reflection characteristics to evaluate the adjusted PCB image acquisition quality; The evaluating and adjusting the PCB image acquisition quality specifically includes: According to the calculated structural similarity of the adjusted PCB image at multiple scales, the quality coefficient of the PCB image acquisition is obtained, and according to the comparison between the quality coefficient and the preset threshold, the quality change of the adjusted image at different scales is evaluated; S2: According to the evaluation results, the PCB image acquisition quality is divided into high-quality images and low-quality images, the high-quality images are extracted, the high-quality images are divided into several identical areas, and the contrast data, brightness data and sharpness data in each area are obtained respectively; S3: Perform a comprehensive analysis on the contrast, brightness and sharpness of each area, determine the valid character area according to the analysis results, and mark the valid character area; S4: Extract silk screen features from the valid character area, generate geometric features and morphological features of silk screen, compare and analyze the geometric features and morphological features of silk screen with the design file, and identify whether there are printing errors in silk screen; The identification of whether there is a printing error in the silk screen printing specifically includes: By extracting edge contour features from the actual silk-screen image and the design file, the difference between each pair of corresponding feature points is calculated; The recursive formula is used to calculate the cumulative minimum distance of each pair of feature points, and the shortest path distance is obtained through the final element of the cumulative distance matrix; The characteristic deviation coefficient is calculated by the ratio of the shortest path distance to the maximum distance; By comparing the characteristic deviation coefficient with the preset threshold, it is possible to identify whether there is printing error in the silk screen.

2. The OCR recognition method for PCB component printing screen printing according to claim 1, characterized in that: The process of obtaining the quality coefficient is as follows: Preprocess the acquired PCB image, measure the height and width of the PCB image, and set the PCB image as: ; In the formula, Represents the input PCB image, Indicates the height of the image. Indicates the width of the image. Indicates the number of channels of the image, Represents PCB image The numerical range of is the real number domain; Through multiple convolutional layers, features of different scales are extracted. The calculation expression is: ; In the formula, Representation scale The input image is Representation scale The feature map extracted below, represents the number of scales, represents a convolutional neural network; Calculate the structural similarity at multiple scales, specifically including: for each pair of adjusted images and the original image In scale The structural similarity on , calculate the value of structural similarity, the calculation expression is: ; In the formula, The value representing the structural similarity, Represents the average brightness value of the original image, Represents the average brightness value of the adjusted image, represents the local variance of the original image, represents the local variance of the adjusted image, represents the covariance between images, and represents the constant added for stability; The structural similarity of each scale is integrated, and the weighted average value of the structural similarity of each scale is taken to obtain the quality coefficient of the collected PCB image. The calculation expression is: ; In the formula, Indicates the quality coefficient of the acquired PCB image, Indicates The weight coefficient of the layer scale, N represents the total number of scales.

3. The OCR recognition method for PCB component printing screen printing according to claim 1, characterized in that: According to the evaluation results, the PCB image acquisition quality is divided into high-quality images and low-quality images, specifically including: Determine whether the quality coefficient of the PCB image is greater than or equal to a preset threshold, and if so, record it as a high-quality image; If not, it is recorded as a low-quality image.

4. The OCR recognition method for PCB component printing screen printing according to claim 1, characterized in that: The high-quality image is divided into a number of identical regions, and contrast data, brightness data and sharpness data in each region are obtained respectively. The specific acquisition process is as follows: The contrast data represents the degree of change of the grayscale value of pixels in the image, and is obtained by calculating the local grayscale difference. The calculation expression is: ; in, Indicates the number of regions, Indicates Contrast data in the area, represents the total number of pixels in each region, In each area pixels, represents the average gray value in each area. In each sub-area The gray value of pixels; Brightness data represents the overall grayscale of the image area, which is calculated by averaging the grayscale values ​​of all pixels in the area. Brightness data is recorded as ; Sharpness data indicates the clarity of edges and details in an image. The sharpness is expressed by calculating the gradient of the image in the horizontal and vertical directions and taking the sum of the absolute values. The calculation expression of sharpness data is: ; In the formula, Indicates Sharpness data in the area, Indicates The gradient operator of the region in the horizontal direction, Indicates The gradient operator of the region in the vertical direction, Represents the pixel coordinates within each region.

5. The OCR recognition method for PCB component printing screen printing according to claim 1, characterized in that: The contrast, brightness and sharpness of each area are comprehensively analyzed, and the valid character area is determined according to the analysis result, and the valid character area is marked, which specifically includes: The contrast data, brightness data and sharpness data of each region are expressed as a feature vector of the corresponding region; The eigenvectors of all regions are combined into a feature matrix; In order to eliminate the differences between different feature dimensions, the feature matrix X is standardized; Calculate the covariance matrix between features to measure the correlation between different features; Among them, the calculation expression of the covariance matrix is: ; In the formula, represents the covariance matrix, represents the transpose of the normalized feature matrix, represents the total number of regions, Represents the standardized data; Perform eigendecomposition on the covariance matrix to obtain the eigenvalues ​​and corresponding eigenvectors; The calculation expression of the characteristic decomposition is: ; In the formula, represents the eigenvalue, represents the corresponding eigenvector; Sort the eigenvalues ​​of the covariance matrix, select the maximum eigenvalue and its corresponding eigenvector to form the principal component direction; Map the standardized data to the principal component direction and calculate the effectiveness score of each region. The calculation expression is: ; In the formula, Indicates The validity score of the region, Indicates the number of regions, The eigenvector representing the direction of the first principal component, Indicates The normalized feature vector of the region; comparing the validity score within each region to a preset threshold; If the validity score is greater than or equal to the preset threshold, the corresponding area is recorded as a valid character area and marked.

6. The OCR recognition method for PCB component printing screen printing according to claim 1, characterized in that: The acquisition logic of the characteristic deviation coefficient is: Extract geometric features and morphological features from the actual PCB silk-screen image and design file, and extract edge contour data; The sequence of contour points obtained by image edge detection includes: Actual silk-screen feature sequence, contour feature sequence extracted from actual image; Design file feature sequence, the expected sequence of profile features in the design file; By calculating the distance between the two sequences, we can get the similarity between the two sequences. Constructing a cumulative distance matrix, wherein the cumulative distance matrix is ​​used to record the minimum cumulative distance between each pair of points in the sequence; After completing the cumulative distance matrix, the cumulative distance of the shortest path is obtained through the last element of the matrix; The cumulative distance of the shortest path is: the total deviation between the actual screen printing feature sequence and the design file feature sequence; The feature deviation coefficient is obtained by calculating the ratio of the shortest path distance between the actual screen printing feature and the design file feature to the maximum Euclidean distance corresponding to the maximum length of the two sequences.

7. OCR recognition system for PCB component printing screen, characterized in that: The OCR recognition method for PCB component printing screen printing as claimed in any one of claims 1 to 6 comprises: A multispectral image acquisition and illumination adjustment module, which uses multispectral imaging technology to acquire PCB images, and automatically adjusts the illumination angle and intensity according to the reflective characteristics of the PCB to evaluate the image acquisition quality; An image quality assessment and region division module, wherein the image quality assessment and region division module divides the quality of the PCB image into two categories: high quality and low quality, extracts the high quality image, and divides it into a number of identical regions; A regional effective character analysis and marking module, which performs a comprehensive analysis on the contrast, brightness and sharpness data of each region, determines the effective character regions based on the analysis results, and marks these regions; The silk screen feature extraction and comparison analysis module extracts silk screen features from the effective character area, generates geometric features and morphological features, and compares and analyzes them with the silk screen features in the design file to identify whether there are printing errors.

Citation Information

Patent Citations

  • Image fusion method based on multi-scale strategy

    CN116805388A

  • Abnormity detection method, device and equipment for PCB of new energy automobile and storage medium

    CN119295843A

  • Surface inspection of object using image processing

    US20030059103A1