Pattern detection method and system for laser anti-counterfeiting paper
By purifying the training data through two-stage principal component analysis and regression model, an appearance model responding to illumination and viewing angle was constructed, solving the problem of inaccurate defect identification of laser anti-counterfeiting paper under different illumination and angles, and achieving high-precision defect detection.
Patent Information
- Application Number
- CN202511693478.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-10
AI Technical Summary
The surface texture of laser anti-counterfeiting paper changes drastically under different lighting and viewing angles, making it difficult for existing technologies to identify defects in real time and accurately, resulting in inaccurate identification results.
By using two-stage principal component analysis and regression models, the training dataset is purified, and an appearance model that can respond to lighting and viewing angle is constructed. The regression model is used to predict the basis vector weights, and a standard texture map is reconstructed and compared with real-time images to achieve defect detection.
Accurate identification of defects in laser anti-counterfeiting paper was achieved under drastic optical changes, improving the accuracy and robustness of detection.
Smart Images

Figure CN121504880A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method and system for detecting patterns on laser anti-counterfeiting paper. Background Technology
[0002] Laser anti-counterfeiting paper, as an important anti-counterfeiting material, is widely used in the packaging of products such as tobacco, alcohol, and pharmaceuticals due to its unique visual effects and complex manufacturing process. During production, to ensure product quality, precise defect detection of the surface pattern of laser anti-counterfeiting paper is necessary. However, the surface texture of laser anti-counterfeiting paper exhibits strong angle and lighting dependence; that is, its appearance in the image changes drastically under different viewing angles and lighting conditions. This optical change caused by variations in normal imaging conditions also masks actual printing defects, posing a significant technical challenge to defect detection and resulting in inaccurate defect identification results for laser anti-counterfeiting paper.
[0003] To model the complex texture of laser anti-counterfeiting paper, existing technologies typically employ principal component analysis (PCA) to learn from a large number of flawless sample images, extracting the main patterns of texture changes and constructing a spatial model capable of describing the complex texture. However, during real-time detection, the spatial model constructed by PCA struggles to respond accurately to current illumination parameters and viewing angles in real time, failing to overcome the problem of inaccurate defect identification results in laser anti-counterfeiting paper. Summary of the Invention
[0004] To address the technical problem of inaccurate defect identification results in laser anti-counterfeiting paper, this application provides a pattern detection method and system for laser anti-counterfeiting paper, which can overcome the interference caused by optical changes in laser anti-counterfeiting paper and achieve accurate and robust detection of defect areas.
[0005] In a first aspect, this application provides a method for detecting patterns on laser anti-counterfeiting paper. The method includes: performing a principal component analysis on a training dataset to obtain multiple initial basis vectors, wherein the training dataset includes training images of flawless laser anti-counterfeiting paper under different illumination parameters and viewing angles; dividing the initial basis vectors into optical basis vectors and contamination basis vectors; projecting each training image onto the contamination basis vectors, reconstructing and removing contamination components from the training images to obtain a cleaned dataset; performing a second principal component analysis on the cleaned dataset to obtain a target average texture and multiple target basis vectors, and training a regression model, wherein the input of the regression model is the illumination parameters and the viewing angle, and the output is the weights of each target basis vector; inputting the real-time illumination parameters and the real-time viewing angle corresponding to the real-time image into the regression model to predict the real-time weights of each target basis vector; weighting and summing the target basis vectors according to the real-time weights; adding the weighted sum to the target average texture to reconstruct a standard texture image; and comparing the real-time image with the standard texture image to obtain a defect identification result.
[0006] Initial basis vectors are obtained by performing a first principal component analysis (PCA) and contaminated basis vectors are separated to purify the training dataset. Then, target basis vectors and target average textures are established through a second principal component analysis. Contaminated basis vectors are used to remove noise and other contaminating components from the training data, ensuring the purity of the subsequent appearance model. Finally, a second PCA and regression model are used to construct an appearance model that can respond to real-time lighting and viewing angle, enabling it to reconstruct a standard texture map corresponding to real-time conditions. This achieves accurate identification of defects under drastic optical changes.
[0007] Preferably, the step of dividing the initial basis vectors into optical basis vectors and contaminated basis vectors includes: calculating the structural chaos degree of each initial basis vector, wherein the structural chaos degree is used to quantify the high-frequency change degree of the initial basis vectors after reconstruction into an image; classifying the initial basis vectors with a structural chaos degree index less than the chaos degree threshold as optical basis vectors, and classifying the initial basis vectors with a structural chaos degree index not less than the chaos degree threshold as contaminated basis vectors.
[0008] By utilizing structural chaos, the high-frequency changes of the initial basis vectors after reconstruction into an image were quantified. This enabled the automatic differentiation between basis vectors representing smooth optical changes and basis vectors representing high-frequency contamination changes, providing an accurate basis for subsequent dataset purification.
[0009] Preferably, the first initial basis vectors Structural Chaos Satisfying the relation: ; in, Based on the initial basis vectors In the reconstructed image The value at the location, These are the width and height of the reconstructed image, respectively. To reconstruct the total number of pixels in the image, For the Laplace operator.
[0010] Preferably, the process of reconstructing and removing contaminants from the training images to obtain a cleaned dataset includes: calculating the projection values of any training image onto each contaminant basis vector, and taking the product of each contaminant basis vector and its projection value as the contaminant component; subtracting the contaminant component from the training images to obtain cleaned training images; and all cleaned training images constitute the cleaned dataset.
[0011] The training dataset was corrected by using the separated contamination basis vectors, which enabled the accurate removal of noise and other contamination information from the training images, ensuring the purity of the cleaned dataset and laying the foundation for building an accurate optical appearance model.
[0012] Preferably, the training regression model includes: calculating the projection values of each purified training image in the purified dataset onto the plurality of target basis vectors, as the weights of each target basis vector; using the illumination parameters and viewing angles corresponding to the training images as input samples, and using the weights of each target basis vector as labels to form a mapping training set; and training the regression model using the mapping training set.
[0013] The mapping relationship between illumination parameters, observation angle and target basis vector weights was established by regression modeling. The trained regression model can accurately predict the texture that flawless laser anti-counterfeiting paper should have based on real-time illumination and angle parameters.
[0014] Preferably, the regression model is a neural network model, a support vector regression model, or a multinomial regression model.
[0015] Preferably, the standard texture map Satisfying the relation: ; in, For target average texture, For the first Target basis vectors For the first Real-time weights of each target basis vector The number of target basis vectors.
[0016] Preferably, obtaining the defect identification result includes: calculating the difference map between the real-time image and the standard texture map; determining the segmentation threshold using the maximum inter-class variance method, performing threshold segmentation on the difference map to obtain a binary map; and performing connected component analysis on the binary map to obtain the defect region.
[0017] Preferably, the illumination parameters are the azimuth and elevation angles of the light source, and the observation angle is the azimuth and elevation angles of the image acquisition device.
[0018] In a second aspect, this application also provides a pattern detection system for laser anti-counterfeiting paper, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a pattern detection method for laser anti-counterfeiting paper according to the first aspect of this application is implemented.
[0019] The technical solution of this application has the following beneficial technical effects: By acquiring training images of flawless laser anti-counterfeiting paper under different lighting parameters and viewing angles, and removing contaminants from the training images through two-stage principal component analysis, and then combining the regression model to predict the basis vector weights corresponding to the lighting parameters and viewing angles, adaptive reconstruction of the standard texture map is achieved. The standard texture map is compared with the real-time image and the differences are compared, which effectively overcomes the influence of the drastic changes in the texture information of laser anti-counterfeiting paper with the viewing angle and lighting on defect detection, and improves the accuracy of defect detection on laser anti-counterfeiting paper. Attached Figure Description
[0020] Figure 1 This is a flowchart of a pattern detection method for laser anti-counterfeiting paper according to an embodiment of this application.
[0021] Figure 2 This is a structural block diagram of a pattern detection system for laser anti-counterfeiting paper according to an embodiment of this application. Detailed Implementation
[0022] According to a first aspect of this application, this application provides a method for detecting patterns on laser anti-counterfeiting paper. Figure 1 This is a flowchart of a pattern detection method for laser anti-counterfeiting paper according to an embodiment of this application. Figure 1 As shown, the pattern detection method for laser anti-counterfeiting paper includes steps S101 to S106, which are described in detail below.
[0023] S101, perform a principal component analysis on the training dataset to obtain multiple initial basis vectors. The training dataset includes training images of flawless laser anti-counterfeiting paper under different lighting parameters and viewing angles.
[0024] In one embodiment, the surface texture of laser anti-counterfeiting paper undergoes drastic, non-linear optical changes with variations in lighting conditions and viewing angle. To learn how the surface texture of laser anti-counterfeiting paper changes with lighting conditions and viewing angle, it is necessary to collect multiple training images of flawless laser anti-counterfeiting paper under different lighting parameters and viewing angles to obtain a training dataset.
[0025] Specifically, flawless laser anti-counterfeiting paper is selected, and the illumination parameters and observation angles are continuously changed. Training images of the flawless laser anti-counterfeiting paper are collected under various combinations of illumination parameters and observation angles to form a training dataset. Each training image in the training dataset corresponds to one illumination parameter and one observation angle. To facilitate subsequent processing, each training image is vectorized to obtain a data vector, the dimension of which is equal to the size of the training image.
[0026] The illumination parameters can be the azimuth and elevation angles of the light source, and the observation angle can be the azimuth and elevation angles of the image acquisition device.
[0027] After obtaining the training dataset, perform a principal component analysis to calculate the average texture vector of the data vectors corresponding to all training images. satisfy: ,in, For training images The corresponding data vector, The number of training images in the training dataset. Then, a centered data matrix is constructed. Principal component analysis is performed on the centralized data matrix to obtain a set of principal component vectors, which are the initial basis vectors. ,in, The number of initial basis vectors.
[0028] S102, the initial basis vectors are divided into optical basis vectors and contamination basis vectors.
[0029] In one embodiment, since the initial basis vectors are a preliminary extraction of all the variation patterns in the training dataset, they inevitably mix optical variations caused by lighting conditions and viewing angles with contamination variations caused by sensor noise. Normal optical variations are usually represented as smooth, continuous large-scale structures in the image space, while contamination variations are represented as high-frequency, structurally disordered isolated points or fine textures in the image space.
[0030] Therefore, based on the high-frequency variation of the initial basis vectors in the image space, the initial basis vectors are divided into optical basis vectors and contaminated basis vectors. Specifically, dividing the initial basis vectors into optical basis vectors and contaminated basis vectors includes: calculating the structural chaos degree of each initial basis vector, wherein the structural chaos degree is used to quantify the high-frequency variation of the initial basis vectors after reconstruction into an image; classifying the initial basis vectors with a structural chaos degree index less than a chaos degree threshold as optical basis vectors, and classifying the initial basis vectors with a structural chaos degree index not less than the chaos degree threshold as contaminated basis vectors, wherein the chaos degree threshold is 5.
[0031] No. initial basis vectors Structural Chaos Satisfying the relation: ; in, Based on the initial basis vectors In the reconstructed image The value at the location, These are the width and height of the reconstructed image, respectively. To reconstruct the total number of pixels in the image, This is the Laplacian operator. The Laplacian operator is used to calculate the second derivative of an image, i.e., high-frequency variations.
[0032] It should be noted that the initial basis vectors The data vectors corresponding to the training images have the same dimension, i.e., the initial basis vectors. The dimension is equal to the size of the training image, and the initial basis vectors can be directly used. Convert to a reconstructed image of the same size as the training image.
[0033] If the first initial basis vectors This represents smooth optical basis vectors, whose second derivative in the reconstructed image approaches 0, and whose structural chaos degree... The value is very low; conversely, if the first initial basis vectors This represents high-frequency noise, whose reconstructed image has a large absolute value of the second derivative, leading to... The value is very high.
[0034] Thus, by introducing structural chaos, automated classification of the initial basis vectors is achieved.
[0035] S103. Project each training image onto the contamination basis vector, reconstruct and remove the contamination components from the training images to obtain the cleaned dataset.
[0036] In one embodiment, after separating the contamination basis vectors, the training dataset is iteratively purified using the contamination basis vectors.
[0037] The process of reconstructing and removing contaminants from training images to obtain a cleaned dataset includes: calculating the projection value of any training image onto each contaminant basis vector, and taking the product of each contaminant basis vector and its projection value as the contaminant component; subtracting the contaminant component from the training images to obtain cleaned training images; and all cleaned training images constitute the cleaned dataset.
[0038] Among them, training images In the pollution basis vectors Projection values on for: ; For training images The corresponding data vector, The average texture vector, for The transpose of .
[0039] The training image Pollutants contained in for: ;in, For training images In the pollution basis vectors Projection values on, For the first A pollution basis vector, It is the set of all pollution basis vectors.
[0040] Understandably, Training images All noise that can be characterized by the pollution basis vectors.
[0041] From training images After subtracting the contaminants, the purified training image is obtained. Corresponding data vector for: All the purified training images constitute the purified dataset.
[0042] In this way, by using the initial principal component analysis to obtain the noise information in the original training dataset, the training images in the training dataset are corrected in reverse, and the noise information is removed from the subsequent target average texture and multiple target basis vectors, thus ensuring the accuracy of the target average texture and multiple target basis vectors.
[0043] S104. Perform a second principal component analysis on the cleaned dataset to obtain the target average texture and multiple target basis vectors, and train a regression model. The input of the regression model is the illumination parameters and the viewing angle, and the output is the weight of each target basis vector.
[0044] In one embodiment, a quadratic principal component analysis is performed on the purified dataset. The specific process is as follows: First, the average value of all data vectors in the purified dataset is used to obtain the target average texture. Satisfying the relation: ,in For the cleaned training images The corresponding data vector, To clean up the number of training images in the dataset; then, a new centering matrix is constructed. Perform principal component analysis again on the new centered matrix; the resulting principal component vectors are the multiple target basis vectors.
[0045] It should be noted that, since high-frequency contaminants have been removed from the cleaned dataset, the resulting target average texture and multiple target basis vectors together constitute an appearance model that can accurately describe the optical changes of the laser anti-counterfeiting paper.
[0046] Furthermore, the training regression model includes: calculating the projection values of each purified training image in the purified dataset onto the plurality of target basis vectors, as the weights of each target basis vector; using the illumination parameters and viewing angles corresponding to the training images as input samples, and using the weights of each target basis vector as labels to form a mapping training set; and training the regression model using the mapping training set.
[0047] In the mapping training set, a mapping training sample is , Training images Illumination parameters and viewing angle, This is the weight vector, which includes the weights of each target basis vector. A regression model is trained using a mapping training set, enabling the trained model to accurately predict the weights of each target basis vector under different lighting parameters and viewing angles.
[0048] The regression model can be a neural network model, a support vector regression model, or a multinomial regression model; this application does not impose any restrictions.
[0049] For example, the regression model is a neural network model. A multilayer perceptron is constructed, where the number of nodes in the input layer equals the dimension of the illumination parameters and the viewing angle. The hidden layers can be set to one hidden layer with 32 nodes and one hidden layer with 16 nodes. The number of nodes in the output layer equals the number of target basis vectors. The multilayer perceptron is trained on a mapping training set using mean squared error as the loss function until the multilayer perceptron converges. At this point, the trained neural network model can predict the weights of each target basis vector based on the input illumination parameters and the viewing angle.
[0050] S105, input the real-time illumination parameters and real-time observation angle corresponding to the real-time image into the regression model, predict the real-time weights of each target basis vector, sum the target basis vectors according to the real-time weights, and add the weighted sum to the target average texture to reconstruct the standard texture map.
[0051] In one embodiment, on the production line, an image acquisition device is used to acquire real-time images, real-time illumination parameters, and real-time viewing angles of the laser anti-counterfeiting paper to be inspected. The real-time illumination parameters and real-time viewing angles can be obtained using inertial sensors deployed in the light source and the image acquisition device.
[0052] By inputting real-time lighting parameters and real-time observation angle into the regression model, the real-time weights of each target basis vector are predicted. At this time, the target average texture, multiple target basis vectors, and the real-time weights of each target basis vector are all known quantities, and the standard texture map can be reconstructed.
[0053] Specifically, the standard texture map Satisfying the relation: ; in, For target average texture, For the first Target basis vectors For the first Real-time weights of each target basis vector The number of target basis vectors. The standard texture map is the image information that flawless laser anti-counterfeiting paper should present under real-time lighting parameters and real-time viewing angle.
[0054] In this way, by using the appearance model that can accurately describe the optical changes of laser anti-counterfeiting paper, the image information that flawless laser anti-counterfeiting paper should present under real-time illumination parameters and real-time observation angle is adaptively reconstructed, and a standard texture map is obtained.
[0055] S106. Compare the real-time image with the standard texture image to obtain the defect identification result.
[0056] In one embodiment, obtaining the defect identification result includes: calculating the difference map between the real-time image and the standard texture map; determining the segmentation threshold using the maximum inter-class variance method, and then performing threshold segmentation on the difference map to obtain a binary map; and performing connected component analysis on the binary map to obtain the defect region.
[0057] The difference map includes the absolute values of the differences between each pixel in the real-time image and the standard texture map. Since the standard texture map represents the image information that flawless laser anti-counterfeiting paper should present under real-time lighting parameters and viewing angles, the pixel values in defect-free areas will approach 0, while defective areas will exhibit high brightness. Therefore, areas with a pixel value of 1 in the binary image are defective areas. Performing connected component analysis on this binary image yields the defect identification result. Thus, by iterative principal component analysis and dynamic texture reconstruction, the interference caused by optical changes in laser anti-counterfeiting paper is effectively overcome, and accurate and robust defect detection of defective areas is achieved.
[0058] According to a second aspect of this application, this application also provides a pattern detection system for laser anti-counterfeiting paper. Figure 2 This is a structural block diagram of a pattern detection system for laser anti-counterfeiting paper according to an embodiment of this application. Figure 2 As shown, the system 50 includes a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement a pattern detection method for laser anti-counterfeiting paper according to the first aspect of this application. The system also includes other components well-known to those skilled in the art, such as a communication bus and a communication interface. Their configurations and functions are known in the art and will not be described further here.
[0059] It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of this application, and these all fall within the scope of protection of this application.
Claims
1. A method for detecting patterns on laser anti-counterfeiting paper, characterized in that, The detection method includes: Perform a principal component analysis on the training dataset to obtain multiple initial basis vectors. The training dataset includes training images of flawless laser anti-counterfeiting paper under different lighting parameters and viewing angles. The initial basis vectors are divided into optical basis vectors and contamination basis vectors; each training image is projected onto the contamination basis vectors, and the contamination components in the training images are reconstructed and removed to obtain the cleaned dataset. A second principal component analysis was performed on the cleaned dataset to obtain the target average texture and multiple target basis vectors. A regression model was then trained, with the inputs of the regression model being the illumination parameters and the viewing angle, and the output being the weights of each target basis vector. The real-time illumination parameters and real-time observation angle corresponding to the real-time image are input into the regression model to predict the real-time weights of each target basis vector. The target basis vectors are weighted and summed according to the real-time weights. The weighted sum is added to the target average texture to reconstruct the standard texture map. By comparing real-time images with standard texture maps, defect identification results are obtained.
2. The method for detecting patterns on laser anti-counterfeiting paper according to claim 1, characterized in that, The process of dividing the initial basis vectors into optical basis vectors and contamination basis vectors includes: Calculate the structural chaos degree of each initial basis vector, which is used to quantify the high-frequency changes of the initial basis vectors after they are reconstructed into an image; Initial basis vectors with a structural chaos index less than the chaos threshold are classified as optical basis vectors, and initial basis vectors with a structural chaos index not less than the chaos threshold are classified as contaminated basis vectors.
3. The method for detecting patterns on laser anti-counterfeiting paper according to claim 2, characterized in that, No. initial basis vectors Structural Chaos Satisfying the relation: ; in, Based on the initial basis vectors In the reconstructed image The value at the location, These are the width and height of the reconstructed image, respectively. To reconstruct the total number of pixels in the image, For the Laplace operator.
4. The method for detecting patterns on laser anti-counterfeiting paper according to claim 1, characterized in that, The process of reconstructing and removing contaminants from the training images to obtain the purified dataset includes: Calculate the projection value of any training image onto each contamination basis vector, and take the product of each contamination basis vector and its projection value as the contamination component. The polluting components are subtracted from the training image to obtain the purified training image; All the cleaned training images constitute the cleaned dataset.
5. The method for detecting patterns on laser anti-counterfeiting paper according to claim 1, characterized in that, The training regression model includes: Calculate the projection values of each purified training image in the purified dataset onto the multiple target basis vectors, and use them as the weights of each target basis vector; The illumination parameters and viewing angles corresponding to the training images are used as input samples, and the weights of each target basis vector are used as labels to form a mapping training set. The regression model is trained using the mapping training set.
6. The method for detecting patterns on laser anti-counterfeiting paper according to claim 1, characterized in that, The regression model is a neural network model, a support vector regression model, or a multinomial regression model.
7. The method for detecting patterns on laser anti-counterfeiting paper according to claim 1, characterized in that, The standard texture map Satisfying the relation: ;in, For target average texture, For the first Target basis vectors For the first Real-time weights of each target basis vector The number of target basis vectors.
8. The method for detecting patterns on laser anti-counterfeiting paper according to claim 1, characterized in that, The defect identification result is obtained by: calculating the difference map between the real-time image and the standard texture map; determining the segmentation threshold using the maximum inter-class variance method, and then performing threshold segmentation on the difference map to obtain a binary map; and performing connected component analysis on the binary map to obtain the defect region.
9. The method for detecting patterns on laser anti-counterfeiting paper according to claim 1, characterized in that, The illumination parameters are the azimuth and elevation angles of the light source, and the observation angle is the azimuth and elevation angles of the image acquisition device.
10. A pattern detection system for laser anti-counterfeiting paper, characterized in that, It includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement a pattern detection method for laser anti-counterfeiting paper according to any one of claims 1 to 9.