A Method and System for Locating Printed Paperboard Based on Visual Image Segmentation and Edge Detection
By combining the characteristics of parallel and cross-polarized cameras, and utilizing dual-channel neural networks and semantic segmentation technology, the glare problem on reflective substrates was solved, enabling high-precision positioning of printed paperboard and improving production efficiency.
Patent Information
- Application Number
- CN202511339855.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2045-09-19
AI Technical Summary
Existing visual positioning technologies are prone to glare when facing reflective substrates, leading to a decrease in image quality and affecting the positioning accuracy and production efficiency of printed paperboards.
Images are acquired using parallel polarization cameras and cross polarization cameras. Polarization features are extracted using a dual-channel neural network to generate a parallel glare mask and adjust the weights of the cross polarization features. Edge detection is performed using a semantic segmentation network, and the edge position of the printed paperboard is determined through feature fusion and contour connection algorithms.
It significantly reduces glare interference, improves the reliability and positioning accuracy of image processing, reduces mechanical adjustment errors, and increases production efficiency.
Smart Images

Figure CN120833352B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of printing paperboard positioning, and more particularly to a method and system for printing paperboard positioning based on visual image segmentation and edge detection. Background Technology
[0002] In the automated production process of the printing industry, the precise positioning of the printing paperboard is a key step in ensuring printing quality. As the level of industrial automation continues to increase, the requirements for the accuracy and stability of the printing paperboard positioning are becoming increasingly stringent.
[0003] In recent years, image-based positioning methods have gradually emerged. However, existing visual positioning technologies have significant drawbacks when dealing with reflective substrates. Due to the characteristics of reflective materials, glare is easily generated during image acquisition. Glare severely interferes with image quality, causing errors in subsequent image processing algorithms (such as edge detection). For example, during substrate edge detection and positioning, abnormal image parameters in glare areas can mislead the edge detection algorithm, causing the detected edge position to deviate from the actual physical edge. This, in turn, affects the positioning accuracy of the printed paperboard, severely restricting the improvement of printing quality and production efficiency.
[0004] There is currently no good solution to the above problems. Summary of the Invention
[0005] This application provides a method and system for positioning printed paperboard based on visual image segmentation and edge detection, which is used to solve the glare phenomenon in the positioning of printed paperboard and improve the positioning accuracy of printed paperboard.
[0006] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0007] Firstly, a method for locating printed paperboard based on visual image segmentation and edge detection is provided, the method comprising:
[0008] Once the target substrate reaches the preset position, parallel polarization images and cross polarization images of the target substrate are acquired using a pre-set parallel polarization camera and a cross polarization camera, respectively.
[0009] By combining parallel polarization images and cross polarization images, a pre-defined dual-channel neural network is used to determine the parallel polarization features and cross polarization features respectively, and a parallel glare mask is determined based on the parallel polarization features.
[0010] The adjusted cross-polarization features are obtained by adjusting the feature weights of the cross-polarization features based on the parallel glare mask.
[0011] The adjusted cross-polarization features and parallel polarization features are combined to obtain a fused feature map;
[0012] The fused feature map is input into a preset semantic segmentation network model to obtain the edge probability map of the target substrate;
[0013] The edge positions of the target substrate are determined using a contour connection algorithm based on the edge probability map.
[0014] In another possible implementation of the first aspect, the parallel polarization features include parallel glare features and parallel non-glare features, and the cross-polarization features include cross-glare features and cross-non-glare features. The step of combining the parallel polarization image and the cross-polarization image to determine the parallel polarization features and the cross-polarization features using a preset dual-channel neural network, and determining the parallel glare mask based on the parallel polarization features, includes the following steps:
[0015] The brightness and reflection intensity features of the parallel polarization image are extracted using the first branch channel of a pre-defined dual-channel neural network.
[0016] Calculate the mean and standard deviation of luminance, as well as the mean and standard deviation of reflection intensity, based on luminance characteristics and reflection intensity characteristics, respectively;
[0017] A luminance threshold is set by combining the mean luminance and the standard deviation of luminance, and a reflection intensity threshold is set by combining the mean reflection and the standard deviation of reflection.
[0018] The region in a parallel polarization image whose brightness features exceed a brightness threshold and whose reflection intensity features exceed a reflection intensity threshold is defined as the parallel glare region.
[0019] The cross-glare and cross-non-glare features of the cross-polarized image are extracted using the second branch channel of a pre-defined dual-channel neural network.
[0020] Determine the parallel glare mask based on the parallel glare region;
[0021] Among them, the brightness and reflection intensity features of parallel glare in parallel polarized images are the maximum values under preset conditions, and the texture and edge features of cross-polarized images are the maximum values under preset conditions.
[0022] In another possible implementation of the first aspect, the extraction of cross-glare features and cross-non-glare features of the cross-polarized image using the second branch channel of a preset dual-channel neural network includes the following steps:
[0023] The texture and edge features of the cross-polarized image are extracted using the second branch channel of a pre-defined dual-channel neural network;
[0024] Determine the edge gradient magnitude and edge pixel connectivity based on edge features;
[0025] When the edge gradient magnitude is greater than or equal to a preset edge gradient threshold and the edge pixel connectivity is greater than or equal to a preset edge connectivity threshold, the cross-non-glare feature is determined.
[0026] When the edge gradient magnitude is less than a preset edge gradient threshold and the edge pixel connectivity is less than a preset edge connectivity threshold, the cross glare feature is determined.
[0027] When the edge gradient magnitude is greater than or equal to the preset edge gradient threshold and the edge pixel connectivity is less than the preset edge connectivity threshold, the texture complexity is calculated based on the texture features.
[0028] When the texture complexity does not exceed the preset texture feature threshold, the cross-glare feature is determined;
[0029] When the edge gradient magnitude is less than the preset edge gradient threshold and the edge pixel connectivity is greater than or equal to the preset edge connectivity threshold, the average edge gray value is calculated based on the edge features.
[0030] If the average grayscale value at the edge exceeds the preset grayscale threshold, then the cross-glare feature is determined.
[0031] In another possible implementation of the first aspect, the step of adjusting the feature weights of the cross-polarization features based on the parallel glare mask to obtain the adjusted cross-polarization features includes the following steps:
[0032] Spatial position matching between parallel glare masks and cross-polarization features is performed to determine the spatial correspondence between each parallel glare mask and cross-polarization feature.
[0033] The pixel values of the parallel glare mask corresponding to the cross-polarization features are determined based on the spatial correspondence.
[0034] Determine the cross-polarization characteristic value based on the cross-polarization characteristics;
[0035] The adjustment weight is calculated based on the pixel values of the parallel glare mask and the preset weight factor;
[0036] The adjusted cross-polarization feature is obtained by multiplying the adjusted weights by the cross-polarization eigenvalues.
[0037] In another possible implementation of the first aspect, the step of combining the adjusted cross-polarization features and parallel polarization features to obtain a fused feature map includes the following steps:
[0038] The adjusted cross-polarization features and parallel polarization features are used to construct the first feature layer structure and the second feature layer structure, respectively.
[0039] Calculate the weight value of each feature in the first feature hierarchical structure and the weight value of each feature in the second feature hierarchical structure;
[0040] A total weight map is constructed by combining the weight values in the first feature hierarchical structure and the weight values in the second feature hierarchical structure;
[0041] Based on the overall weight map, the first feature hierarchical structure, and the second feature hierarchical structure, features at the same level are spliced together according to their corresponding levels to obtain the fused features;
[0042] The fused feature map is obtained by constructing a Laplace pyramid based on the fused features.
[0043] In another possible implementation of the first aspect, constructing a first feature layer structure and a second feature layer structure from the adjusted cross-polarization features and parallel polarization features respectively includes the following steps:
[0044] Local brightness variation features and local reflection intensity features are extracted by combining parallel polarization features, and these features are used as the first-level features.
[0045] Cluster analysis was performed on local brightness variation features and local reflection intensity features to obtain second-level features;
[0046] Based on the parallel polarization characteristics, global brightness features and global reflection features are extracted as third-level features;
[0047] A hierarchical structure of the first feature is constructed based on the first-level features, the second-level features, and the third-level features;
[0048] By combining the adjusted cross-polarization features, fine-grained texture features and fine-grained edge features are extracted, and these two features are used as the fourth-level features.
[0049] Cluster analysis was performed on fine-grained texture features and fine-grained edge features to obtain local texture features and local edge contour features, which were then used as the fifth level features.
[0050] The sixth-level features are obtained by extracting the overall edge contour features and overall texture features based on the adjusted cross-polarization features;
[0051] The second feature hierarchical structure is constructed by combining the fourth-level features, the fifth-level features, and the sixth-level features.
[0052] In another possible implementation of the first aspect, determining the edge position of the target substrate using a contour connection algorithm based on the edge probability map includes the following steps:
[0053] The edge probability map is converted into an edge binary map, where pixels with a probability value greater than or equal to a preset threshold in the edge binary map are designated as edge points, and pixels with a probability value less than the preset threshold in the edge binary map are designated as non-edge points.
[0054] Traverse the binary edge map and use a contour detection algorithm to determine discrete edge segments in the binary edge map;
[0055] Calculate the length of each discrete edge segment, and take the discrete edge segments whose length exceeds a preset length threshold as valid discrete edge segments;
[0056] Calculate the distance between each effective discrete edge segment, and connect the effective discrete edge segments whose distance is less than a preset distance threshold to determine the initial edge position of the target substrate;
[0057] The edge position of the target substrate is determined by edge fitting based on the preset contour shape of the target substrate to the initial edge position.
[0058] In another possible implementation of the first aspect, the method further includes the following steps:
[0059] The target vertex is determined according to the preset contour shape of the target substrate;
[0060] The coordinates of the target vertex are extracted by combining the edge position of the target substrate and the target vertex.
[0061] Determine the edge location area and edge location shape based on the target vertex coordinates and the edge location of the target substrate;
[0062] The edge position of the target substrate is verified by combining the edge position area, edge position shape, and preset contour shape;
[0063] If the edge area and edge shape verifications pass, the edge position of the target substrate is determined.
[0064] Secondly, this application provides a machine-readable storage medium storing instructions that cause a machine to perform the above-described method for positioning printed paperboard based on visual image segmentation and edge detection.
[0065] Thirdly, this application provides an electronic device, comprising:
[0066] The memory is configured to store instructions; and
[0067] The processor is configured to retrieve the instructions from the memory and, when executing the instructions, to implement the aforementioned method for locating printed paperboard based on visual image segmentation and edge detection.
[0068] The above technical solution utilizes the characteristics of parallel and cross-polarized cameras. Parallel polarized images are susceptible to glare due to surface reflections, while cross-polarized images can suppress some glare but may lose details. By generating a parallel glare mask, glare areas in the parallel image can be accurately identified, and the weights of the cross-polarized features can be adjusted. This effectively combines the advantages of both polarization images, significantly reducing glare interference and improving the reliability of image processing. A dual-channel neural network extracts parallel and cross-polarized features separately. Parallel features retain more surface texture details, while cross-polarized features highlight material differences. Feature fusion integrates the complementary information of the two features, avoiding feature failure issues caused by surface reflections, texture blurring, or lighting changes in a single polarization mode, thus improving adaptability to complex surfaces. The fused feature map is input into a semantic segmentation network, which outputs the probability that each pixel belongs to an edge, enabling more accurate capture of the fine edges and complex contours of printed paperboard. Combined with a contour connection algorithm, discrete high-probability edge points can be connected into continuous closed contours, achieving more precise positioning, reducing mechanical adjustment errors, and thus improving production efficiency.
[0069] Other features and advantages of the embodiments of this application will be described in detail in the following detailed description section. Attached Figure Description
[0070] Figure 1 A flowchart illustrating a printing paperboard positioning method based on visual image segmentation and edge detection provided in this application embodiment;
[0071] Figure 2 This is a schematic diagram of a structure for acquiring parallel polarization images and cross polarization images of a target substrate, provided in an embodiment of this application. Detailed Implementation
[0072] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for illustration and explanation of the embodiments of this application and are not intended to limit the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0073] It should be noted that if the embodiments of this application involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.
[0074] Furthermore, if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0075] Figure 1 The illustration schematically shows a flowchart of a printing paperboard positioning method based on visual image segmentation and edge detection according to an embodiment of this application. Figure 1 As shown in the figure, this application provides a method for locating printed paperboard based on visual image segmentation and edge detection, which may include the following steps.
[0076] S110. When the target substrate reaches the preset position, the parallel polarization image and cross polarization image of the target substrate are acquired by the pre-set parallel polarization camera and cross polarization camera respectively.
[0077] S120. Combine parallel polarization images and cross polarization images, and use a preset dual-channel neural network to determine parallel polarization features and cross polarization features respectively, and determine the parallel glare mask based on the parallel polarization features.
[0078] S130. Based on the parallel glare mask, the cross-polarization features are adjusted by adjusting the feature weights to obtain the adjusted cross-polarization features;
[0079] S140. Combine the adjusted cross-polarization features and parallel polarization features to perform feature fusion to obtain a fused feature map;
[0080] S150. Input the fused feature map into the preset semantic segmentation network model to obtain the edge probability map of the target substrate;
[0081] S160. Determine the edge position of the target substrate using the contour connection algorithm based on the edge probability map.
[0082] Once the target substrate reaches the preset position, parallel polarization and cross polarization images of the target substrate are acquired using a pre-set parallel polarization camera and a cross polarization camera, respectively. The preset position refers to a fixed trigger point pre-set in the production line or testing equipment. When the target substrate moves to this position with the conveyor belt, it triggers subsequent image acquisition. The transmission axis of the polarization filter of the parallel polarization camera is "parallel" to the polarization direction of the incident light; the transmission axis of the polarization filter of the cross polarization camera is "perpendicular" to the polarization direction of the incident light. In this embodiment, an LED surface light source with a linear polarizing film is set above the workstation. At the camera end, a beam splitter is used to split the light path in two, guiding the light to two synchronously triggered cameras. A linear polarizer is placed in front of each of the two cameras, and their polarization directions are perpendicular (orthogonal). In this embodiment, the parallel polarization image can capture polarized light that is consistent with the transmission axis of the filter; the cross polarization image can capture polarized light that is perpendicular to the transmission axis of the filter. In this embodiment, the surface of the target substrate may be a glossy substrate, and its reflected light has strong polarization characteristics, especially glare in the horizontal or vertical direction. Parallel polarized images retain more information about glare from surface reflections, but may also lose detail due to strong reflections. For example, the edge contours of the target substrate may be obscured by glare, making it difficult to accurately identify the substrate's position. In cross-polarized images, because the filter is perpendicular to the polarization direction of the incident light, surface reflection glare is significantly reduced. Since glare is mostly parallel polarized light, it cannot pass through a perpendicular filter. However, it can more clearly retain the scattered light information of the target substrate material itself, allowing for clearer identification of the target substrate's edge contours.
[0083] Figure 2 This is a schematic diagram illustrating a structure for acquiring parallel polarization and cross polarization images of a target substrate, as provided in an embodiment of this application. In a production line, the target substrate is placed at a workstation, with an LED surface light source with a linear polarization film above it. Below the light source is a beam splitter, which divides the optical path in two, connecting to a parallel polarization camera and a cross polarization camera, respectively.
[0084] By combining parallel polarization and cross-polarization images, a pre-designed dual-channel neural network is used to determine parallel polarization features and cross-polarization features respectively. Based on the parallel polarization features, a parallel glare mask is determined. In this embodiment, the pre-designed dual-channel neural network is a pre-designed neural network architecture whose input layer simultaneously receives parallel polarization and cross-polarization images, and sends these two inputs to two parallel processing branches. Each branch independently extracts features corresponding to the polarization image. In this embodiment, the parallel polarization features are parallel glare features and parallel non-glare features, and the cross-polarization features include cross-glare features and cross-non-glare features. The parallel polarization features extract and represent information related to polarization characteristics from the parallel polarization image, reflecting the optical behavior characteristics of the target substrate surface under parallel polarized light illumination, such as reflection and scattering. The cross-polarization features similarly extract information related to polarization characteristics from the cross-polarization image, reflecting the optical characteristics of the target substrate surface under cross-polarized light illumination, thus complementing the parallel polarization features. Cross-glare features are characteristics in cross-polarized images related to glare (strong, interfering reflected light regions generated under parallel polarized light, which are also reflected to some extent in cross-polarized images). They are extracted from cross-polarized images before weight adjustment based on parallel glare masks, reflecting information about the glare region from the cross-polarized viewpoint. Cross-non-glare features are features in cross-polarized images that, excluding cross-glare features, reflect the true characteristics of the target substrate (such as edges, internal structures, defects, etc.). They are the features retained or highlighted after weight adjustment of cross-polarized features based on parallel glare masks. A preset dual-channel neural network extracts brightness and reflection intensity features from parallel polarized images to determine parallel glare and non-glare features. Similarly, a preset dual-channel neural network extracts texture and edge features from cross-polarized images to determine cross-glare and non-glare features. Specifically, parallel and cross-polarized image datasets are first collected, including different scenes and lighting conditions, and the images are labeled to define glare and non-glare regions. A dual-channel network structure is designed, with each channel processing different types of polarized images: a parallel channel and a cross channel. The parallel channel is used to extract brightness and reflection intensity features from the input parallel polarized image; the cross channel is used to extract texture and edge features from the input cross polarized image. Next, convolutional layers are used to extract features. The features from the two channels can be concatenated or fused at a certain layer to combine feature information from the parallel and cross polarized images. The extracted features are then input into a fully connected layer for final classification. An activation function is used to output the classification results, such as the probabilities of glare and non-glare features. Subsequently, a suitable loss function (such as cross-entropy loss) is selected, and an optimization algorithm is used for training to obtain the pre-defined dual-channel neural network, i.e., the trained dual-channel neural network. The trained dual-channel neural network is then used to determine parallel glare features and parallel non-glare features.Parallel glare refers to the phenomenon in parallel polarized images where the surface of the target substrate strongly reflects parallel polarized light at a specific angle. The resulting overly bright areas on the image are called parallel glare features. In parallel polarized images, the pixel brightness values of these overly bright areas (parallel glare feature areas) are significantly higher than the surrounding non-glare areas. For example, assuming the image brightness range is 0-255 (a common grayscale image brightness range), the brightness value of the overly bright area may be greater than Tb (Tb is a threshold derived from statistics of a large number of normal non-glare images; for example, Tb=200, meaning areas with brightness values greater than 200 may belong to the overly bright parallel glare feature area). Parallel non-glare features are those exhibited by areas not affected by strong specular reflection. Cross-glare features are those found in cross-polarized images where most cross-polarized light is absorbed or blocked by the polarizer, but in some special cases, a small amount of light can still pass through and form certain features. Cross-non-glare features refer to the characteristics of darker areas formed in cross-polarized images where most light is blocked and cannot pass through the polarizer. In cross-polarized images, the brightness of darker areas (cross-non-glare feature areas) is significantly lower than surrounding areas that may have glare or other high-brightness areas. Because most light is blocked by the polarizer, only a small amount of light passes through, resulting in low image brightness. For example, in image grayscale representation (assuming a grayscale range of 0-255), the grayscale values of darker areas may be concentrated between 0-80, while the grayscale values of glare or other high-brightness areas (such as abnormal reflection areas under cross-polarization) may be greater than 120. In this embodiment, the parallel glare mask is a binary mask used to mark the glare areas represented by the parallel polarized image, indicating which pixel areas in the parallel polarized image belong to glare. The method for determining a parallel glare mask first utilizes the parallel polarization image branch in a dual-channel neural network to perform initial feature extraction from the parallel polarization image. Then, through several network layers (such as pooling layers to downsample the feature map and highlight key features) and more convolutional layers, the neural network learns unique features that characterize glare. Finally, a binarization layer, such as the sigmoid function, maps the feature values to the 0-1 range. A threshold of 0.5 is then set; pixels with values greater than 0.5 are marked as 1 (glare region), and pixels less than or equal to 0.5 are marked as 0 (non-glare region), generating a parallel glare mask. In the mask, glare regions are marked as 1, and non-glare regions are marked as 0. The generation of the parallel glare mask mainly relies on the parallel polarization features extracted from the parallel polarization image. This is because the parallel polarization image is most sensitive to glare, and its features best characterize the presence and location of glare.
[0085] The adjusted cross-polarization features are obtained by adjusting the feature weights of the cross-polarization features based on a parallel glare mask. This adjustment leverages the information provided by the parallel glare mask about the glare region, which can be used as a reference to adjust the weights of the cross-polarization features. Before adjustment, the cross-polarization features exhibit glare interference, with significant interference affecting feature values in glare areas. After adjustment, the cross-polarization features reduce glare interference, lowering the feature weights corresponding to glare areas and suppressing their feature values (approaching the level of true non-glare features). In cross-polarized images, although most light is blocked, some features still appear. These features may have different importance and manifestations in glare and non-glare areas. By utilizing a parallel glare mask, we can identify which areas in the cross-polarized image are likely affected by glare, and then perform targeted weight adjustments on the cross-polarization features of these areas. For each pixel or region in the cross-polarization features, its weight is adjusted based on the information from the parallel glare mask. If a parallel glare mask is marked as a glare area at a certain location, the weight of the cross-polarization feature at that location may be reduced; conversely, if it is marked as a non-glare area, its weight may be increased.
[0086] A fused feature map is obtained by combining the adjusted cross-polarization features and parallel polarization features. Parallel polarization features include parallel glare features and parallel non-glare features. Parallel glare features reflect the specular reflection characteristics of an object's surface under parallel polarized light, while parallel non-glare features reflect other characteristics such as diffuse reflection. The adjusted cross-polarization features are obtained by adjusting the feature weights of the cross-polarization features based on a parallel glare mask. The weight of the adjusted cross-polarization features in glare regions may be reduced, while the weight in non-glare regions may be retained or increased. The adjusted cross-polarization features and parallel polarization features are then fused. Parallel polarization features may contain details and texture information of the object's surface, while the adjusted cross-polarization features may more accurately reflect the object's shape and structure information. By fusing the two, a fused feature map that includes both detailed texture and shape structure can be obtained. Feature fusion can be achieved using weighted fusion, assigning different weights to the cross-polarization features and parallel polarization features. That is, for each pixel or region, the adjusted cross-polarization features and parallel polarization features can be weighted and summed. The weights can be determined based on the importance of the features or specific application requirements.
[0087] The fused feature map is input into a pre-designed semantic segmentation network model to obtain the edge probability map of the target substrate. This pre-designed semantic segmentation network model is based on a deep learning architecture and is designed to perform semantic segmentation tasks. The fused feature map is the input to the semantic segmentation network model, obtained after processing, feature extraction, weight adjustment, and fusion of parallel polarization and cross-polarization images. The fused feature map contains rich information about the target substrate, which forms the basis for the semantic segmentation network model's edge probability prediction. The semantic segmentation network model first encodes the input fused feature map. The encoding process typically includes multiple convolutional and pooling layers. For example, the first convolutional layer extracts features from the fused feature map, extracting more abstract features, such as the comprehensive features of the substrate that combine parallel polarization and adjusted cross-polarization information, which may include preliminary edge features, features of different material regions, etc. Then, pooling layers are used for downsampling, reducing the feature map size and increasing the number of channels to capture different levels of semantic information. After multiple layers of encoding, the network can extract deep semantic features about the substrate from the fused feature map, such as distinguishing the substrate from the background and different parts of the substrate. During the decoding phase, upsampling is performed through transposed convolution (deconvolution) to gradually restore the feature map size to near the input size. Simultaneously, during decoding, the feature maps from the corresponding layers of the encoding phase (via skip connections) are fused with the decoded feature map. For example, during decoding at a certain layer, the feature map before the last downsampling in the encoding phase (containing rich detail information, such as subtle pixel changes at the substrate edge) is concatenated with the feature map of the current decoding layer (containing high-level semantics, such as the semantics of identifying a substrate edge region). Then, through convolution, the network integrates the detail and semantic information. After multiple layers of decoding, a feature map with a size close to the input fused feature map is finally obtained. The edge probability map is a two-dimensional image with the same size as the input image, where the value of each pixel represents the probability that the pixel belongs to the target substrate edge. Pixel values typically range from 0 to 1; the closer the value is to 1, the greater the probability that the pixel is the target substrate edge, and the closer the value is to 0, the smaller the probability. When the fused feature map is input into the semantic segmentation network model, the model processes and analyzes the feature map through its internal convolutional layers, pooling layers, upsampling layers, and other structures. Utilizing the feature patterns about the target substrate edges learned during training, the model classifies each pixel in the fused feature map. For each pixel, the model outputs a probability value representing the likelihood that the pixel belongs to the target substrate edge; these probability values constitute a two-dimensional edge probability map.
[0088] The edge positions of the target substrate are determined using a contour connection algorithm based on the edge probability map. The contour connection algorithm is used to identify and connect edge pixels in an image to form a complete contour. By analyzing the pixel values in the edge probability map, pixels belonging to the edge of the target substrate are identified, and these pixels are connected into a continuous contour line. Algorithms such as Canny edge detection can be used. The edge probability map is a two-dimensional matrix where each pixel has a probability value between [0,1]. This probability value represents the likelihood that the corresponding pixel belongs to the edge of the target substrate; the closer the probability value is to 1, the higher the probability that the pixel is an edge; the closer it is to 0, the lower the probability. The contour connection algorithm determines the edge position by first thresholding the edge probability map. A threshold is set, which can be based on experience or statistical analysis of a large number of samples, such as threshold = 0.5. The edge probability map is then converted into a binary map B(i,j). When the probability value is greater than or equal to the threshold, the binary map = 1, indicating that the pixel is considered an edge point; when the probability value is less than the threshold, the binary map = 0, indicating that the pixel is not considered an edge point. For example, after thresholding, pixels with a probability value greater than or equal to 0.5 in the edge probability map become white, and the rest become black, initially obtaining a binary image containing discrete edge points. Next, the neighborhood range of each pixel is determined, commonly using four-neighborhood (four adjacent pixels above, below, left, and right) or eight-neighborhood (four adjacent pixels plus four diagonally adjacent pixels). Starting from a pixel with a binary map value of 1 (the starting edge point), its neighboring pixels are checked. If there is a pixel with a binary map value of 1 in the neighboring pixels, then these two pixels are considered to belong to the same edge contour, and they are connected. The neighboring pixels are traversed in a certain order (such as clockwise or counterclockwise), and the connections are continuously extended to obtain the edge position. In this embodiment, the contour connection algorithm is used to process the edge probability map to determine the edge position of the target substrate. The algorithm scans the edge probability map and identifies pixels with a probability value higher than a certain threshold; these pixels are considered candidate points for the edge of the target substrate. Subsequently, the algorithm connects these candidate points according to certain rules to determine the edge position of the target substrate.
[0089] Leveraging the characteristics of parallel and cross-polarized cameras, parallel polarized images are susceptible to glare due to surface reflections, while cross-polarized images can suppress some glare but may lose detail. By generating a parallel glare mask, glare regions in parallel images can be accurately identified, and the weights of cross-polarized features can be adjusted. This effectively combines the advantages of both polarization methods, significantly reducing glare interference and improving the reliability of image processing. A dual-channel neural network extracts parallel and cross-polarized features separately. Parallel features retain more surface texture details, while cross-polarized features highlight material differences. Feature fusion integrates the complementary information of the two features, avoiding feature failure issues caused by surface reflections, texture blurring, or lighting changes in a single polarization mode, thus improving adaptability to complex surfaces. Inputting the fused feature map into a semantic segmentation network outputs the probability that each pixel belongs to an edge, enabling more accurate capture of fine edges and complex contours of printed cardboard. Combined with a contour connection algorithm, discrete high-probability edge points can be connected into continuous closed contours, achieving more precise positioning, reducing mechanical adjustment errors, and ultimately improving production efficiency.
[0090] In one embodiment of this invention, the parallel polarization features and cross polarization features are determined using a preset dual-channel neural network by combining parallel polarization images and cross polarization images, and the parallel glare mask is determined based on the parallel polarization features, including the following steps:
[0091] S210. Extract the brightness and reflection intensity features of the parallel polarization image using the first branch channel of the preset dual-channel neural network;
[0092] S220. Calculate the mean and standard deviation of luminance, as well as the mean and standard deviation of reflection intensity, based on luminance characteristics and reflection intensity characteristics, respectively.
[0093] S230. Set a luminance threshold by combining the mean luminance and the standard deviation of luminance, and set a reflection intensity threshold by combining the mean reflection and the standard deviation of reflection.
[0094] S240. Regions in parallel polarization images whose brightness characteristics exceed the brightness threshold and whose reflection intensity characteristics exceed the reflection intensity threshold are defined as parallel glare regions.
[0095] S250. Determine the parallel glare mask based on the parallel glare area;
[0096] S260. Extract the cross-glare features and cross-non-glare features of the cross-polarized image using the second branch channel of the preset dual-channel neural network;
[0097] In this embodiment, parallel polarization features include parallel glare features and parallel non-glare features, and cross-polarization features include cross-glare features and cross-non-glare features. Parallel glare features refer to the characteristics formed in a parallel polarization image by the strong specular reflection of parallel polarized light by the surface of the target substrate at a specific angle, resulting in overly bright areas. Parallel non-glare features, corresponding to parallel glare features, refer to the characteristics exhibited by areas not affected by strong specular reflection. Cross-glare features are those formed in a cross-polarization image where most cross-polarized light is absorbed or blocked when passing through a polarizer, but in some special cases, a small amount of light can still pass through and form certain features. Cross-non-glare features refer to the characteristics of the darker areas formed in a cross-polarization image where most light is blocked and cannot pass through the polarizer.
[0098] The brightness and reflection intensity features of a parallel polarized image are extracted using the first branch channel of a pre-designed dual-channel neural network. In this embodiment, the first branch channel is specifically responsible for processing parallel polarized images and is part of the overall neural network architecture. It has an independent computational flow, but it is interconnected with the second branch channel and subsequent network layers to jointly complete the task of the entire neural network. Brightness features reflect the brightness variations in different areas of the image and are related to factors such as the surface material of the object and lighting conditions. Reflection intensity features describe the intensity of light reflected from the object's surface, and the reflection intensity is directly related to the object's ability to reflect parallel polarized light. A pre-designed dual-branch neural network is used, where the first branch is dedicated to processing parallel polarized images. The network layers of this branch analyze the input parallel polarized image and ultimately extract the brightness and reflection intensity features. Specifically, the first branch channel may contain multiple convolutional layers. Taking convolutional layers as an example, each convolutional layer scans the parallel polarized image through different convolutional kernels. For brightness feature extraction, the convolution kernel may be sensitive to the gradual changes in brightness in the image, and extract the pattern of such brightness change as part of the brightness feature through convolution operation; for reflection intensity feature extraction, another convolution kernel may be sensitive to the degree of matching between the pixel value in the image and the parallel polarized light reflection model, and extract the features reflecting the reflection intensity through learning and calculation, and then determine the feature representation of brightness feature and reflection intensity feature through the first branch channel.
[0099] Based on luminance and reflectance characteristics, the mean and standard deviation of luminance and reflectance intensity are calculated respectively. The mean luminance is the average luminance value of all pixels in the image, reflecting the overall brightness level. The standard deviation of luminance measures the dispersion of luminance values in the image, i.e., the drastic degree of brightness variation. The mean reflectance intensity is the average reflectance intensity value of all pixels in the image, roughly reflecting the average reflective characteristics of an object's surface. The standard deviation of reflectance intensity indicates the dispersion of reflectance intensity values; a large standard deviation indicates significant differences in the reflectance characteristics of the object's surface, potentially suggesting the existence of regions with different materials or conditions. The standard deviation of reflectance intensity can be calculated using the square root of the average of the squares of the deviations of each pixel's reflectance intensity value from the mean reflectance intensity. Similarly, the standard deviation of luminance can be calculated using the square root of the average of the squares of the deviations of each pixel's luminance value from the mean luminance.
[0100] A brightness threshold can be set by combining the mean and standard deviation of brightness, and a reflection intensity threshold can be set by combining the mean and standard deviation of reflection. This can be achieved by adding or subtracting a preset multiple of the standard deviation from the mean brightness. For example, if the mean brightness is μ and the standard deviation is σ, the brightness threshold can be set to μ+kσ (where k is a constant, usually 1 or 2), which filters out pixels with significantly higher brightness than the average; or it can be set to μ-kσ, which filters out pixels with significantly lower brightness than the average. The value of k can be set according to the actual application scenario and requirements. Similarly, a reflection intensity threshold can be set based on the mean and standard deviation of reflection intensity. For example, the upper and lower limits of reflection intensity can be determined by adding or subtracting a certain multiple of the standard deviation from the mean. If the mean reflection intensity is μr and the standard deviation is σr, the reflection intensity threshold can be set to μr+kσr (for filtering areas with reflection intensity significantly higher than the mean) or μr-kσr (for filtering areas with reflection intensity significantly lower than the mean). The value of k can be set according to the actual application scenario and requirements.
[0101] Regions in a parallel polarized image whose brightness characteristics exceed both a brightness threshold and a reflection intensity threshold are designated as parallel glare regions. In this embodiment, the brightness threshold is a rule-based critical value used to classify the brightness levels in the image. For example, a brightness threshold T = μ + kσ (where k is a constant) indicates that regions above T are considered relatively bright. The reflection intensity threshold is a critical value set by combining the mean and standard deviation of the reflection intensity to measure the intensity of reflection from an object's surface. For example, a reflection intensity threshold TR = μr + kσr indicates that regions above this threshold have relatively high reflection intensity. When a region in a parallel polarized image simultaneously meets both the criteria of "brightness characteristics exceeding the brightness threshold" and "reflection intensity characteristics exceeding the reflection intensity threshold," that region is identified as a parallel glare region. Glare is caused by the strong reflection of parallel polarized light, making the region appear brighter in the image. Furthermore, because it is a strong reflection of light with a specific polarization, its reflection intensity is also high.
[0102] The parallel glare mask is determined based on the parallel glare region. The parallel glare region is identified in a parallel polarized image by its brightness exceeding a brightness threshold and its reflection intensity exceeding a reflection intensity threshold. The parallel glare mask is a mask specifically generated for parallel glare regions, its function being to "mark" these regions from other regions in the parallel polarized image. In the parallel glare mask, the pixel position value corresponding to the parallel glare region is set to 1, and the pixel position value corresponding to the non-parallel glare region is set to 0. For example, assuming the original parallel polarized image is M×N in size, the parallel glare mask is also an M×N matrix, where pixels within the previously identified parallel glare region have a 1 at the corresponding position in the mask matrix, and the rest are 0. For each pixel in the parallel polarized image, the value of the corresponding pixel in the parallel glare mask is set according to whether the pixel belongs to a parallel glare region. If it is a glare region pixel, the mask value is set to 1; otherwise, it is set to 0.
[0103] Cross-glare and cross-non-glare features of cross-polarized images are extracted using the second branch channel of a pre-defined dual-channel neural network. In this embodiment, the second branch channel is a pre-defined channel specifically responsible for processing cross-polarized images, and it is interconnected with the first branch channel and subsequent network layers to jointly complete the task of the entire neural network. Cross-glare features refer to the characteristics of the glare region in the cross-polarized image, which may include pixel value distribution, texture features, edge characteristics, etc. These glare-related features can be extracted from the cross-polarized image through the neural network layer of the second branch channel. Cross-non-glare features are the characteristics of other regions in the cross-polarized image besides the glare region, describing the characteristics of the normal parts of the object, such as the main structure of the object, background environment, etc. These features are also extracted through the neural network processing of the second branch channel.
[0104] In this embodiment, the maximum values of the brightness and reflection intensity characteristics of the parallel glare features in the parallel polarized image under preset conditions refer to the maximum values of the texture and edge characteristics of the cross glare features in the cross polarized image under preset conditions. Specifically, an LED surface light source with a linear polarizing film is set above the workstation. At the camera end, a beam splitter is used to split the light path in two, guiding the light to two synchronously triggered cameras. A linear polarizer is placed in front of each camera, and their polarization directions are precisely perpendicular (orthogonal) to each other. That is, when the above conditions are met, the texture characteristics of the cross glare area are most significant in the cross polarized image, and the edge characteristics of the cross glare area are also most obvious. In the parallel polarized image, the brightness of the parallel glare area is usually the highest, and the reflection intensity of the parallel glare area is also the greatest.
[0105] By determining the parallel polarization characteristics and cross polarization characteristics, and by determining the parallel glare mask based on the parallel polarization characteristics, the parallel glare region can be identified more accurately. This helps to eliminate the interference of glare on the detection results in defect detection tasks and improve the accuracy of defect detection.
[0106] In one embodiment of this invention, extracting the cross-glare features and cross-non-glare features of a cross-polarized image using the second branch channel of a preset dual-channel neural network includes the following steps:
[0107] S310. Extract texture and edge features of the cross-polarized image using the second branch channel of a preset dual-channel neural network;
[0108] S320. Determine the edge gradient magnitude and edge pixel connectivity based on edge features;
[0109] S330. When the edge gradient magnitude is greater than or equal to the preset edge gradient threshold and the edge pixel connectivity is greater than or equal to the preset edge connectivity threshold, determine the cross-non-glare feature.
[0110] S340. When the edge gradient magnitude is less than the preset edge gradient threshold and the edge pixel connectivity is less than the preset edge connectivity threshold, determine the cross glare feature.
[0111] S350. When the edge gradient magnitude is greater than or equal to the preset edge gradient threshold and the edge pixel connectivity is less than the preset edge connectivity threshold, calculate the texture complexity based on the texture features.
[0112] S360. When the texture complexity does not exceed the preset texture feature threshold, the cross-glare feature is determined.
[0113] S370. When the edge gradient magnitude is less than the preset edge gradient threshold and the edge pixel connectivity is greater than or equal to the preset edge connectivity threshold, calculate the average edge gray value based on the edge features.
[0114] S380. When the average gray value of the edge exceeds the preset gray value threshold, the cross glare feature is determined.
[0115] The second branch channel of a pre-defined dual-channel neural network is used to extract texture and edge features from cross-polarized images. In this embodiment, the second branch channel is a pre-set channel specifically responsible for processing cross-polarized images, and it is interconnected with the first branch channel and subsequent network layers to jointly complete the task of the entire neural network. Texture features of the cross-polarized image describe the texture information of different regions in the image, such as roughness, smoothness, regular patterns, or irregular patterns. Through the operations of the neural network layer in the second branch channel, texture features can be extracted from the cross-polarized image. Edge features of the cross-polarized image describe the contours of objects in the image, the boundaries between different regions, and other information. Through neural network processing, the second branch channel can extract edge features from the cross-polarized image.
[0116] Subsequently, edge gradient magnitude and edge pixel connectivity are determined based on edge features. Edge gradient magnitude represents the rate of change of image brightness at the edge. A larger gradient magnitude indicates a more drastic change in brightness at the edge, making the edge more pronounced. Edge gradient magnitude can be determined by calculating the gradient of each pixel in the image. Gradients can be calculated using gradient operators, such as the Sobel operator. Edge gradient magnitude helps distinguish between strong and weak edges. Strong edges correspond to important boundaries or contours in the image. Edge pixel connectivity reflects the degree to which edges form a coherent contour in the image. Edge pixel connectivity can be determined by analyzing the spatial relationships between edge pixels. For example, morphological operations, connected component analysis, or contour tracking algorithms can be used to identify and quantify the connectivity of edge pixels. Edge pixel connectivity helps identify complete edge contours and shapes. Edge pixels with high connectivity are more likely to belong to the boundaries or contours of the same object.
[0117] When the edge gradient magnitude is greater than or equal to a preset edge gradient threshold and the edge pixel connectivity is greater than or equal to a preset edge connectivity threshold, a cross-cutting non-glare feature is determined. The preset edge gradient threshold is a pre-set benchmark value used to distinguish the strength of edges; the preset edge connectivity threshold is a pre-set benchmark value used to determine whether edge pixels have sufficient continuity and connectivity, and can be determined based on experience or statistical data. In other words, when the edge gradient magnitude is greater than or equal to the preset edge gradient threshold and the edge pixel connectivity is greater than or equal to the preset edge connectivity threshold, the edge features of that region are considered to meet the requirements of a cross-cutting non-glare feature. Regions that meet these conditions are identified as cross-cutting non-glare feature regions.
[0118] Cross-glare characteristics are determined when both the edge gradient magnitude and edge pixel connectivity are less than a preset edge gradient threshold. In other words, if a region in a cross-polarized image simultaneously meets both conditions ("edge gradient magnitude less than the preset edge gradient threshold" and "edge pixel connectivity less than the preset edge connectivity threshold"), then that region is considered to have cross-glare characteristics. Glare regions are often not formed due to a significant grayscale difference between the object and the background, but rather due to complex phenomena such as light scattering and reflection. This can lead to relatively gentle grayscale changes at the edges of glare regions, resulting in edge gradient magnitudes that are less than the gradient magnitudes of normal object edges (i.e., less than the preset threshold). The edges of glare regions are typically irregular and discontinuous. This may be due to the irregular shape of defects such as oil stains or scratches, causing the edge pixels of glare regions to not be continuously connected like the edges of normal objects in the cross-polarized image, thus resulting in edge pixel connectivity less than the preset threshold.
[0119] Texture complexity is calculated based on texture features when the edge gradient magnitude is greater than or equal to a preset edge gradient threshold and the edge pixel connectivity is less than a preset edge connectivity threshold. In other words, texture complexity calculation is triggered when a region in the image simultaneously meets both conditions: "edge gradient magnitude greater than or equal to a preset edge gradient threshold" (indicating a certain degree of grayscale variation in the region, possibly an object edge or other region with grayscale variation) and "edge pixel connectivity less than a preset edge connectivity threshold" (indicating discontinuous or loose edges in the region). Texture features describe the texture information of different regions in an image, such as roughness, smoothness, regular patterns, or irregular patterns. Calculating texture complexity based on texture features is a quantitative description of image texture features, used to measure the complexity of the texture. This can be implemented based on the gray-level co-occurrence matrix (GLCM), which describes the co-occurrence relationship of pixel grayscale values in an image at specific directions and distances. Texture complexity can be measured by calculating some statistics of the GLCM (such as entropy, contrast, energy, correlation, etc.).
[0120] When the texture complexity does not exceed the preset texture feature threshold, a cross-glare feature is determined. The preset texture feature threshold is a pre-defined critical value used to judge the level of texture complexity. If the surrounding texture complexity (such as the entropy based on the gray-level co-occurrence matrix) is lower than the texture feature threshold, it is judged as a cross-glare feature (which may be a high gradient amplitude but discontinuous edge in the glare area caused by some reason, such as an edge caused by local strong reflection, but the overall texture is simple); otherwise, it is judged as a suspected special edge (such as a damaged edge on cardboard, which can be further confirmed by more contextual information or other features).
[0121] When the edge gradient magnitude is less than a preset edge gradient threshold and the edge pixel connectivity is greater than or equal to a preset edge connectivity threshold, the average edge grayscale value is calculated based on the edge features. In other words, when a region in the image simultaneously meets both conditions—"edge gradient magnitude less than the preset edge gradient threshold" (indicating that the grayscale change in this region is relatively gradual and unlikely to be a sharp boundary of an object) and "edge pixel connectivity greater than or equal to the preset edge connectivity threshold" (indicating that the edges in this region have a certain degree of continuity)—the subsequent calculation of the average edge grayscale value is triggered. Calculating the average edge grayscale value based on edge features involves extracting the edge features (assuming they are in grayscale image form, with edge pixels having corresponding grayscale values), and then calculating the average grayscale value of these edge pixels.
[0122] When the average grayscale value of the edge exceeds a preset grayscale threshold, a cross-glare feature is identified. In this embodiment, the preset grayscale threshold can be determined according to the actual situation. After obtaining the average grayscale value, if the average grayscale value is higher than the average grayscale threshold, it is judged as a cross-glare feature (a continuous edge with a high average grayscale value and a low gradient amplitude, which may be a large area of continuous reflection edge in the glare region). Otherwise, it is judged as a non-glare region feature (such as a low-contrast but continuous internal texture edge of the cardboard, which can be further confirmed by combining other features such as texture direction).
[0123] By identifying the cross-glare and cross-non-glare features of cross-polarized images, it is possible to accurately distinguish between them, reduce false positives and false negatives, improve the accuracy of defect detection, and enhance the effectiveness of quality control.
[0124] In one embodiment of this invention, adjusting the feature weights of the cross-polarization features based on the parallel glare mask to obtain the adjusted cross-polarization features includes the following steps:
[0125] S410. Spatial position matching of parallel glare masks and cross-polarization features determines the spatial correspondence between each parallel glare mask and cross-polarization feature.
[0126] S420. Determine the pixel value of the parallel glare mask corresponding to the cross-polarization feature based on the spatial correspondence.
[0127] S430. Determine the cross-polarization characteristic value based on the cross-polarization characteristics;
[0128] S440. Calculate the adjustment weight based on the pixel value of the parallel glare mask and the preset weight factor;
[0129] S450. Calculate the product between the adjustment weight and the cross-polarization eigenvalue to obtain the adjusted cross-polarization eigenvalue.
[0130] Spatial location matching between parallel glare masks and cross-polarization features determines the spatial correspondence between each parallel glare mask and a cross-polarization feature. The parallel glare mask is a binary matrix of the same size as the parallel polarization image, marking glare and non-glare regions in the image. During spatial location matching, the parallel glare mask and the cross-polarization feature map are aligned so that they are in the same spatial coordinate system. This spatial location matching determines the corresponding positions of the marked glare regions in the parallel glare mask within the cross-polarization feature map, helping to understand the characteristic behavior of glare regions in the cross-polarization image.
[0131] The pixel values of the parallel glare mask corresponding to the cross-polarization feature are determined based on spatial correspondence. After spatial position matching, each pixel or feature point in the parallel glare mask and the cross-polarization feature map corresponds one-to-one in spatial location. That is, each pixel in the cross-polarization feature map can find its corresponding position in the parallel glare mask. For each pixel or feature point in the cross-polarization feature map, the pixel value at that position is obtained based on its corresponding position in the parallel glare mask. This pixel value may be 0 or 1, where 1 indicates that the position is a glare area in the parallel polarization image, and 0 indicates a non-glare area.
[0132] Cross-polarization feature values are determined based on cross-polarization characteristics, which include texture features and edge features. Specifically, the cross-polarization feature values are determined based on these texture and edge features. Texture features can be determined using the gray-level resonance matrix, and edge detection algorithms are applied to identify edges in the image and extract edge features. Texture features include texture statistics such as contrast and entropy, while edge feature quantization includes the mean of edge gradient magnitude and edge pixel connectivity. The edge and texture features can be quantized, and the extracted texture and edge features can be combined into a feature vector. Statistical values (such as mean and standard deviation) for each feature are calculated according to specific requirements as the final cross-polarization feature values.
[0133] The adjusted weight is calculated based on the pixel values of the parallel glare mask and a preset weighting factor. In other words, the adjusted cross-polarization feature value is equal to the original cross-polarization feature value multiplied by a dynamic weighting factor. This weighting factor is determined by both the parallel glare mask value and the weighting parameter. The specific form of the adjusted weight is shown below:
[0134]
[0135] Where M represents the adjustment weight, and m(i,j) represents the binary identifier of the parallel glare mask at position (i,j) (with a value of 0 or 1), which is used to mark whether the pixel is affected by parallel glare (1 indicates that it is affected, and 0 indicates that it is not affected). The preset weighting factor (with a value range of 0 < α < 1) is used to control the intensity of feature value adjustment. The larger the value, the greater the adjustment range. The specific value can be determined according to the actual situation.
[0136] Using the mask value m(i,j) and weight factors The product of these factors dynamically adjusts the retention ratio of the original feature values.
[0137] Subsequently, the adjusted cross-polarization feature is obtained by multiplying the adjusted weights by the cross-polarization feature value. In other words, the adjusted cross-polarization feature value is obtained by multiplying the cross-polarization feature value by the adjusted weights. For pixels in glare areas, their cross-polarization feature value is multiplied by a smaller weighting factor, thus reducing its influence in subsequent analysis. For pixels in non-glare areas, their cross-polarization feature value is multiplied by 1.0, keeping its original value unchanged. The specific form of the adjusted cross-polarization feature is shown below:
[0138]
[0139] in, This indicates the adjusted cross-polarization characteristics; Indicates the cross-polarization eigenvalue; Indicates a parallel glare mask; The preset weighting factors, The value can be determined based on statistical analysis. A large number of cross-polarized image samples containing glare regions are collected, and the distribution of eigenvalues of the glare regions in the cross-polarized images is analyzed (assuming that the cross-polarization eigenvalues can be represented by a certain statistical quantity, such as the average eigenvalue μ). g eigenvalue variance σ g 2 The eigenvalue distribution (mean eigenvalue μ) of normal non-glare regions (especially edge regions) and the eigenvalue distribution of normal non-glare regions. ng eigenvalue variance σ ng 2An optimization objective can be defined based on actual needs, such as adjusting the distribution of glare region eigenvalues (α×μ). g The adjusted variance (and its adjusted variance) should be as close as possible to the characteristic value distribution of the normal non-glare region, while ensuring that the adjusted characteristic values are not excessively distorted. This is achieved through mathematical calculations (such as minimizing |α×μ) g -μ ng |+|α 2 ×σ g 2 -σ ng 2 |) to find the optimal value of α.
[0140] When pixels are affected by glare ( When α = 1, the weight is calculated as 1 - 1 × (1 - α) = α, meaning the adjusted feature value is F(i,j) × α. This indicates that for pixels affected by parallel glare, their feature values are suppressed according to the weight α (α < 1), thus reducing glare interference.
[0141] When the pixel is not affected by glare ( When α = 0, the weight is calculated as 1 - 0 × (1 - α) = 1, meaning the adjusted feature value remains F(i,j) × 1 = F(i,j). This indicates that for pixels not affected by glare, their feature values are fully preserved (weight 1), avoiding the loss of effective information.
[0142] By combining parallel glare masks and cross-polarization features, information from images with different polarizations is fully utilized, providing more comprehensive feature support for subsequent image analysis. The adjusted cross-polarization features integrate multi-dimensional information such as spatial location, feature values, and weights, enabling a more comprehensive description of objects and scenes in the image.
[0143] In one embodiment of this invention, the process of combining the adjusted cross-polarization features and parallel polarization features to obtain a fused feature map includes the following steps:
[0144] S510. Construct a first feature layer structure and a second feature layer structure from the adjusted cross-polarization features and parallel polarization features, respectively.
[0145] S520. Calculate the weight value of each feature in the first feature hierarchical structure and the weight value of each feature in the second feature hierarchical structure.
[0146] S530. Construct an overall weight map by combining the weight values in the first feature hierarchical structure and the weight values in the second feature hierarchical structure;
[0147] S540. Based on the overall weight map, the first feature hierarchical structure and the second feature hierarchical structure, the features at the same level are spliced together according to the corresponding level to obtain the fused features.
[0148] S550. Construct a Laplace pyramid based on the fused features to obtain the fused feature map.
[0149] The adjusted cross-polarization and parallel polarization features are used to construct a first feature hierarchy and a second feature hierarchy, respectively. The first feature hierarchy contains adjusted cross-polarization features at different levels, from fine to coarse. Lower layers provide fine details of the image, suitable for detecting small-scale features; higher layers provide large-scale structural information. The second feature hierarchy performs the same multi-scale decomposition and organization on the parallel polarization features, providing representations of parallel polarization features at different scales, which helps to understand the structure and details of the image from different perspectives. Methods such as Gaussian pyramids and Laplacian pyramids can be used to downsample the feature maps multiple times, generating feature map sequences of different resolutions. Each feature map layer represents information from the original feature map at a specific scale.
[0150] The weight values of each feature in the first feature layer structure and the second feature layer structure are calculated. In this embodiment, the weight value of each feature in the first feature layer structure refers to the weight value of each feature in the adjusted cross-polarization feature, which includes texture features and edge features. The weight value of each feature in the second feature layer structure refers to the weight value of each feature in the parallel polarization feature, which includes brightness features and reflection intensity features. Specifically, the weight values can be calculated based on the saliency of the texture features (such as texture complexity, uniformity, etc.). Regions with high texture feature saliency have larger weight values. Secondly, the weight values can be calculated based on the saliency of the edge features (such as edge gradient magnitude, connectivity, etc.). Regions with high edge feature saliency have larger weight values. The parallel polarization features include brightness features and reflection intensity features. For each feature (brightness feature and reflection intensity feature) in the second feature layer structure, its weight value is calculated based on the saliency of the brightness feature (such as brightness contrast, uniformity, etc.). Regions with high saliency of brightness features receive larger weights; weights are calculated based on the saliency of reflectance intensity features (such as contrast and uniformity of reflectance intensity). Regions with high saliency of reflectance intensity features receive larger weights. Weights are determined by analyzing the saliency of each feature in the image. Features with high saliency are generally more important for image analysis tasks and therefore receive larger weights.
[0151] A total weight map is constructed by combining the weight values in the first feature hierarchical structure and the weight values in the second feature hierarchical structure. After the weight values in the first feature hierarchical structure and the weight values in the second feature hierarchical structure, the weight values in each feature hierarchical structure are summed in a weighted manner.
[0152]
[0153] Among them, W 总体 This is the overall weighting diagram, W 纹理 W 边缘 W 亮度 and W 反射强度 These are the weight values for texture features, edge features, brightness features, and reflection intensity features, respectively. β, γ, and δ are weighting coefficients used to adjust the importance of each feature. In this embodiment... β, γ, and δ can be determined based on the specific circumstances. Among them, W... 纹理 W 边缘 W 亮度 and W 反射强度 The corresponding weight value can be calculated based on its saliency. Taking edge features as an example, based on machine learning saliency calculation, a large amount of image data is labeled to mark edges with different saliencies and blurred internal texture edges in the image. For edge features, edge feature maps can be extracted first using operators such as the Canny operator. Next, multiple attributes of the edge features are extracted as feature vectors. For example, for each edge pixel, its edge strength (such as the edge strength value output by the Canny operator), edge direction (obtained through gradient calculation), and the length of the edge segment are calculated. A random forest classifier is trained using labeled training data (containing feature vectors of highly salient and low-salience edges). During training, the classifier learns the mapping relationship between different feature vectors and edge saliency. For a new image edge feature map, the feature vector of each edge pixel (or segment) is extracted, input into the trained random forest classifier, and the saliency probability of each edge is obtained; the weight value W of the edge feature is calculated. 边缘 This can be achieved by averaging the saliency probabilities of edge features across the entire image.
[0154] Based on the overall weight map, the first feature layer structure, and the second feature layer structure, features at the same level are concatenated according to their corresponding levels to obtain the fused features. Each level in the feature layer structure represents features at different scales. For example, the first layer might be a feature map at the original resolution, the second layer might be a downsampled feature map, and so on. At each corresponding level, the feature maps from the first and second feature layer structures are concatenated. Concatenation can be weighted fusion. Subsequently, during the concatenation process, the weight of each feature is adjusted using the overall weight map. Features with higher weight values occupy a larger proportion in the fused feature map. The fusion strategy can include weighted summation. First, ensure that the first and second feature layer structures are spatially aligned. Obtain the weight values from the overall weight map. For each level, extract the feature maps from the first and second feature layer structures. Based on the weight values in the overall weight map, weight the feature maps and concatenate the weighted feature maps. Use the concatenated feature map as the fused features.
[0155] A Laplacian pyramid is constructed based on the fused features to obtain a fused feature map. First, the fused feature map is decomposed into a Gaussian pyramid, generating a series of images at different resolutions. Through downsampling and Gaussian filtering, the image resolution is progressively reduced, resulting in a multi-level Gaussian pyramid. Starting from the highest resolution layer of the Gaussian pyramid, each layer is compared with its downsampled version, and the difference is calculated. These differences are used as each layer of the Laplacian pyramid, resulting in a multi-level pyramid containing detailed information at different scales. The layers of the Laplacian pyramid are upsampled and combined layer by layer to finally obtain the fused feature map. This fused feature map preserves the details of the original image while incorporating feature information from different scales.
[0156] By combining the adjusted cross-polarization features and parallel polarization features to obtain a fused feature map, image quality can be improved, noise interference can be reduced, targets and edges can be located more accurately, detection accuracy and segmentation accuracy can be improved.
[0157] In one embodiment of this invention, constructing a first feature layer structure and a second feature layer structure from the adjusted cross-polarization features and parallel polarization features respectively includes the following steps:
[0158] S610. Combine parallel polarization features to extract local brightness variation features and local reflection intensity features, and use local brightness variation features and local reflection intensity features as first-level features;
[0159] S620. Cluster analysis is performed on the local brightness variation characteristics and local reflection intensity characteristics to obtain the second-level features;
[0160] S630. Extract global brightness features and global reflection features based on parallel polarization features as third-level features;
[0161] S640. Construct a hierarchical structure of the first feature based on the first-level features, the second-level features, and the third-level features;
[0162] S650: Combine the adjusted cross-polarization features to extract fine-grained texture features and fine-grained edge features, and use the fine-grained texture features and fine-grained edge features as the fourth-level features;
[0163] S660. Cluster analysis is performed on the fine-grained texture features and the fine-grained edge features to obtain local texture features and local edge contour features, and these features are used as the fifth level features.
[0164] S670. Extract the overall edge contour features and overall texture features based on the adjusted cross-polarization features to obtain the sixth-level features;
[0165] S680. Construct a second feature hierarchical structure by combining the fourth-level features, the fifth-level features, and the sixth-level features.
[0166] This study combines parallel polarization features to extract local brightness variation features and local reflection intensity features, using these as first-level features. Local brightness variation features refer to the changes in brightness within a local area of the image; local reflection intensity variation features refer to the changes in reflection intensity within a local area of the image. First-level features are the most basic features in the feature hierarchy. These features reflect the most fundamental visual information of the image. Extraction of these features can be achieved using the Sobel operator, convolution operations, or local statistical analysis.
[0167] Cluster analysis is performed on local brightness variation features and local reflectance intensity features to obtain second-level features. Cluster analysis divides data objects into several subsets that are highly homogeneous internally and significantly heterogeneous externally by measuring the similarity or distance between samples, minimizing intra-cluster differences and maximizing inter-cluster differences. First-level features describe the local features of each small region in the image; for example, region A has rapid brightness changes and high reflectance intensity, while region B has slow brightness changes and low reflectance intensity. The similarity between different local regions is calculated. The closer the brightness variation patterns and the more similar the reflectance intensity characteristics of two regions, the more similar they are considered, and they are clustered into second-level features. After clustering, the second-level features are no longer scattered features of individual local regions, but rather a holistic description of the "cluster," a summary of the first-level features. In this embodiment, the features obtained after quantifying local brightness variation features and local reflectance intensity features through cluster analysis are described.
[0168] Based on the parallel polarization characteristics, global brightness and global reflection features are extracted as the third-level features. In this embodiment, the global brightness feature considers the overall brightness attribute from the perspective of the entire image or scene, and may include statistics such as average brightness, brightness variance, and the shape of the brightness histogram. The global reflection feature is a general description of the reflection characteristics of the object surface, and may include average reflectivity, reflectivity distribution range, and the reflection ratio of different wavelengths of light. The third-level features are global brightness and global reflectivity statistics extracted from the parallel polarization image. They describe the brightness and reflection characteristics under parallel polarized light from a global perspective and are the highest-level, most generalized, and abstract features, reflecting the overall macroscopic characteristics. The extraction of the third-level features can be achieved using a pre-trained machine learning model.
[0169] A hierarchical structure for first-level features is constructed based on first-level, second-level, and third-level features. This structure organizes the first, second, and third-level features according to their hierarchical relationship, forming a pyramid structure. First-level features are at the bottom, the most numerous, and form the foundation; second-level features are in the middle layer, representing initial integration and abstraction of the bottom-level features; and third-level features are at the top, representing the most refined and generalized features. For example, the bottom layer stores individual first-level features, such as local brightness variations and local reflectance values for each local region; the middle layer stores clustered second-level features, such as the statistical information of each cluster category and its included first-level feature indices or feature values; and the top layer stores third-level features, such as global average brightness and global reflectance.
[0170] Fine-grained texture features and fine-grained edge features are extracted by combining adjusted cross-polarization features, and these features are used as the fourth-level features. In this embodiment, fine-grained texture features refer to the arrangement pattern and variation law of texture features within a local region; fine-grained edge features refer to the feature set that describes the fine, microscopic characteristics of edges in an object or image based on the adjusted cross-polarization features. In this embodiment, the fourth-level features refer to the fine-grained texture features and fine-grained edge features extracted by combining the adjusted cross-polarization features. Local binary patterns and edge detection algorithms, such as the Sobel operator, can be used to extract these fine-grained texture features and fine-grained edge features.
[0171] Cluster analysis is performed on fine-grained texture features and fine-grained edge features to obtain local texture features and local edge contour features. These local texture features and local edge contour features are used as the fifth-level features. In this embodiment, the fifth-level features refer to features obtained by further integrating the local texture features and local edge contour features based on the fourth-level features through cluster analysis. Local texture features are more generalized features obtained after cluster analysis based on fine-grained texture features. They are no longer descriptions of individual minute texture details, but rather comprehensive descriptions of local regions with similar fine-grained texture features. Local edge contour features are generalized features about local edges obtained through cluster analysis based on fine-grained edge features. They are not all the subtle features of a specific edge, but rather comprehensive descriptions of local edge segments with similar fine-grained edge features. For fine-grained texture features and fine-grained edge features, a clustering algorithm is used to calculate the similarity between each fine-grained texture feature sample and these cluster centers, and between each fine-grained edge feature and the cluster centers. The samples are then assigned to the cluster containing the nearest cluster center. Next, the cluster centers are updated, which can be done by calculating the mean of samples within a cluster. This process is repeated until the cluster centers no longer change significantly. Subsequently, the fine-grained texture features are aggregated into K local texture features, each representing a local region with similar fine-grained texture features.
[0172] The sixth-level features are obtained by extracting the overall edge contour features and overall texture features based on the adjusted cross-polarization features. The overall edge contour features describe the macroscopic shape and characteristics of the entire edge of an object, focusing not on microscopic details but on the overall shape, direction, and closure of the edge. The overall texture features summarize the global attributes and patterns of the object's surface texture, not limited to local texture details or local texture clustering. In this embodiment, the sixth-level features provide a macroscopic, global description of the object's edges and texture. Extracting the overall edge contour features and overall texture features can be achieved using methods such as the Canny operator and calculating the global features of the gray-level co-occurrence matrix.
[0173] A second feature hierarchy is constructed by combining fourth-level, fifth-level, and sixth-level features. This hierarchy organizes the features according to their hierarchical relationship (fourth level → fifth level → sixth level), forming a pyramid-like structure. The bottom layer consists of fourth-level features, which are the most numerous and fundamental, containing a wealth of information about texture and edge micro-details. The middle layer consists of fifth-level features, which are fewer in number and represent the clustering and integration of the bottom-level features, reflecting local patterns. The top layer consists of sixth-level features, which are the fewest in number and provide a high-level generalization of the overall characteristics. The bottom layer stores specific fine-grained texture and edge feature values; the middle layer stores clustered local texture features and local edge contour features; and the top layer stores overall edge contour feature values and overall texture feature values.
[0174] By constructing a first feature hierarchical structure and a second feature hierarchical structure, the detection capability for complex surfaces can be improved, and the stability under complex lighting conditions can be enhanced, thereby improving the performance of the model in texture and edge-related tasks (such as edge detection, texture classification, segmentation, etc.).
[0175] In one embodiment of this invention, determining the edge position of the target substrate using a contour connection algorithm based on the edge probability map includes the following steps:
[0176] S710. Convert the edge probability map into an edge binary map, wherein pixels with a probability value greater than or equal to a preset threshold in the edge binary map are designated as edge points, and pixels with a probability value less than the preset threshold in the edge binary map are designated as non-edge points.
[0177] S720. Traverse the binary edge map and use the contour detection algorithm to determine the discrete edge segments in the binary edge map;
[0178] S730. Calculate the length of each discrete edge segment, and take the discrete edge segments whose length exceeds the preset length threshold as valid discrete edge segments.
[0179] S740. Calculate the distance between each effective discrete edge segment, and connect the effective discrete edge segments whose distance is less than a preset distance threshold to determine the initial edge position of the target substrate.
[0180] S750: Determine the edge position of the target substrate by edge fitting the initial edge position based on the preset contour shape of the target substrate.
[0181] The edge probability map is converted into an edge binary map. Pixels with a probability value greater than or equal to a preset threshold in the edge binary map are designated as edge points, while pixels with a probability value less than the preset threshold are designated as non-edge points. The edge probability map is a two-dimensional image with the same size as the input image, where the value of each pixel represents the probability that the pixel belongs to the edge of the target substrate. A threshold can be selected as the criterion for distinguishing edge points from non-edge points, or it can be dynamically adjusted according to the specific characteristics of the image and the application scenario. Each pixel in the edge probability map is examined one by one. If the probability value of a pixel is greater than or equal to the preset threshold, its corresponding pixel in the edge binary map is marked as an edge point. If the probability value of a pixel is less than the preset threshold, its corresponding pixel in the edge binary map is marked as a non-edge point.
[0182] Subsequently, the edge binary image is traversed, and a contour detection algorithm is used to determine discrete edge segments. In the edge binary image, edge points may form continuous edge lines or discontinuous edge fragments; these discontinuous edge fragments are discrete edge segments. The contour detection algorithm is an algorithm used to identify the contours of objects in an image. It can identify connected edge points in an image based on chain code algorithms and organize them into contour lines or edge segments. Each pixel in the edge binary image is examined one by one to determine if it is an edge point. For each edge point, its surrounding pixels are checked to determine if they are also edge points, thus determining the connectivity between edge points. The contour detection algorithm is used to track connected edge points, forming an edge segment. Then, the image is traversed again to find other unvisited edge points, and the above process is repeated until all edge points have been processed.
[0183] The length of each discrete edge segment is calculated, and discrete edge segments whose length exceeds a preset length threshold are considered valid discrete edge segments. The preset length threshold can be determined based on the actual situation. In an image, after edge detection, discontinuous and discrete edge pixels are obtained. These discrete edge pixels may connect to form line segments, which are discrete edge segments. The length of discrete edge segments can be calculated based on pixel count statistics or geometric distance. For each discrete edge segment, its length is calculated one by one according to the above method. The calculated length of each discrete edge segment is compared with the preset length threshold. If the length of a discrete edge segment exceeds the preset length threshold, it is marked as a valid discrete edge segment.
[0184] The distance between each valid discrete edge segment is calculated, and valid discrete edge segments with a distance less than a preset distance threshold are connected to determine the initial edge position of the target substrate. The preset distance threshold can be determined according to specific application scenarios and requirements. For each pair of valid discrete edge segments in the image, the distance between them is calculated. This distance can be realized as the Euclidean distance between the two nearest points between the edge segments. When the distance between two valid discrete edge segments is less than the preset distance threshold, they are considered to belong to the same edge and can be connected. By connecting the valid discrete edge segments with closer distances, one or more continuous edges are formed. In this embodiment, the initial edge position is the approximate position of the target substrate edge determined by the edge processing and analysis process.
[0185] The edge position of the target substrate is determined by edge fitting based on a preset contour shape. This preset contour shape is defined according to the expected shape of the target substrate (e.g., rectangle, circle). Using methods such as least squares and Hough transform, the initial edge position is matched with the preset contour shape to make the model as close to the initial edge position as possible. The fit degrees of different preset contour shapes to the initial edge position are compared, and the contour with the highest fit is selected as the edge position of the target substrate. Based on the fitting results, the precise edge position of the target substrate is obtained, providing a high-precision foundation for subsequent measurement and positioning tasks.
[0186] By determining the edge position of the target substrate, the accuracy of the target substrate edge position determination can be effectively improved, thereby enhancing the efficiency and effectiveness of subsequent processing and providing a solid foundation for subsequent tasks such as target substrate identification, measurement, and positioning.
[0187] In one embodiment of this invention, the method further includes the following steps:
[0188] S810. Determine the target vertex according to the preset contour shape of the target substrate;
[0189] S820: Extract the target vertex coordinates by combining the edge position of the target substrate and the target vertex.
[0190] S830. Determine the edge location area and edge location shape based on the target vertex coordinates and the edge location of the target substrate;
[0191] S840: Verify the edge position of the target substrate by combining the edge position area, edge position shape, and preset contour shape;
[0192] S850. If the edge location area and edge location shape verification pass, then determine the edge location of the target substrate.
[0193] The target vertices are determined based on the preset contour shape of the target substrate. The preset contour shape refers to the standard contour shape of the target substrate, such as a rectangle, circle, or triangle, which can be set according to design specifications. Target vertices are the positions of key corners or endpoints of the target substrate in an image or space; they are key feature points of the target substrate contour, used to locate and describe the orientation, shape, and position of the target substrate. Using a matching algorithm (such as template matching or geometric fitting), the preset contour shape is compared with edges or other features in the image to identify the best-matching target region. After determining the matching target region, the vertex positions of the target region are calculated and extracted based on the geometric characteristics of the preset contour shape. For example, a rectangle can be obtained by extracting its four corner points; a circle by determining its center and radius; and a triangle by extracting its three vertices.
[0194] By combining the edge position and target vertex coordinates of the target substrate, the precise edge position of the target substrate is obtained through edge detection and fitting methods. Based on the preset contour shape of the target substrate, key vertices are identified at the edge positions. A reference coordinate system is determined, which can be an image coordinate system or a world coordinate system. Geometric methods or coordinate transformations are used to calculate the coordinate value of each vertex in the coordinate system. Target vertex coordinates refer to the specific position of each vertex of the target substrate in the image or spatial coordinate system, usually represented by two-dimensional or three-dimensional coordinates.
[0195] The edge location area and edge location shape are determined based on the target vertex coordinates and the edge position of the target substrate. The edge location area refers to the area enclosed by the edge of the target substrate. If the edge of the target substrate is a simple geometric shape (such as a rectangle or triangle), the area can be calculated using geometric formulas based on the target vertex coordinates. If the edge shape is complex, the edge location can be approximated as a polygon, and then the polygon area calculation formula can be used, or image processing techniques (such as pixel counting) can be used to estimate the area. The edge location shape refers to the geometric shape characteristics of the target substrate edge. Based on the vertex coordinates and edge position, the shape can be determined by analyzing the arrangement of vertices and the direction of the edge. For example, the curvature and direction changes of the edge can be calculated using the vertex coordinates. The extracted edge location is then matched with a preset standard shape to determine its shape type (such as rectangle, circle, etc.).
[0196] The edge position of the target substrate is verified by combining the edge position area, edge position shape, and preset contour shape. This involves comparing the calculated edge position area with the theoretical area of the target substrate (based on the preset contour shape). The edge position area refers to the size of the region enclosed by the edge of the target substrate; the edge position shape describes the geometric features of the target substrate edge; and the preset contour shape is a pre-defined standard contour shape expected of the target substrate. The calculated edge position area is compared with a preset area range. If the area is within the preset range, the edge position is likely reasonable from an area perspective; if the area deviation is large, it indicates a possible error in the edge position. Matching or similarity calculations are performed using the edge position shape descriptor and the preset contour shape descriptor. For example, the Euclidean distance between the Fourier descriptor of the edge position shape and the Fourier descriptor of the preset contour shape is calculated, or the difference in invariant moments is calculated. If the similarity is higher than a preset threshold, the shape match is good; if the similarity is low, the edge shape does not match the preset shape.
[0197] If the edge location area and edge location shape verifications pass, the edge location of the target substrate is determined. The actual measured edge location area is compared with the theoretical area to see if it is within the allowable error range. Shape matching algorithms can be used to compare the similarity between the actual edge shape and the preset shape to see if they meet the requirements. If both verifications pass, the edge location of the target substrate is determined to be accurate and used as the final edge location for subsequent operations.
[0198] By verifying the area and shape of the edge positions, the accuracy of the target substrate edge positions is ensured, improving the reliability of the entire inspection process and increasing work efficiency and precision.
[0199] This application also provides a machine-readable storage medium storing instructions for causing a machine to perform the above-described method for locating printed paperboard based on visual image segmentation and edge detection.
[0200] This application also provides an electronic device, including:
[0201] The memory is configured to store instructions; and
[0202] The processor is configured to retrieve instructions from memory and, when executing the instructions, to implement the aforementioned method for locating printed paperboard based on visual image segmentation and edge detection.
[0203] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0204] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0205] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0206] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0207] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0208] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0209] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0210] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0211] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for locating printed paperboard based on visual image segmentation and edge detection, characterized in that, include: Once the target substrate reaches the preset position, parallel polarization images and cross polarization images of the target substrate are acquired using a pre-set parallel polarization camera and a cross polarization camera, respectively. By combining parallel polarization images and cross polarization images, a pre-defined dual-channel neural network is used to determine the parallel polarization features and cross polarization features respectively, and a parallel glare mask is determined based on the parallel polarization features. The adjusted cross-polarization features are obtained by adjusting the feature weights of the cross-polarization features based on the parallel glare mask. The adjusted cross-polarization features and parallel polarization features are combined to obtain a fused feature map; The fused feature map is input into a preset semantic segmentation network model to obtain the edge probability map of the target substrate; The edge positions of the target substrate are determined using a contour connection algorithm based on the edge probability map.
2. The method according to claim 1, characterized in that, Parallel polarization features include parallel glare features and parallel non-glare features; cross-polarization features include cross-glare features and cross-non-glare features. The process of combining parallel polarization images and cross-polarization images using a preset dual-channel neural network to determine the parallel polarization features and cross-polarization features respectively, and determining the parallel glare mask based on the parallel polarization features, includes the following steps: The brightness and reflection intensity features of the parallel polarization image are extracted using the first branch channel of a pre-defined dual-channel neural network. Calculate the mean and standard deviation of luminance, as well as the mean and standard deviation of reflection intensity, based on luminance characteristics and reflection intensity characteristics, respectively; A luminance threshold is set by combining the mean luminance and the standard deviation of luminance, and a reflection intensity threshold is set by combining the mean reflection and the standard deviation of reflection. The region in a parallel polarization image whose brightness features exceed a brightness threshold and whose reflection intensity features exceed a reflection intensity threshold is defined as the parallel glare region. The cross-glare and cross-non-glare features of the cross-polarized image are extracted using the second branch channel of a pre-defined dual-channel neural network. Determine the parallel glare mask based on the parallel glare region; Among them, the brightness and reflection intensity features of parallel glare in parallel polarized images are the maximum values under preset conditions, and the texture and edge features of cross-polarized images are the maximum values under preset conditions.
3. The method according to claim 2, characterized in that, The step of extracting the cross-glare and cross-non-glare features of the cross-polarized image using the second branch channel of a preset dual-channel neural network includes the following steps: The texture and edge features of the cross-polarized image are extracted using the second branch channel of a pre-defined dual-channel neural network; Determine the edge gradient magnitude and edge pixel connectivity based on edge features; When the edge gradient magnitude is greater than or equal to a preset edge gradient threshold and the edge pixel connectivity is greater than or equal to a preset edge connectivity threshold, the cross-non-glare feature is determined. When the edge gradient magnitude is less than a preset edge gradient threshold and the edge pixel connectivity is less than a preset edge connectivity threshold, the cross glare feature is determined. When the edge gradient magnitude is greater than or equal to the preset edge gradient threshold and the edge pixel connectivity is less than the preset edge connectivity threshold, the texture complexity is calculated based on the texture features. When the texture complexity does not exceed the preset texture feature threshold, the cross-glare feature is determined; When the edge gradient magnitude is less than the preset edge gradient threshold and the edge pixel connectivity is greater than or equal to the preset edge connectivity threshold, the average edge gray value is calculated based on the edge features. If the average grayscale value at the edge exceeds the preset grayscale threshold, then the cross-glare feature is determined.
4. The method according to claim 1, characterized in that, The process of adjusting the feature weights of the cross-polarization features based on the parallel glare mask to obtain the adjusted cross-polarization features includes the following steps: Spatial position matching between parallel glare masks and cross-polarization features is performed to determine the spatial correspondence between each parallel glare mask and cross-polarization feature. The pixel values of the parallel glare mask corresponding to the cross-polarization features are determined based on the spatial correspondence. Determine the cross-polarization characteristic value based on the cross-polarization characteristics; The adjustment weight is calculated based on the pixel values of the parallel glare mask and the preset weight factor; The adjusted cross-polarization feature is obtained by multiplying the adjusted weights by the cross-polarization eigenvalues.
5. The method according to claim 1, characterized in that, The process of combining the adjusted cross-polarization features and parallel polarization features to obtain the fused feature map includes the following steps: The adjusted cross-polarization features and parallel polarization features are used to construct the first feature layer structure and the second feature layer structure, respectively. Calculate the weight value of each feature in the first feature hierarchical structure and the weight value of each feature in the second feature hierarchical structure; A total weight map is constructed by combining the weight values in the first feature hierarchical structure and the weight values in the second feature hierarchical structure; Based on the overall weight map, the first feature hierarchical structure, and the second feature hierarchical structure, features at the same level are spliced together according to their corresponding levels to obtain the fused features; The fused feature map is obtained by constructing a Laplace pyramid based on the fused features.
6. The method according to claim 5, characterized in that, The step of constructing a first feature layer structure and a second feature layer structure from the adjusted cross-polarization features and parallel polarization features includes the following steps: Local brightness variation features and local reflection intensity features are extracted by combining parallel polarization features, and these features are used as the first-level features. Cluster analysis was performed on local brightness variation features and local reflection intensity features to obtain second-level features; Based on the parallel polarization characteristics, global brightness features and global reflection features are extracted as third-level features; A hierarchical structure of the first feature is constructed based on the first-level features, the second-level features, and the third-level features; By combining the adjusted cross-polarization features, fine-grained texture features and fine-grained edge features are extracted, and these two features are used as the fourth-level features. Cluster analysis was performed on fine-grained texture features and fine-grained edge features to obtain local texture features and local edge contour features, which were then used as the fifth level features. The sixth-level features are obtained by extracting the overall edge contour features and overall texture features based on the adjusted cross-polarization features; The second feature hierarchical structure is constructed by combining the fourth-level features, the fifth-level features, and the sixth-level features.
7. The method according to claim 1, characterized in that, Determining the edge position of the target substrate using a contour connection algorithm based on the edge probability map includes the following steps: The edge probability map is converted into an edge binary map, where pixels with a probability value greater than or equal to a preset threshold in the edge binary map are designated as edge points, and pixels with a probability value less than the preset threshold in the edge binary map are designated as non-edge points. Traverse the binary edge map and use a contour detection algorithm to determine discrete edge segments in the binary edge map; Calculate the length of each discrete edge segment, and take the discrete edge segments whose length exceeds a preset length threshold as valid discrete edge segments; Calculate the distance between each effective discrete edge segment, and connect the effective discrete edge segments whose distance is less than a preset distance threshold to determine the initial edge position of the target substrate; The edge position of the target substrate is determined by edge fitting based on the preset contour shape of the target substrate to the initial edge position.
8. The method according to claim 7, characterized in that, The method further includes the following steps: The target vertex is determined according to the preset contour shape of the target substrate; The coordinates of the target vertex are extracted by combining the edge position of the target substrate and the target vertex. Determine the edge location area and edge location shape based on the target vertex coordinates and the edge location of the target substrate; The edge position of the target substrate is verified by combining the edge position area, edge position shape, and preset contour shape; If the edge area and edge shape verifications pass, the edge position of the target substrate is determined.
9. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores instructions for causing the machine to perform the printing paperboard positioning method based on visual image segmentation and edge detection according to any one of claims 1 to 8.
10. An electronic device, characterized in that, include: The memory is configured to store instructions; as well as The processor is configured to retrieve the instructions from the memory and, when executing the instructions, to implement the printing paperboard positioning method based on visual image segmentation and edge detection according to any one of claims 1 to 8.
Citation Information
Patent Citations
Waste plastic classification method and system based on visual identification
CN120375085A
Image processing apparatus, image pickup apparatus, and image processing method
US20220006992A1