A machine vision-based cardboard defect detection system
By using multi-scale phase response and topology space construction, the problem of overlap between noise phase and real defect in paperboard defect detection is solved, achieving efficient paperboard defect detection, reducing false alarm and false negative rates, and providing stable defect location and size information.
Patent Information
- Application Number
- CN202611258667.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2046-08-19
AI Technical Summary
Existing frequency-domain phase enhancement-based paperboard defect detection methods suffer from the problem of missed detection of microcracks when dealing with complex backgrounds of recycled paperboard, due to the high overlap between noise phase and real defect phase. Furthermore, there is a lack of effective screening methods.
A pyramid sequence is constructed using a multi-scale phase response extraction module. Through frequency domain phase nonlinear broadening and topological space construction, combined with a cross-scale feature tracking module, steady-state features are screened and inverse spatial reconstruction is performed to output the geometric contour and location coordinates of the cardboard defect.
It effectively suppresses the amplification of noise phase, improves the accuracy of microcrack detection, reduces false alarm rate and false negative rate, and provides stable defect location and size information under the conditions of speed fluctuation and light change in the paperboard production line.
Smart Images

Figure CN122820699B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of paperboard surface quality inspection technology, and specifically to a paperboard defect detection system based on machine vision. Background Technology
[0002] In the packaging and printing industry, surface defects on cardboard, such as microcracks, light-transmitting spots, scratches, and dents, directly affect the structural strength and printability of the product. Traditional manual visual inspection methods suffer from low efficiency, inconsistent standards, and susceptibility to subjective factors, making it difficult to meet the continuous production demands of high-speed cardboard production lines exceeding 200 meters per minute. With the development of computer vision and digital image processing technologies, automated inspection solutions based on industrial camera image acquisition and frequency domain analysis have gradually become a research hotspot in this field.
[0003] The existing technology has the following shortcomings: When dealing with the complex background of recycled paperboard, the noise phase and the real defect phase highly overlap in the high-order subband of the frequency domain. The enhancement process synchronously amplifies the noise, causing false alarms. At the same time, the lack of effective screening methods for multi-scale phase response leads to the problem of missed detection of microcracks. Summary of the Invention
[0004] The purpose of this invention is to provide a machine vision-based cardboard defect detection system to solve the problems mentioned above.
[0005] The objective of this invention can be achieved through the following technical solutions: A machine vision-based cardboard defect detection system includes: Image acquisition module: Acquires raw grayscale images of the cardboard surface; Multi-scale phase response extraction module: Constructs a pyramid sequence with different spatial resolutions from the original grayscale image, and performs frequency domain phase nonlinear broadening on the image of each pyramid layer to obtain the phase response binary map corresponding to each layer; Topology space construction module: The foreground pixels in the phase response binary map of each layer are used as topology vertices. Based on the pixel neighborhood connection relationship, the simple complex of each layer is constructed to form a family of topology spaces across scales. Cross-scale feature tracking module: Along the pyramid progression from fine to coarse scale, it tracks the persistence status of each topological feature between adjacent complex layers and records the number of layers traversed by each feature as the cross-scale duration period. Topology filtering reconstruction and defect output module: compares the cross-scale duration of each feature with a preset layer threshold, discards transient features with duration less than the threshold, retains steady-state features with duration reaching the threshold, and performs inverse spatial reconstruction based on the phase response of the retained features in each layer to output the geometric contour and positioning coordinates of the cardboard defect.
[0006] As a further aspect of the present invention: obtaining the phase response binary map corresponding to each layer specifically includes: The phase roughness estimate of each layer is determined based on the local gray-level gradient magnitude of each layer image; The intensity coefficients of frequency domain broadening in each layer are adjusted in reverse based on the phase roughness estimate. The frequency domain phase nonlinear broadening process is performed on the corresponding layer image using the adjusted intensity coefficient to generate a binary phase response map for each layer.
[0007] As a further aspect of the present invention: the process for obtaining the strength coefficient is as follows: Extract the inverse difference moment of the gray-level co-occurrence matrix of all pixels in the image of the layer where the phase roughness estimate is located, and use the inverse difference moment as the texture uniformity measure of the corresponding layer; Based on the degree of deviation between the texture uniformity metric and the preset standard uniformity, the frequency domain broadening intensity coefficient of the corresponding layer is determined according to the mapping relationship that the greater the deviation, the smaller the intensity coefficient.
[0008] As a further aspect of the present invention: the frequency domain phase nonlinear broadening processing specifically includes: Perform frequency domain transformation on the layer image and extract the phase component of each frequency point in the frequency domain; Nonlinear amplitude compression is applied to the phase components at each frequency point based on the intensity coefficient; After recombining the compressed phase component with the original amplitude component, an inverse frequency domain transform is performed to generate the phase response image after the corresponding layer is stretched. Binarization segmentation is performed on the phase response image to obtain the corresponding layer phase response binary map.
[0009] As a further aspect of the present invention: the formation of a cross-scale topological space family specifically includes: Calculate the distance from each foreground pixel to the nearest background pixel in the phase response binary image of each layer; The neighborhood connection radius of each foreground pixel is determined based on the distance value; Establish adjacency relationships between vertices within the layer based on the connection radius of each foreground pixel, and generate simple complexes for each layer based on the adjacency relationships; Arrange the simple complexes of each layer into a family of topological spaces across scales, following the pyramid's order from finest to coarsest.
[0010] As a further aspect of the present invention: the generation of simple complexes for each layer based on adjacency relationships specifically includes: For each foreground pixel, take all neighboring points within the coverage area of its connection radius, calculate the second gray-level gradient at the pixel positions through which the line formed by the foreground pixel and each neighboring point passes, and accumulate the absolute value of the second gray-level gradient at each position as the gradient accumulation amount in the direction of the line. The validity of a connection is determined based on the gradient accumulation. Connections with a gradient accumulation greater than a preset threshold are considered valid adjacent edges. Using the set of vertices connected by all valid adjacent edges as the basic unit, adjacent basic units sharing vertices are merged level by level to form simple complexes at each layer.
[0011] As a further aspect of the present invention: the process for obtaining the cross-scale duration period is as follows: Obtain the identifiers of all other topological features in the neighborhood of the pixel position occupied by each topological feature in the current layer simple complex, and construct a neighborhood connectivity graph of the topological features; The neighborhood connectivity graphs of each topological feature in the current simplex layer are matched with the neighborhood connectivity graphs of each topological feature in the adjacent coarse-scale layer, and the cross-layer feature pairings with the highest matching degree are retained. The same continuous tracking identity is assigned to the successfully matched cross-layer features, and the process is repeated layer by layer from fine to coarse until the identity no longer appears in the next layer. The number of layers crossed by the accumulated identity is taken as the cross-scale duration of the topological feature.
[0012] As a further aspect of the present invention: the construction of the neighborhood connection graph of topological features specifically includes: Extract all pixel positions occupied by the topological feature to be analyzed in the current simple complex, and calculate the average coordinates of all pixel positions as the centroid coordinates of the topological feature to be analyzed; The search is expanded outward from the centroid coordinates, and the centroid coordinates of all other topological features within the search range are collected. The direction angle of the line connecting the centroid of the topological feature to be analyzed to the centroid of each other topological feature is calculated. Based on the distribution order of the direction angles of each connection on the circumference, the identifiers of other topological features are arranged into a circular sequence in ascending order of direction angles, and the circular sequence is used as the neighborhood connection map of the topological feature to be analyzed.
[0013] As a further aspect of the present invention: the geometric contour and positioning coordinates of the output cardboard defect specifically include: The region occupied by the steady-state features in the phase response binary map of each layer is taken as the region to be fused. The boundary pixels of the region to be fused are extracted, and the gray-level gradient magnitude of each boundary pixel along the boundary normal direction is calculated. The fusion weight of the boundary pixels in the reverse space reconstruction is determined based on the gray-level gradient magnitude. All boundary pixels belonging to the same steady-state feature in each layer are weighted and projected onto the spatial coordinate grid of the original grayscale image according to their respective fusion weights. The weighted grayscale values of all projected pixels are accumulated at each spatial coordinate position to generate the fused and reconstructed image. Extract the minimum bounding rectangle of all connected components in the fused and reconstructed image. Use the center coordinates of the minimum bounding rectangle as the location coordinates of the cardboard defect, and use the major and minor axes of the minimum bounding rectangle as the geometric contour of the cardboard defect.
[0014] The beneficial effects of this invention are: (1) By introducing phase roughness estimation and texture uniformity measurement, this invention adaptively adjusts the frequency domain broadening intensity coefficient of each layer image, so that sufficient phase enhancement capability is maintained in texture uniform area and enhancement intensity is automatically suppressed in texture disordered area, thus avoiding the synchronous amplification of noise phase from the source; at the same time, combined with cross-scale topological continuous period verification, the real defects are retained because they have cross-layer constancy, and noise such as fiber burrs are eliminated because of short continuous period, thereby reducing false alarms and false negatives in the detection of microcracks in complex recycled paperboard background.
[0015] (2) The present invention reconstructs the boundary pixels of the steady-state features in each layer by weighted projection according to the gray-scale gradient magnitude, and integrates multi-layer information to generate the final defect contour, so that the defect boundary positioning does not depend on the binarization segmentation result under a single scale; at the same time, the center coordinates and major and minor axes of the minimum bounding rectangle are used as defect output parameters, and under actual working conditions such as speed fluctuation and light change in the paperboard production line, it can still provide stable and repeatable defect location and size information, which is convenient for accurate removal in subsequent processes. Attached Figure Description
[0016] The invention will now be further described with reference to the accompanying drawings.
[0017] Figure 1 This is a system block diagram of the present invention; Figure 2 This is a flowchart of the process for obtaining the phase response binary map corresponding to each layer in this invention; Figure 3 This is a flowchart illustrating the process of forming a family of topological spaces across scales in this invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] Please see Figure 1 As shown, the present invention is a machine vision-based cardboard defect detection system, comprising: Image acquisition module: Acquires raw grayscale images of the cardboard surface; Multi-scale phase response extraction module: Constructs a pyramid sequence with different spatial resolutions from the original grayscale image, and performs frequency domain phase nonlinear broadening on the image of each pyramid layer to obtain the phase response binary map corresponding to each layer; Topology space construction module: The foreground pixels in the phase response binary map of each layer are used as topology vertices. Based on the pixel neighborhood connection relationship, the simple complex of each layer is constructed to form a family of topology spaces across scales. Cross-scale feature tracking module: Along the pyramid progression from fine to coarse scale, it tracks the persistence status of each topological feature between adjacent complex layers and records the number of layers traversed by each feature as the cross-scale duration period. Topology filtering reconstruction and defect output module: compares the cross-scale duration of each feature with a preset layer threshold, discards transient features with duration less than the threshold, retains steady-state features with duration reaching the threshold, and performs inverse spatial reconstruction based on the phase response of the retained features in each layer to output the geometric contour and positioning coordinates of the cardboard defect.
[0020] The image acquisition module acquires the original grayscale image of the cardboard surface, specifically including: When acquiring the original grayscale image of the cardboard surface, an industrial linear array charge-coupled device camera is installed above the conveyor platform of the cardboard production line. The optical axis of the camera lens is perpendicular to the cardboard width, and the camera's field of view covers the entire width of the cardboard.
[0021] Two sets of high-brightness LED strip light sources are symmetrically arranged on both sides of the camera. The direction of the light source illumination is at a 45-degree angle to the normal direction of the cardboard surface to eliminate specular reflection on the cardboard surface and uniformly illuminate the detection area.
[0022] The cardboard passes under the camera at a constant speed of 200 meters per minute. A rotary encoder mounted on the conveyor platform's drive roller generates equally spaced pulse signals as the cardboard moves. These pulse signals serve as the trigger source for the camera's line scanning, ensuring that the spatial resolution of the acquired image remains constant in the direction of the cardboard's movement.
[0023] The camera acquires one line of grayscale data for each pulse received. Each line contains 2048 pixels, and the grayscale value of each pixel is represented by an 8-bit binary number, with a grayscale range of 0 to 255.
[0024] The collected grayscale data is transmitted sequentially to the image acquisition card. The image acquisition card stitches the continuous rows of data into a two-dimensional original grayscale image according to the triggering order. The horizontal resolution of this image corresponds to the width of the cardboard, and the vertical resolution corresponds to the movement direction of the cardboard. The image size is 2048 pixels by 3072 pixels.
[0025] After acquisition, the original grayscale image is stored as a digital file in the memory of the image processing computer for later retrieval.
[0026] Please see Figure 2 As shown, in the multi-scale phase response extraction module, a pyramid sequence with different spatial resolutions is constructed from the original grayscale image, and frequency domain phase nonlinear broadening is performed on each layer of the pyramid image to obtain the corresponding phase response binary map, specifically including: When constructing the pyramid sequence from the original grayscale image, the Gaussian pyramid method is used. The original grayscale image is sequentially subjected to Gaussian filtering and interlaced downsampling to generate a total of 4 layers of images, which are denoted as layers 0 to 3. Layer 0 is the original size, layer 1 is half the size of layer 0, layer 2 is half the size of layer 1, and layer 3 is half the size of layer 2. Each layer of the image maintains the same grayscale range of 0 to 255.
[0027] For each layer of the pyramid, the local gray-level gradient magnitude of that layer is first calculated.
[0028] The Sobel operator is used to calculate the gradient components in the horizontal and vertical directions respectively; the square root of the sum of the squares of the two components is used to obtain the gradient magnitude of each pixel.
[0029] The image layer is divided into multiple non-overlapping sub-blocks, each containing... 1 pixel.
[0030] For each sub-block, calculate the average gradient magnitude of all pixels within that sub-block, then calculate the sum of squared deviations of the gradient magnitude of each pixel relative to that average, divide by the total number of pixels in the sub-block, and take the square root to obtain the standard deviation of the gradient magnitude of that sub-block.
[0031] The phase roughness estimate of the layer is obtained by taking the arithmetic mean of the standard deviations of all sub-blocks.
[0032] The estimated phase roughness value is calculated using the following mathematical formula: ; in, Indicates the first Phase roughness estimate of the layer, Take values from 0 to 3; The total number of sub-blocks into which this layer of the image is divided; For sub-block index; For the first The set of pixels within each sub-block; For the first The total number of pixels within each sub-block; For the first The first sub-block The gradient magnitude of each pixel; For the first The arithmetic mean of the gradient magnitudes of all pixels within a sub-block.
[0033] For each image layer, extract the gray-level co-occurrence matrix of all pixels in that layer, with a pixel spacing of 1 and an orientation of 0 degrees.
[0034] Elements of the gray-level co-occurrence matrix Represents grayscale value With grayscale value The frequency of occurrence of adjacent positions, among which and The values range from 0 to 255.
[0035] The inverse difference moment is calculated based on this matrix and used as a measure of the texture uniformity of this layer.
[0036] The method for calculating the inverse difference moment is as follows: for all grayscale pairs ,Will Multiply Then, add all the products together; the sum is the inverse difference moment. The texture uniformity of this layer is denoted as... .
[0037] Pre-set a standard uniformity This value is taken from the average texture uniformity of qualified cardboard samples, in this embodiment... The value is 0.85.
[0038] in accordance with and The degree of deviation between the two values determines the frequency domain broadening intensity coefficient of that layer; the greater the deviation, the smaller the intensity coefficient. The following mathematical formula is used for calculation: ; in, Indicates the first The frequency domain broadening intensity coefficient of the layer, with a value range of 0 to 1; This is used as a measure of the texture uniformity of the layer. To preset the standard uniformity. When equal hour, An equal value of 1 indicates that the broadening strength is not reduced; when and When the deviation increases, It decreases monotonically, thereby suppressing the intensity of frequency domain phase nonlinear broadening.
[0039] For each image layer, a two-dimensional discrete Fourier transform is performed on its current size to obtain a complex matrix in the frequency domain.
[0040] Extract the phase component for each frequency point from the complex matrix. This phase component is the arctangent of the ratio of the imaginary part to the real part at that frequency point, and its value is [value missing]. to .
[0041] At the same time, the original amplitude components of each frequency point are preserved, that is, the square root of the sum of the squares of the real and imaginary parts.
[0042] Based on the frequency domain broadening intensity coefficient of this layer Nonlinear amplitude compression is applied to the phase component at each frequency point. Specifically, for phase components with an absolute value greater than 10 ... The frequency point, multiply the amplitude component of that frequency point by For phase components whose absolute values are not greater than 100,000, the absolute values of the phase components are not greater than At the frequency point, the amplitude component remains unchanged.
[0043] The compressed amplitude component is recombine with the original phase component to form a new complex number, and a two-dimensional discrete Fourier inverse transform is performed to obtain the phase response image after the layer is stretched.
[0044] The binarization threshold is automatically determined for the phase response image using the maximum inter-class variance method. Pixels with gray values greater than the threshold are set to 1, and the remaining pixels are set to 0, thereby obtaining the phase response binary image corresponding to this layer.
[0045] Repeat the above process until the phase response binary maps of all four layers of images are obtained.
[0046] Please see Figure 3 As shown, in the topology space construction module, the foreground pixels in the phase response binary maps of each layer are used as topology vertices. Simple complexes of each layer are constructed based on pixel neighborhood connectivity, forming a cross-scale family of topology spaces, specifically including: By using the foreground pixels in the phase response binary maps of each layer as topological vertices, a cross-scale topological space family is constructed.
[0047] For each phase response binary image, first obtain the coordinate set of all foreground pixels in the binary image, and the size of the binary image is consistent with the size of the corresponding pyramid image.
[0048] For each foreground pixel, take it as the target point and calculate the Euclidean distance from the target point to the nearest background pixel. The background pixel refers to the pixel position with a gray value of zero in the binary image.
[0049] In the specific calculation, a row-by-row and column-by-column scanning method is adopted. For each foreground pixel, the search is expanded outward layer by layer within its eight neighborhood until a background pixel is found for the first time. The radius value of the current search layer is recorded as the distance value of the foreground pixel.
[0050] The neighborhood connection radius of each foreground pixel is determined based on its distance value.
[0051] Set a scaling factor of 0.3, multiply the distance value of the foreground pixel by this scaling factor, and use the product as the neighborhood connection radius of the foreground pixel.
[0052] When the distance value is large, it indicates that the foreground pixel is located inside a larger connected region, and the neighborhood connection radius is correspondingly larger, allowing for coverage of more distant neighboring points; when the distance value is small, it indicates that the foreground pixel is close to the edge of the region or exists in isolation, and the neighborhood connection radius is correspondingly smaller, limiting its connection range.
[0053] Calculate the independent neighborhood connection radius for each of the foreground pixels.
[0054] Adjacency relationships between vertices are established within the binary graph of this layer based on the neighborhood connection radius of each foreground pixel.
[0055] For a given foreground pixel, all other foreground pixels within the radius of its neighborhood connection are taken as candidate neighbors. If the straight-line distance between a candidate neighbor and the current foreground pixel does not exceed the radius of the current foreground pixel's neighborhood connection, then the candidate neighbor is recorded as a neighbor.
[0056] For the path connecting the current foreground pixel and each of its neighbors, extract all pixel positions that the path passes through, and calculate the second-order gray-level gradient at each pixel position. The second-order gray-level gradient is calculated as follows: take the sum of the gray-level values of the pixels on both sides of the horizontal and vertical directions at the pixel position, minus four times the gray-level value of the pixel position, add the calculation results in the horizontal and vertical directions, and take the absolute value as the second-order gray-level gradient at that position.
[0057] The absolute values of the second-order grayscale gradients at all locations along the connecting path are summed to obtain the gradient accumulation in the direction of the connecting line.
[0058] Set a preset threshold value, which is the value obtained by multiplying the total number of pixels on the connection line by one hundred. The total number of pixels on the connection line is the rounded-up value of the Euclidean distance between the current foreground pixel and its neighboring pixels.
[0059] The gradient accumulation is compared with the preset threshold. If the gradient accumulation is greater than the preset threshold, the connection is determined to be a valid adjacent edge; otherwise, it is determined to be an invalid adjacent edge.
[0060] Repeat the above process until all connections between the current foreground pixel and its neighbors have been determined.
[0061] Iterate through all foreground pixels within the layer to obtain the set of all valid adjacent edges within that layer.
[0062] A simple complex is generated using the set of vertices connected by all valid adjacent edges as the basic unit.
[0063] Specifically, each effective adjacent edge connects two vertices as a one-dimensional simplex, and all one-dimensional simplexes are stored in the simplex set of the current layer.
[0064] The adjacent basic units that share a vertex are merged step by step. For any two one-dimensional simplexes, if they share a vertex, the three vertices of the two one-dimensional simplexes are combined to form a two-dimensional simplex, i.e., a triangular facet. For two two-dimensional simplexes that share an edge, they are merged into a simplex of a higher dimension, until there are no more adjacent units that can be merged.
[0065] After completing the above merging process, the simple complex corresponding to the binary graph of this layer is obtained.
[0066] Following the pyramid's order from fine to coarse scales, i.e. from the zeroth to the third layer, the simple complexes of each layer are arranged sequentially to form a family of topological spaces across scales. The simple complexes between adjacent layers maintain a spatial correspondence, meaning that each pixel position in the fine-scale layer corresponds to a unique pixel position in the coarse-scale layer. This correspondence is determined by the coordinate mapping during the pyramid downsampling process.
[0067] In the cross-scale feature tracking module, the persistence status of each topological feature between adjacent complex layers is tracked along the pyramid's progression from fine to coarse scales. The number of layers traversed by each feature is recorded as the cross-scale duration period, specifically including: The topological features of each simple complex are tracked across scales along the pyramid progression from fine to coarse scales.
[0068] Topological features refer to the connected components or ring structures composed of multiple simplexes in a simple complex, and each topological feature has a unique identifier.
[0069] At the start of tracking, all topological features in the finest-scale layer, i.e., the zeroth simplex, are assigned an initial identity, which is a consecutive integer number starting from 1.
[0070] For each layer except the finest-scale layer (i.e., the first, second, and third layers), the neighborhood connectivity graph of each topological feature in the current simplex is sequentially matched with the neighborhood connectivity graph of each topological feature in the adjacent coarse-scale layer. During the matching process, the matching rate between the two neighborhood connectivity graphs is calculated. The matching rate is calculated as follows: the identifiers in the two circular sequences are compared sequentially, the number of times the same identifier appears is counted, and this count is divided by the total number of identifiers in the neighborhood connectivity graph of the current layer's topological feature. The resulting ratio is the matching rate. The cross-layer feature pair with the highest matching rate is selected as a valid pair. If the highest matching rate is greater than a preset matching rate threshold, the pair is considered a successful match. The preset matching rate threshold is set to 0.6.
[0071] Obtain the pixel position occupied by each topological feature in the current layer simplex, and construct the neighborhood connectivity map of that topological feature.
[0072] In the specific construction, the row and column coordinates of all pixel positions covered by the topological feature are taken, and the arithmetic mean of the row coordinates and the arithmetic mean of the column coordinates are calculated respectively. The average value is used as the centroid coordinates of the topological feature.
[0073] Using the centroid coordinates as the center, set an initial search radius of 3 pixels. Within this radius, search for the centroid coordinates of other topological features. If the number of other topological features found within the search range is less than 2, expand the search radius to twice the current radius and search again until the search range contains at least 2 other topological features. At the same time, set a maximum search radius of 30 pixels. Stop the search when the search radius is expanded to the maximum search radius.
[0074] For each other topological feature found, calculate the direction angle of the line connecting the centroid of the topological feature to be analyzed to the centroid of that other topological feature.
[0075] The direction angle is calculated as follows: taking the centroid of the topological feature to be analyzed as the origin and the horizontal rightward direction as the 0-degree reference, calculate the offset of the centroid of the other topological feature relative to the origin. The arctangent value of the ratio obtained by dividing the vertical coordinate of the offset by the horizontal coordinate is used as the initial angle. Then, the initial angle is corrected according to the sign of the horizontal coordinate. The corrected angle ranges from 0 degrees to 360 degrees.
[0076] All other topological features found are arranged in ascending order of their respective orientation angles to form a circular sequence. Each element in this circular sequence serves as an identifier for the corresponding other topological feature.
[0077] When the orientation angles are the same, the elements are arranged in order of distance from the centroid of the topological feature to be analyzed, from closest to furthest. This circular sequence is used as the neighborhood connectivity map of the topological feature to be analyzed.
[0078] When matching the neighborhood connectivity graphs of each topological feature in the current simplex layer with the neighborhood connectivity graphs of each topological feature in the adjacent coarse-scale layer, the neighborhood connectivity graph of a certain topological feature in the current layer is compared with the neighborhood connectivity graph of a certain topological feature in the coarse-scale layer, and the matching rate is calculated in the manner described above.
[0079] Iterate through all cross-layer feature combinations and select the pair with the highest matching rate. If the highest matching rate is greater than 0.6, then the two topological features in the pair are determined to be a match.
[0080] For successfully matched cross-layer feature pairs, the topological features in the coarse-scale layer are assigned the same continuous tracking identity as the topological features in the current layer.
[0081] The process is repeated layer by layer from fine to coarse. For topological features that have obtained continuously tracked identity identifiers, the matching process is continued in the next adjacent layer. If a matching topological feature is found in the next layer, the identity identifier is passed on to the topological feature of that next layer. If no matching topological feature is found in the next layer, the transmission of the identity identifier is stopped, and the number of layers traversed by the identity identifier from the first layer to the last layer is recorded. The specific calculation method is as follows: subtract the layer number of the first layer from the layer number of the last layer, and then add 1. The resulting value is taken as the cross-scale duration of the topological feature.
[0082] For each continuously tracked identity, only one cross-scale duration is recorded until the tracking process of all topological features is completed.
[0083] For a topological feature that appears in the finest scale layer but fails to find a matching one in any coarse scale layer, its cross-scale duration period is denoted as 1.
[0084] In the topology filtering reconstruction and defect output module, the cross-scale duration of each feature is compared with a preset layer threshold. Transient features with durations less than the threshold are discarded, while steady-state features with durations reaching the threshold are retained. Based on the phase response of the retained features at each layer, inverse spatial reconstruction is performed to output the geometric contour and location coordinates of the cardboard defect. Specifically, this includes:
[0085] The cross-scale duration of all topological features is screened.
[0086] Set a preset threshold for the number of layers. Since the pyramid sequence contains a total of 4 layers, set the preset threshold for the number of layers to 2.
[0087] The cross-scale duration of each topological feature is compared with the preset layer threshold. If the cross-scale duration of a topological feature is less than 2, the topological feature is determined to be a transient feature and discarded, and will not participate in the subsequent reconstruction process. If the cross-scale duration of a topological feature is greater than or equal to 2, the topological feature is determined to be a steady-state feature and retained.
[0088] Topological features with a duration of 1 across scales but occupying more than 500 pixels in the finest scale layer are also classified as steady-state features to preserve real defects that are large in size but fail to persist in cross-scale tracking.
[0089] After the above screening, a set of all steady-state features is obtained.
[0090] For each steady-state feature, extract all pixel positions occupied by the steady-state feature in the phase response binary map of each layer, and merge the pixel positions belonging to the steady-state feature in each layer as the region to be fused.
[0091] Extract the boundary pixels of the region to be merged. The boundary pixel is determined as follows: for each pixel in the region to be merged, check its four neighboring positions. If there is at least one pixel in the four neighboring areas that does not belong to the region to be merged, then mark the pixel as a boundary pixel.
[0092] For each boundary pixel, calculate the grayscale gradient magnitude along the boundary normal direction. The normal direction is determined as follows: starting from the boundary pixel, extend in a direction away from the interior of the region to be merged, and take the absolute value of the difference between the grayscale value of the adjacent pixel position in the extended direction and the grayscale value of the adjacent pixel position in the direction closer to the interior of the region to be merged, as the grayscale gradient magnitude of the boundary pixel.
[0093] The fusion weight of the boundary pixel in the reverse space reconstruction is determined based on the gray-level gradient magnitude. The fusion weight is the ratio of the gray-level gradient magnitude of the boundary pixel to the sum of the gray-level gradient magnitudes of all boundary pixels of the steady-state feature.
[0094] All boundary pixels belonging to the same steady-state feature in each layer are weighted and projected onto the spatial coordinate grid of the original grayscale image according to their respective fusion weights.
[0095] During projection, based on the pyramid downsampling factor of the layer where the boundary pixel is located, the row and column coordinates of the boundary pixel are multiplied by the corresponding factor value, where the factor is 1 for layer 0, 2 for layer 1, 4 for layer 2, and 8 for layer 3, to obtain the projection coordinates of the boundary pixel in the original size space.
[0096] The gray value of each projection point is set to the gray value of the boundary pixel in the phase response binary map of the corresponding layer, i.e., the value 1. The gray value of the projection point is multiplied by the fusion weight of the boundary pixel and then accumulated to the corresponding coordinate position in the spatial coordinate grid.
[0097] If multiple projection points are accumulated to the same coordinate position, then all accumulated values at that position are added together.
[0098] After traversing all boundary pixels of all steady-state features and completing the accumulation, the accumulated value at each coordinate position in the spatial coordinate grid is divided by the total number of projection points projected to that position to obtain the average weighted gray value at that position, thus generating the fused and reconstructed image.
[0099] All connected components in the fused and reconstructed image are extracted. Connectivity is determined by the four-neighbor connection method, that is, pixels that are adjacent in the four directions (up, down, left, and right) and have a gray value greater than 0.5 belong to the same connected component.
[0100] For each connected component, calculate the minimum bounding rectangle that contains all pixels of that connected component. The angle between the long side of the minimum bounding rectangle and the horizontal direction is taken to minimize the area of the rectangle within the range of 0 degrees to 180 degrees.
[0101] The center row coordinates and center column coordinates of the smallest bounding rectangle are used as the positioning coordinates of the cardboard defect. The length of the long side of the smallest bounding rectangle is used as the major axis of the defect, and the length of the short side of the smallest bounding rectangle is used as the minor axis of the defect. The major axis and the minor axis together are used as the geometric contour of the cardboard defect.
[0102] Output the location coordinates and geometric contours corresponding to each connected component to complete the detection.
[0103] The working principle of this invention is as follows: A multi-layer Gaussian pyramid sequence is constructed from the original grayscale image of the cardboard surface. Phase roughness estimates and texture uniformity measures are calculated for each layer, and the frequency domain broadening intensity coefficient is adaptively determined accordingly. After performing frequency domain phase nonlinear broadening, a binary phase response map of each layer is obtained. Foreground pixels in each layer's binary map are used as topological vertices. Effective adjacent edges are determined based on the accumulation of second-order grayscale gradients between pixels, and a simple complex is constructed in each layer to form a cross-scale topological space family. Along the pyramid from thin to coarse, a neighborhood connectivity map is constructed using the direction angle of the centroid connection line of the topological features for cross-layer matching. The existence status of each topological feature is tracked, and its cross-scale duration is recorded. Based on the steady-state features whose duration reaches a threshold, their boundary pixels in each layer are reconstructed by weighted projection according to the grayscale gradient magnitude, outputting the defect's geometric contour and location coordinates.
[0104] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.
Claims
1. A machine vision based paperboard defect detection system, characterized in that, include: Image acquisition module: Acquires raw grayscale images of the cardboard surface; Multi-scale phase response extraction module: Constructs a pyramid sequence with different spatial resolutions from the original grayscale image, and performs frequency domain phase nonlinear broadening on each layer of the pyramid image to obtain the corresponding phase response binary map. The frequency domain phase nonlinear broadening specifically includes: Perform frequency domain transformation on the layer image and extract the phase component of each frequency point in the frequency domain; Nonlinear amplitude compression is applied to the phase components at each frequency point based on the intensity coefficient; After recombining the compressed phase component with the original amplitude component, an inverse frequency domain transform is performed to generate the phase response image after the corresponding layer is stretched. Binarization segmentation is performed on the phase response image to obtain the corresponding layer phase response binary map; Topology space construction module: The foreground pixels in the phase response binary map of each layer are used as topology vertices. Based on the pixel neighborhood connection relationship, the simple complex of each layer is constructed to form a family of topology spaces across scales. Cross-scale feature tracking module: Along the pyramid's progression from fine to coarse scales, it tracks the persistence status of each topological feature between adjacent complex layers, recording the number of layers traversed by each feature as the cross-scale duration period. The process for obtaining the cross-scale duration period is as follows: Obtain the identifiers of all other topological features in the neighborhood of the pixel position occupied by each topological feature in the current layer simple complex, and construct a neighborhood connectivity graph of the topological features; The neighborhood connectivity graphs of each topological feature in the current simplex layer are matched with the neighborhood connectivity graphs of each topological feature in the adjacent coarse-scale layer, and the cross-layer feature pairings with the highest matching degree are retained. Assign the same continuous tracking identity identifier to the successfully matched cross-layer features, and iterate layer by layer from fine to coarse until the identity identifier no longer appears in the next layer. The number of layers crossed by the accumulated identity identifier is used as the cross-scale duration of the topological feature. The construction of the neighborhood connectivity graph of topological features specifically includes: Extract all pixel positions occupied by the topological feature to be analyzed in the current simple complex, and calculate the average coordinates of all pixel positions as the centroid coordinates of the topological feature to be analyzed; The search is expanded outward from the centroid coordinates, and the centroid coordinates of all other topological features within the search range are collected. The direction angle of the line connecting the centroid of the topological feature to be analyzed to the centroid of each other topological feature is calculated. Based on the distribution order of the direction angles of each connection on the circumference, the identifiers of other topological features are arranged into a circular sequence in ascending order of direction angles, and the circular sequence is used as the neighborhood connection map of the topological feature to be analyzed. Topology filtering reconstruction and defect output module: compares the cross-scale duration of each feature with a preset layer threshold, discards transient features with duration less than the threshold, retains steady-state features with duration reaching the threshold, and performs inverse spatial reconstruction based on the phase response of the retained features in each layer to output the geometric contour and positioning coordinates of the cardboard defect.
2. The cardboard defect detection system based on machine vision according to claim 1, characterized in that, The process of obtaining the phase response binary map corresponding to each layer specifically includes: The estimated phase roughness value of each layer is determined based on the local gray-level gradient magnitude of each layer image; The intensity coefficients of frequency domain broadening in each layer are adjusted in reverse based on the phase roughness estimate. The frequency domain phase nonlinear broadening process is performed on the corresponding layer image using the adjusted intensity coefficient to generate a binary phase response map for each layer.
3. The cardboard defect detection system based on machine vision according to claim 2, characterized in that, The process of obtaining the strength coefficient is as follows: Extract the inverse difference moment of the gray-level co-occurrence matrix of all pixels in the image of the layer where the phase roughness estimate is located, and use the inverse difference moment as the texture uniformity measure of the corresponding layer; Based on the degree of deviation between the texture uniformity metric and the preset standard uniformity, the frequency domain broadening intensity coefficient of the corresponding layer is determined according to the mapping relationship that the greater the deviation, the smaller the intensity coefficient.
4. The cardboard defect detection system based on machine vision according to claim 1, characterized in that, The formation of a multi-scale family of topological spaces specifically includes: Calculate the distance from each foreground pixel to the nearest background pixel in the phase response binary image of each layer; The neighborhood connection radius of each foreground pixel is determined based on the distance value; Establish adjacency relationships between vertices within the layer based on the connection radius of each foreground pixel, and generate simple complexes for each layer based on the adjacency relationships; Arrange the simple complexes of each layer into a family of topological spaces across scales, following the pyramid's order from finest to coarsest.
5. The cardboard defect detection system based on machine vision according to claim 4, characterized in that, The generation of simple complexes for each layer based on adjacency relationships specifically includes: For each foreground pixel, take all neighboring points within the coverage area of its connection radius, calculate the second gray-level gradient at the pixel positions through which the line formed by the foreground pixel and each neighboring point passes, and accumulate the absolute value of the second gray-level gradient at each position as the gradient accumulation amount in the direction of the line. The validity of a connection is determined based on the gradient accumulation. Connections with a gradient accumulation greater than a preset threshold are considered valid adjacent edges. Using the set of vertices connected by all valid adjacent edges as the basic unit, adjacent basic units sharing vertices are merged level by level to form simple complexes at each layer.
6. The cardboard defect detection system based on machine vision according to claim 1, characterized in that, The geometric contour and positioning coordinates of the defects in the output cardboard specifically include: The region occupied by the steady-state features in the phase response binary map of each layer is taken as the region to be fused. The boundary pixels of the region to be fused are extracted, and the gray-level gradient magnitude of each boundary pixel along the boundary normal direction is calculated. The fusion weight of the boundary pixels in the reverse space reconstruction is determined based on the gray-level gradient magnitude. All boundary pixels belonging to the same steady-state feature in each layer are weighted and projected onto the spatial coordinate grid of the original grayscale image according to their respective fusion weights. The weighted grayscale values of all projected pixels are accumulated at each spatial coordinate position to generate the fused and reconstructed image. Extract the minimum bounding rectangle of all connected components in the fused and reconstructed image. Use the center coordinates of the minimum bounding rectangle as the location coordinates of the cardboard defect, and use the major and minor axes of the minimum bounding rectangle as the geometric contour of the cardboard defect.
Citation Information
Patent Citations
Improved semiconductor surface defect identification method based on topological data analysis
CN118521549A
Corrugated paper defect detection method and system based on machine vision
CN121458697A
Automobile part defect detection method based on multi-scale attention mechanism
CN122473160A
