Method and system for detecting defects on the surface coating of PVC flooring
By combining frequency domain analysis with adaptive filtering, the problem of stable detection of subtle scratches on the surface of highly reflective PVC flooring was solved. This method enables accurate segmentation and detection of subtle scratches, overcomes the problems of missed detection and computational redundancy in traditional methods, and improves the stability and efficiency of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG GIMIG TECH CO LTD
- Filing Date
- 2026-02-04
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies for detecting minor scratches on highly reflective PVC flooring suffer from poor stability, high false negative rates, and high computational costs. They also struggle to effectively suppress strong specular reflection interference and adaptively enhance and segment minor scratch signals from different directions.
A method combining frequency domain analysis and adaptive filtering is adopted. The original image of PVC flooring is acquired, preprocessed, and subjected to spectral transformation and analysis. The set of main direction angles of scratches in the frequency domain is extracted, and frequency domain filtering and inverse transformation are performed based on adaptive filter mask to finally segment the scratches.
It achieves accurate segmentation and detection of weak, randomly oriented scratches under strong interference, effectively overcoming the problems of missed detection and computational redundancy in traditional methods, and improving the stability and efficiency of detection.
Smart Images

Figure CN122243867A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of coating defect detection, and more specifically, to a method and system for detecting coating defects on the surface of PVC flooring. Background Technology
[0002] As a widely used floor covering material, the quality of the surface coating of PVC flooring directly determines the product's aesthetics, durability, and ultimate market value. Especially in the high-end market, PVC flooring with a high-gloss UV coating is highly favored for its excellent gloss and protective properties. However, precisely because of this highly smooth surface characteristic, some micron-sized scratches are inevitably generated during the production process. Although these scratches are small, they seriously affect the product's appearance consistency and overall quality, reducing the yield rate. Therefore, developing a stable and efficient method to detect these surface coating defects is of crucial practical significance for improving product quality and controlling production costs.
[0003] In actual testing, reliably detecting minute scratches on highly reflective PVC flooring surfaces faces significant technical challenges. First, the high-gloss UV coating produces strong specular reflection. When using traditional bright-field illumination, this reflected light easily saturates the camera sensor, creating large "glare zones." Scratch signals appearing in these areas, due to their inherent weakness, are completely drowned out by the strong background light, resulting in information loss at the imaging source. Second, micron-level scratches cause minimal changes to the surface morphology, resulting in minimal grayscale variations in the image compared to the background area. The signal strength may even be on the same order of magnitude as the sensor's own noise, exhibiting typical low signal-to-noise ratio characteristics, making effective extraction difficult using conventional image processing methods. Furthermore, scratches are generated completely randomly, with varying directions and shapes. Any detection scheme using a single fixed light source or a fixed filtering direction inevitably has "blind spots," easily missing scratches with specific orientations, leading to low reliability. Traditional frequency domain filtering methods, such as using a pre-set Gabor filter bank covering all directions, have some effect, but the computational load is huge, and the enhancement effect will be greatly reduced for scratches at non-pre-set angles, making it impossible to achieve adaptive detection.
[0004] Therefore, existing technologies suffer from poor stability, high false negative rates, and high computational costs when dealing with weak scratches with low contrast and random orientation against highly reflective backgrounds. To overcome these technical bottlenecks, there is an urgent need for a new method that can effectively suppress strong specular reflection interference and adaptively enhance and segment weak scratch signals from different directions, thereby achieving accurate, efficient, and stable detection of coating defects on PVC flooring surfaces. Summary of the Invention
[0005] To address the aforementioned problems in the prior art, according to one aspect of this application, a method for detecting defects in the surface coating of PVC flooring is provided, comprising: Acquire the original image of the PVC flooring to be inspected; The original image of the PVC flooring to be inspected is preprocessed to obtain a preprocessed image of the PVC flooring. Spectral transformation and analysis were performed on the preprocessed PVC flooring image to obtain the original complex spectrum and the set of principal direction angles of the scratches in the frequency domain. Adaptive anisotropic filtering is performed on the set of principal direction angles of the scratches in the frequency domain to obtain an adaptive filter mask; The original complex spectrum is filtered and inversely transformed in the frequency domain based on an adaptive filter mask to obtain an enhanced image of the PVC flooring with scratches. Scratch segmentation was performed on the scratch-enhanced PVC flooring image to obtain a defect list.
[0006] According to another aspect of this application, a PVC flooring surface coating defect detection system is provided, comprising: The PVC flooring original image acquisition module is used to acquire the original image of the PVC flooring to be inspected. The PVC flooring original image preprocessing module is used to preprocess the original image of the PVC flooring to be detected to obtain a preprocessed PVC flooring image. The spectrum transformation and analysis module is used to perform spectrum transformation and analysis on the preprocessed PVC flooring image to obtain the original complex spectrum and the set of principal direction angles of the scratch in the frequency domain. The adaptive filtering module is used to perform adaptive anisotropic filtering on the set of principal direction angles of the scratch in the frequency domain to obtain an adaptive filter mask. The frequency domain filtering and inverse transform module is used to perform frequency domain filtering and inverse transform on the original complex spectrum based on an adaptive filter mask to obtain the PVC floor image after scratch enhancement. The defect generation module is used to segment the scratches on the enhanced PVC flooring image to obtain a list of defects.
[0007] Compared with existing technologies, this application provides a method and system for detecting defects in PVC floor coatings. It solves the challenge of stable detection of weak scratches on highly reflective surfaces by combining frequency domain analysis with adaptive filtering. First, the original image containing strong specular reflection and low signal-to-noise ratio scratches is transformed to the frequency domain. Utilizing the principle that scratches, as linear structures, exhibit directional characteristics in the spectrum, they are separated from large-area low-frequency background noise and glare signals. This method does not rely on a preset filter but accurately identifies scratches in any direction in the current image through intelligent analysis of the image spectrum and extracts their principal direction angle. Subsequently, based on this real-time detected directional information, an adaptive anisotropic filter that perfectly matches it is dynamically constructed. This customized filter can accurately and selectively enhance the frequency components corresponding to the scratch direction in the spectrum while suppressing interference from other irrelevant frequencies. Finally, after filtering and inverse transformation, the characteristic signal of the scratch is significantly amplified, and the contrast is greatly improved, thus achieving accurate segmentation and detection of weak, randomly oriented scratches in a strong interference background, effectively overcoming the problems of missed detection and computational redundancy in traditional methods. Attached Figure Description
[0008] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain the application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0009] Figure 1 This is a flowchart of a method for detecting defects in the surface coating of PVC flooring according to an embodiment of this application.
[0010] Figure 2 This is a schematic diagram of the data flow in a PVC floor surface coating defect detection method according to an embodiment of this application.
[0011] Figure 3 This is a flowchart of step 2 in the PVC floor surface coating defect detection method according to an embodiment of this application.
[0012] Figure 4 This is a flowchart of step 3 in the PVC floor surface coating defect detection method according to an embodiment of this application.
[0013] Figure 5 This is a flowchart of step 4 in the PVC floor surface coating defect detection method according to an embodiment of this application.
[0014] Figure 6 This is a block diagram of a PVC floor surface coating defect detection system according to an embodiment of this application. Detailed Implementation
[0015] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0016] To address the challenge of consistently detecting subtle scratches on highly reflective surfaces, this application proposes a method for detecting defects in the coating of PVC flooring surfaces. Figure 1 This is a flowchart of a method for detecting defects in the surface coating of PVC flooring according to an embodiment of this application. Figure 2 This is a schematic diagram of the data flow in a PVC floor surface coating defect detection method according to an embodiment of this application. Figure 1 and Figure 2 As shown, the PVC flooring surface coating defect detection method according to an embodiment of this application includes: Step 1, acquiring an original image of the PVC flooring to be detected; Step 2, preprocessing the original image of the PVC flooring to be detected to obtain a preprocessed PVC flooring image; Step 3, performing spectral transformation and analysis on the preprocessed PVC flooring image to obtain the original complex spectrum and the set of principal direction angles of the scratches in the frequency domain; Step 4, performing adaptive anisotropic filtering on the set of principal direction angles of the scratches in the frequency domain to obtain an adaptive filter mask; Step 5, performing frequency domain filtering and inverse transformation on the original complex spectrum based on the adaptive filter mask to obtain a scratch-enhanced PVC flooring image; Step 6, performing scratch segmentation on the scratch-enhanced PVC flooring image to obtain a defect list.
[0017] In step 1, the original image of the PVC flooring to be inspected is acquired. It should be understood that in the automated inspection process for surface coating defects on PVC flooring, all complex analysis and judgment begin with the digital conversion of the physical world object. Because the subtle scratches on the surface of high-gloss PVC flooring are extremely minute in physical form and easily masked by strong specular reflection, any subsequent defect enhancement, identification, and segmentation algorithms rely on a digital image that can accurately and stably capture these original features. If the initial image acquisition quality is poor, such as due to overexposure, defocusing, or geometric distortion, then the defect information is lost or distorted at the source. Therefore, setting the step of acquiring the original image of the PVC flooring to be inspected at the beginning of the entire inspection process is to construct a high-fidelity digital copy, accurately converting the physical light signal carrying all surface information, including subtle scratches, into reliable initial data that can be used by the computer for subsequent processing and analysis.
[0018] In one possible implementation, step 1 is as follows: To acquire the original image of the PVC flooring to be inspected, a sophisticated machine vision image acquisition device needs to be constructed. This device is deployed on the PVC flooring production line, and its surface is imaged as the flooring enters the inspection station via a conveyor. Specifically, the device includes an industrial line-scan camera, a telecentric lens, a structured light source, and a synchronization control module. The PVC flooring to be inspected passes beneath the camera's field of view at a preset speed, such as 0.5 meters per second, driven by a uniformly moving conveyor belt. A high-resolution monochrome line-scan CMOS camera, such as a line-scan sensor with 8192 pixel units, is selected to ensure sufficient detail across the width of the flooring. A monochrome camera is chosen because it is more sensitive to grayscale changes, which is beneficial for identifying scratches with extremely low contrast. Matched to the camera is a large field-of-view telecentric lens, whose function is to eliminate perspective errors and magnification variations that may be caused by slight height variations or positional shifts in the flooring, ensuring scale consistency throughout the entire imaging area.
[0019] Illumination is a crucial step in this process. To address the strong specular reflection issue mentioned in the background section, a low-angle dark-field illumination scheme is employed. Specifically, two linear LED light sources are installed on either side of the conveyor belt, parallel to the direction of floor movement, illuminating the floor surface at a grazing angle of 15 to 30 degrees. Under this illumination geometry, the perfectly smooth UV-coated surface reflects light mirror-like away from the camera lens, resulting in a uniformly dark background in the camera. However, when light encounters a scratch—a recessed or raised structure—diffuse reflection occurs, scattering some light into the camera lens, making the scratch appear as a bright line against the dark background. The intensity of the light source needs to be precisely calibrated to ensure that the grayscale value of the background area remains stable in the low range of 20 to 40 within an 8-bit grayscale image (0 to 255), while the grayscale value of the scratch signal stands out above 100, while preventing any pixel from reaching the saturation value of 255 due to excessive brightness.
[0020] The image acquisition process is synchronously triggered by a rotary encoder linked to the conveyor belt's main shaft. The encoder generates precise pulse signals based on the conveyor belt's displacement; for each pulse, the camera acquires one line of pixel data. This external hardware triggering mechanism ensures that the image resolution along its length remains constant regardless of minute fluctuations in the conveyor belt speed, resulting in geometrically accurate images free from stretching or compression distortion. The acquired continuous linear array data stream is transmitted in real-time to an industrial computer via an image acquisition card and stitched line by line to form a complete two-dimensional image. This image is the original image of the PVC flooring to be inspected. For example, for a flooring 1 meter wide and 2 meters long, the final original image might be an 8-bit single-channel grayscale image with a width of 8192 pixels and a length of 16384 pixels. This image, in the form of a digital matrix, fully records the surface optical response of the flooring under specific dark-field illumination, including the original signals of the subtle scratches to be detected.
[0021] In step 2, the original image of the PVC flooring to be inspected is preprocessed to obtain a preprocessed PVC flooring image. Accordingly, before performing core defect analysis on the acquired original image of the PVC flooring to be inspected, it is recognized that the original data itself is not in an optimal analytical state. On the one hand, the original image size is often very large, and directly performing complex frequency domain transformations on it would bring a huge computational burden, affecting detection efficiency. On the other hand, when performing Fourier transforms on any image of finite size, its boundaries are treated as discontinuous cliffs by the mathematical model. This discontinuity introduces a large number of interference artifacts unrelated to real defects into the spectrum, i.e., spectral leakage. This phenomenon can severely pollute the spectrum, potentially drowning out the real signal of weak scratches with false frequency components. Therefore, preprocessing is performed to standardize and optimize the original image, ensuring computational efficiency and consistency through size normalization, and suppressing spectral distortion caused by boundary effects through windowing, laying a clean and reliable data foundation for subsequent accurate spectral analysis and defect identification.
[0022] In one possible implementation, Figure 3 This is a flowchart of step 2 in the PVC flooring surface coating defect detection method according to an embodiment of this application. Figure 3 As shown, step 2, preprocessing the original image of the PVC flooring to be detected to obtain a preprocessed PVC flooring image, includes: step 21, normalizing and filling the original image of the PVC flooring to be detected to obtain a normalized PVC flooring image; step 22, windowing the normalized PVC flooring image to obtain the preprocessed PVC flooring image.
[0023] In the above implementation, step 2 is as follows: The first step is step 21, which involves normalizing and padding the original image of the PVC floor to be detected to generate a normalized PVC floor image. The goal is to convert the original large, non-square image into a square image of moderate size that is a power of 2, so as to facilitate the subsequent efficient Fast Fourier Transform. The target size chosen here is 1024 pixels multiplied by 1024 pixels, which is a dimension highly suitable for the radix-2 algorithm commonly used in Fast Fourier Transform, thereby maximizing the computational speed. First, in order to maintain the original geometric proportions of features such as scratches during scaling, it is necessary to maintain the original aspect ratio of the image. This fidelity is crucial because any geometric deformation will change the perceived direction and shape of linear scratch features, resulting in serious bias in subsequent directional analysis. When calculating the scaling factor, the longer side of the original image (16384 pixels) is used as a reference, and it is scaled to the target size of 1024 pixels, with a scaling ratio of 1024 divided by 16384, i.e., 1 / 16. Applying this ratio to both dimensions of the original image, the scaled image size is (8192 / 16) pixels multiplied by (16384 / 16) pixels, or 512 pixels multiplied by 1024 pixels. During the scaling operation, a bicubic interpolation algorithm is used to calculate the grayscale value of each pixel in the new image. This algorithm examines a 4×4 neighborhood of pixels in the original image and fits the local pixel grid by constructing a smooth surface function. Compared to simple bilinear interpolation, it can more accurately estimate the intensity of the new pixels, thus excellently preserving the image's fine texture. After scaling, a zero-fill procedure is performed. A 1024-pixel by 1024-pixel canvas with a completely black background is created, with all pixels having a grayscale value of 0. Then, the previously generated 512-pixel by 1024-pixel image is placed in the center of this canvas. Specifically, the image occupies the central area of the canvas vertically, while horizontally, due to the size matching, it completely fills the space. This leaves black fill bands (1024-512) / 2 = 256 pixels wide) above and below the image, ensuring the scaled image is perfectly centered within the 1024×1024 frame. The added zero-value pixels provide a neutral and undisturbed boundary. The final output after this processing is the size-normalized PVC floor image, a 1024×1024 pixel matrix containing the proportionally scaled and centered original floor image information.
[0024] The second step, step 22, involves windowing the size-normalized PVC flooring image to obtain a preprocessed PVC flooring image. The aim is to smoothly attenuate the image intensity values towards its boundaries, thereby eliminating the severe discontinuities at the boundaries caused by the periodic extension of the image assumed by the Fourier transform. These discontinuities can generate a large number of spurious high-frequency components, i.e., spectral leakage. The Hanning window function is chosen here because it achieves an excellent balance between the main lobe width and side lobe attenuation, effectively suppressing spectral leakage while minimizing the impact on the frequency resolution of the real defect signal. A two-dimensional Hanning window function is itself a matrix of the same size as the image to be processed, in this case, a 1024×1024 matrix. The value of each element in the matrix is determined by its coordinates (x, y), ranging from 0 to 1. The value at the center point (511, 511) of the window function matrix is 1, and it smoothly and non-linearly attenuates towards the edges until the value at the matrix boundaries is 0. The two-dimensional Hanning window function W(x,y) can be obtained by multiplying two one-dimensional Hanning windows. Its generation formula is W(x,y)=[0.5*(1-cos(2*π*x / 1023))]*[0.5*(1-cos(2*π*y / 1023))], where x and y represent pixel indices from 0 to 1023 along their respective coordinate axes. The specific windowing operation involves multiplying the 1024×1024 normalized PVC flooring image matrix obtained in the previous step with this 1024×1024 Hanning window function matrix pixel by pixel. In other words, the pixel value at any coordinate (x, y) in the preprocessed PVC floor image is equal to the pixel value at (x, y) of the size-normalized PVC floor image multiplied by the value of the Hanning window function at (x, y). This effectively creates a smooth intensity attenuation ramp from the image center to the edge, ensuring seamless transition during the periodic extension of the Fourier transform and avoiding abrupt numerical changes. After this operation, the pixel values in the edge regions of the original image approach black due to multiplication by a window function coefficient close to 0, while the pixel values in the center region remain essentially unchanged due to multiplication by a coefficient close to 1, resulting in a smooth transition from the center to the edge. The resulting 1024×1024 image is the final preprocessed PVC floor image. Visually, it presents an effect where the center is clear and the edges gradually fade into darkness.
[0025] In step 3, the preprocessed PVC flooring image undergoes spectral transformation and analysis to obtain the original complex spectrum and the set of principal direction angles of the scratches in the frequency domain. It is understandable that after preprocessing, although the image size is standardized and boundary effects are suppressed, the weak scratch signals contained within are still mixed with background texture, noise, and other information in the spatial domain. Direct segmentation on such an image is prone to significant false negatives and false negatives due to difficulties in setting thresholds. However, scratches, as structures with a clear linear directionality, exhibit a distinctive and highly concentrated energy distribution in the frequency domain. Therefore, this application performs spectral transformation and analysis to map the image from the intuitive spatial domain to the frequency domain, which reveals its inherent structure and periodic characteristics, thereby transforming the spatially difficult-to-separate scratch signals into clearly discernible directional features in the frequency domain.
[0026] In one possible implementation, Figure 4 This is a flowchart of step 3 in the PVC flooring surface coating defect detection method according to an embodiment of this application. Figure 4 As shown, step 3 involves performing spectral transformation and analysis on the preprocessed PVC floor image to obtain the original complex spectrum and the set of principal direction angles of the scratch in the frequency domain. This includes: step 31, performing a fast Fourier transform on the preprocessed PVC floor image to obtain the original complex spectrum; step 32, performing logarithmic energy spectrum analysis on the original complex spectrum to obtain an analyzable spectral image; and step 33, performing parameter space transformation and direction extraction on the analyzable spectral image to obtain the set of principal direction angles of the scratch in the frequency domain.
[0027] In the above implementation, step 3 is as follows: The first step, step 31, is to perform a Fast Fourier Transform (FFT) on the preprocessed PVC floor image to obtain the original complex spectrum. The preprocessed PVC floor image is a two-dimensional real matrix in data form, where each element represents the pixel grayscale value at the corresponding position. The core of this step is to apply the two-dimensional Fast Fourier Transform algorithm, which is an algorithm for efficiently calculating the Discrete Fourier Transform, especially suitable for cases where the input data dimension is an integer power of 2. Specifically, the 1024×1024 preprocessed PVC floor image matrix is used as the input to the two-dimensional Fast Fourier Transform function. Mathematically, this transformation process decomposes the image function into a weighted sum of a series of sine and cosine waves of different frequencies and directions. The result of the transformation, i.e., the output, is a 1024×1024 two-dimensional matrix with the same size as the input image, which is the original complex spectrum, denoted as F(u,v). Unlike the original image matrix, each element F(u,v) in this output matrix is no longer a real number representing the grayscale value, but a complex number. The complex number F(u,v) = a + bi contains rich frequency domain information. The coordinates (u,v) represent a specific frequency point in the frequency domain, where u corresponds to the frequency in the horizontal direction and v corresponds to the frequency in the vertical direction. The origin (0,0) corresponds to the zero frequency, i.e., the DC component, whose value is related to the average brightness of the image. The modulus of this complex number, i.e., its amplitude |F(u,v)| = sqrt(a² + b²), represents the energy or intensity of this specific frequency (u,v) component in the original image. If the original image contains a large number of periodic structures along a certain direction (such as scratches), then the amplitude value at the corresponding frequency point in the frequency domain will be significantly higher. The argument of this complex number, i.e., its phase ∠F(u,v) = atan²(b,a), records the spatial position information of this frequency component. For example, when a preprocessed 1024×1024 image of a PVC floor is input into a Fast Fourier Transform (FFT) algorithm, a 1024×1024 complex matrix F(u,v) is obtained. If there is a faint, approximately vertical scratch in the original image, the scratch will exhibit a slow grayscale change in the vertical direction, but a sharp jump in the horizontal direction. This structure corresponds to the high-frequency components in the horizontal direction in the frequency domain. Therefore, in the obtained original complex spectrum F(u,v), along the u-axis (i.e., the horizontal frequency axis) away from the origin, a series of points with high amplitude values |F(u,v)| will appear. Connecting these points will form an approximately horizontal bright line. This complete 1024×1024 complex matrix, containing the amplitude and phase information of all frequency components, is the original complex spectrum. It is not only the basis for subsequent spectral analysis but also retains all the information used for the final image reconstruction.
[0028] The second step is step 32, logarithmic energy spectrum analysis. In one possible implementation, step 32, performing logarithmic energy spectrum analysis on the original complex spectrum to obtain an analyzable spectral image, includes: step 321, taking the modulus of each element of the original complex spectrum to obtain an amplitude spectrum; step 322, performing a logarithmic transformation on the amplitude spectrum to obtain a logarithmic amplitude spectrum; and step 323, spectral centering of the logarithmic amplitude spectrum to obtain an analyzable spectral image.
[0029] First, step 321 takes the modulus of each element of the original complex spectrum to obtain the amplitude spectrum. This is the foundation for frequency domain analysis visualization, extracting the core information representing the energy intensity from the complex representation of each frequency point. Specifically, it iterates through each element of the original complex spectrum matrix F(u,v). For any complex element F(u,v) = a + bi with coordinates (u,v), its modulus, i.e., the amplitude A(u,v), is calculated using the formula A(u,v) = |F(u,v)| = sqrt(a² + b²). This calculation generates a new 1024 × 1024 matrix, the amplitude spectrum A(u,v), where all elements are non-negative real numbers. At this stage, phase information is discarded because, for the scratch direction recognition task, the key is to determine which frequency directions have significant energy concentrations, rather than the precise spatial locations of these frequency components in the original image. For example, in the aforementioned image containing vertical scratches, the original complex spectrum F(u,v) contains a series of elements with large complex values near the horizontal frequency axis (u-axis). After modulo operation, these positions will correspond to large real values in the amplitude spectrum A(u,v), while the values in other regions will be relatively small. However, if the amplitude spectrum A(u,v) is displayed directly as an image, it will be found that except for the zero-frequency point in the corner (whose amplitude value may be as high as millions) which appears as an extremely bright point, the rest of the area is almost completely black. The energy signal corresponding to the scratch is compressed to an invisible gray level because its value is too large compared to the zero-frequency point.
[0030] Next, step 322 performs a logarithmic transformation on the amplitude spectrum to obtain the logarithmic amplitude spectrum, thus solving the aforementioned dynamic range problem. This aims to non-linearly adjust the distribution of spectral energy, allowing high and low frequency signals to be observed and analyzed on the same visual scale. Specifically, the logarithmic transformation formula is applied to each element of the amplitude spectrum A(u,v) matrix: Slog(u,v) = log(1 + A(u,v)). Here, log refers to the natural logarithm. The "1+" operation in the formula is crucial; it's a standard procedure to ensure numerical stability. Since there may be elements with a value of 0 in the amplitude spectrum, and log(0) is mathematically undefined, adding 1 ensures that the input to the logarithmic function is always positive, avoiding calculation errors. Simultaneously, it maps the case of A(u,v) = 0 to Slog(u,v) = 0. The core characteristic of the logarithmic function lies in its numerical compression effect: for large input values, its output grows slowly; for small input values, its output is relatively sensitive. Using the previous example, if the amplitude A(0,0) at the zero-frequency point is 1,000,000, while the amplitude at the high-frequency point corresponding to the scratch is 1,000, the ratio of the two without transformation is 1000:1. After logarithmic transformation, log(1+1,000,000) is approximately 13.8, while log(1+1,000) is approximately 6.9. The ratio is drastically compressed to approximately 2:1. This transformation greatly narrows the numerical gap between high-energy and low-energy components. After performing a pixel-by-pixel logarithmic transformation on the entire 1024×1024 amplitude spectrum matrix, the output is a new 1024×1024 real matrix, the logarithmic amplitude spectrum Slog(u,v).
[0031] Step 323 then centers the logarithmic amplitude spectrum to obtain a spectral image suitable for analysis. This is a purely geometric rearrangement aimed at converting the spectrum representation from the algorithm's default format to one that aligns more with physical intuition and analytical habits. The standard Fast Fourier Transform (FFT) algorithm places the zero-frequency component (DC component) at position (0,0) in the output matrix, i.e., the top-left corner. Accordingly, the spectrum is divided into four quadrants, located at the four corners of the matrix. For easier analysis, this zero-frequency point needs to be moved to the center of the image. In practice, a cyclic shift operation called "fftshift" is used. For a 1024×1024 logarithmic amplitude spectrum Slog(u,v), it is logically divided into four 512×512 sub-blocks (quadrants). Then, the top-left quadrant is swapped with the bottom-right quadrant, and simultaneously, the top-right quadrant is swapped with the bottom-left quadrant. After this rearrangement, the zero-frequency point originally located at (0,0) is moved to the center point of the matrix (512,512). All low-frequency components cluster around this new center, and the frequency increases with distance from the center. For the aforementioned example of a vertical scratch, it appears in the logarithmic amplitude spectrum as a horizontal bright line near the top and bottom edges (because the u-axis is coiled). After the centering operation, this bright line is pieced together into a complete horizontal bright line passing through the center of the spectrum. This final 1024×1024 real matrix, after undergoing modulo, logarithmic transformation, and centering, is the spectral image sc(u,v) available for analysis. It perfectly presents the directional features of the original image in a clear, intuitive, and structured manner.
[0032] The third step, step 33, involves performing parameter space transformation and direction extraction. In one possible implementation, step 33, which involves performing parameter space transformation and direction extraction on the analyzable spectral image to obtain the set of principal direction angles of the scratch in the frequency domain, includes: step 331, performing a Hough transform on the analyzable spectral image to obtain a Hough accumulator matrix; step 332, performing peak detection and filtering on the Hough accumulator matrix to obtain a filtered set of peaks; and step 333, extracting all angular components from the filtered set of peaks to obtain the set of principal direction angles of the scratch in the frequency domain.
[0033] First, step 331 involves performing a Hough transform on the spectral image available for analysis to obtain the Hough accumulator matrix. The Hough transform is a powerful feature extraction technique. Its core idea is to map pixels with the same features in image space to a point in parameter space through a coordinate transformation. For line detection, it transforms a straight line in the Cartesian coordinate system (u,v) into a point in the polar coordinate parameter space (ρ,θ). Here, θ is the angle between the normal to the line and the horizontal axis, and ρ is the perpendicular distance from the origin to the line. Conversely, a point in image space corresponds to a sine curve in parameter space, and all points (ρ,θ) on the curve represent a possible straight line passing through that image point. When multiple points in image space are collinear, the multiple sine curves corresponding to them in parameter space will inevitably intersect at the same point, which represents this shared straight line. In practice, the input spectral image for analysis first needs to be binarized to determine which pixels belong to the feature points that need to be transformed. This process is accomplished by setting a grayscale threshold; only pixels with grayscale values higher than this threshold are considered valid points constituting energy spectral lines. This threshold can be set as a percentage of the image's maximum grayscale value, such as 70%, to filter out background noise and retain only the most significant energy concentration areas. Next, a two-dimensional Hough accumulator matrix H(ρ,θ) is created, and all its elements are initialized to 0. The dimension of this matrix is determined by the range and precision of the parameters ρ and θ. For θ, its range is set to 0 to 180 degrees, and the precision can be set to 1 degree, resulting in an accumulator matrix with 180 columns. For ρ, its theoretical maximum value is half the length of the image diagonal. For a 1024×1024 centered spectrum, ρ ranges approximately -724 to +724 pixels, and the precision can be set to 1 pixel, resulting in an accumulator matrix with approximately 1449 rows. Then, each white pixel (u', v') in the binarized spectral image is iterated over, representing its coordinates relative to the image center (512, 512). For each pixel, all possible angles θ (from 0 to 179 degrees) are iterated over, and the corresponding ρ value is calculated using the formula ρ = u' * cos(θ) + v' * sin(θ). For each calculated pair of (ρ, θ), 1 is incremented at the corresponding position in the Hough accumulator matrix H(ρ, θ). This process is equivalent to having each feature point vote for all possible lines that cross it. After iterating over all feature points, the higher the value in the accumulator matrix H(ρ, θ), the more collinear points its corresponding line has in the original spectral image, meaning the line is more likely to exist. This final H(ρ, θ) matrix is the Hough accumulator matrix.
[0034] Next, step 332 involves peak detection and filtering of the Hough accumulator matrix to obtain a filtered set of peaks. In the Hough accumulator matrix, each local peak point corresponds to a significant straight line in the spectral image. Peak detection is achieved through a search algorithm; for example, a point H(ρi,θi) is identified as a peak if its value is greater than the values of all other points in its surrounding neighborhood, such as within a 5×5 window. However, not all detected straight lines are related to scratches. According to the properties of the Fourier transform, the energy spectral lines generated by a linear structure (scratch) in the spatial domain will cross the center of the frequency domain, i.e., the location of the DC component. Therefore, the detected peaks need to be filtered, retaining only those peaks representing straight lines crossing the center of the spectrum. A straight line crossing the origin must have a ρ value of 0 in the Hough parameter space. Considering the discretization of digital images and the small offsets that noise may introduce, the filtering condition is set to a small distance threshold. That is, only peaks with an absolute ρ value less than the distance threshold are retained. Determining the distance threshold requires a trade-off between tolerance and accuracy. For a 1024×1024 image, a typical setting is 5 pixels. This value is sufficient to accommodate deviations from the center of the line due to pixel discretization and minor computational errors, while effectively eliminating accidental linear noise unrelated to scratches and not crossing the center of the spectrum. For example, if three peaks are detected (ρ=2, θ=45°), (ρ=150, θ=90°), and (ρ=-4, θ=135°), with a distance threshold of 5, the second peak will be discarded because the line it represents is too far from the center of the spectrum. The final set of retained peaks is the filtered peak set.
[0035] Then, step 333 extracts all angular components from the filtered peak set to obtain the set of principal direction angles of the scratch in the frequency domain. After the rigorous filtering in the previous step, each remaining peak (ρi, θi) corresponds with high confidence to an energy spectral line of a scratch in the frequency domain. At this point, it is only necessary to traverse this filtered peak set and extract the angular component θi of each peak. Combining all the extracted angle values into a set yields the set of principal direction angles of the scratch in the frequency domain, denoted as {θ1, θ2, ..., θk}. For example, if the filtered peak set is {(ρ=2, θ=45°), (ρ=-4, θ=135°)}, then the final output angle set is {45°, 135°}. This set accurately and quantitatively describes the directional characteristics of all the subtle scratches present in the current PVC floor image in the frequency domain.
[0036] In step 4, adaptive anisotropic filtering is applied to the set of principal direction angles of the scratches in the frequency domain to obtain an adaptive filter mask. It should be understood that after successfully extracting the set of principal direction angles of the scratches in the frequency domain, although the fingerprint information of the defect has been accurately grasped, these angles themselves cannot be directly used to enhance the image. They are merely parameters and need to be transformed into a practically operable tool. Traditional filtering methods, such as applying a fixed set of filters covering all possible directions, are not only computationally intensive, but also significantly reduce their enhancement effect for precise angles not covered by the preset parameters. To overcome this blindness and inefficiency, a dedicated filter needs to be dynamically and instantly constructed based on the angle information detected in real time. Therefore, performing adaptive anisotropic filtering on the set of principal direction angles can synthesize abstract angle parameters into a specific, customized frequency domain filter mask. This mask will act like a precise mold, perfectly matching the frequency domain features of all scratches in the current image.
[0037] In one possible implementation, Figure 5 This is a flowchart of step 4 in the PVC flooring surface coating defect detection method according to an embodiment of this application. Figure 5 As shown, step 4, which involves adaptively anisotropically filtering the set of principal direction angles of the scratch in the frequency domain to obtain an adaptive filter mask, includes: step 41, generating spectral coordinate pairs and an aggregated filter mask based on the spectral dimension; step 42, extracting the first principal direction angle from the set of principal direction angles of the scratch in the frequency domain; step 43, performing anisotropic Gabor kernel function synthesis on the spectral coordinate pairs in each direction based on the first principal direction angle and the filter parameter set to obtain a single-direction mask; and step 44, performing pixel-by-pixel maximum value iterative fusion of the single-direction mask and the current aggregated filter mask to obtain the adaptive filter mask.
[0038] In the above implementation, step 4 is as follows: The first step is step 41. The spectrum dimension directly inherits the size of the spectrum matrix processed in all previous steps. In the aforementioned embodiment, the size of the preprocessed image is normalized to 1024 pixels multiplied by 1024 pixels, so its Fourier transform spectrum dimension is also 1024×1024. Therefore, the spectrum dimension here is (1024, 1024). The specific implementation process first generates a coordinate grid, assigning each point in the frequency domain a Cartesian coordinate with the center of the spectrum as the origin. This is the basis for all subsequent calculations of mathematical functions based on spatial location (such as the Gabor kernel function). Based on the input spectrum dimension (1024, 1024), two coordinate matrices of size 1024×1024 need to be generated, denoted as U and V respectively. Matrix U is used to store the horizontal coordinate of each point, and matrix V is used to store the vertical coordinate of each point. Since the spectrum has been centered, its zero frequency point is located at (512, 512), so the origin of the coordinate system should also be at this location. To achieve this, matrix U is generated such that all elements in its j-th column have a value of j - 512, where j ranges from 0 to 1023. Thus, the first column (j=0) of matrix U has all elements of -512, the center column (j=512) has all elements of 0, and the last column (j=1023) has all elements of +511. Similarly, matrix V is generated such that all elements in its i-th row have a value of i - 512, where i ranges from 0 to 1023. Thus, the first row (i=0) of matrix V has all elements of -512, the center row (i=512) has all elements of 0, and the last row (i=1023) has all elements of +511. The resulting 1024×1024 matrices U and V together form a frequency coordinate pair. For any point in the frequency domain with index (i,j), its coordinates (u,v) relative to the center can be directly obtained using (U(i,j),V(i,j)). Next, the aggregation filter mask is initialized. This is a preparatory step, designed to create a canvas for drawing and fusing sub-filters for different scratch directions in subsequent steps. Specifically, a 1024×1024 matrix with the exact same coordinate grid size is created, and all its elements are initialized to 0.0. This matrix must be of floating-point data type because it will store continuous values between 0 and 1 for the filter responses. This all-zero matrix is denoted as H0(u,v), the aggregation filter mask. Initially, it is a completely transparent filter with no filtering capability. In subsequent iterations, for each angle extracted from the set of main direction angles, a corresponding single-direction mask is generated, and this single-direction mask is then superimposed on the current aggregation filter mask.In this way, H0(u,v) will gradually evolve from an all-zero matrix into a complex composite filter that contains all scratch direction enhancement information.
[0039] The second step, step 42, is to extract the first principal direction angle from the set of principal direction angles of the scratch in the frequency domain. Continuing from the previous embodiment, the angle set obtained through steps such as Hough transform is {45°, 135°}. Here, we first extract the first angle in this set, i.e., θ1 = 45°.
[0040] The third step, step 43, involves synthesizing anisotropic Gabor kernel functions in each direction based on the first principal direction angle θ1 and the preset filter parameter set to obtain a single-direction mask. In one possible implementation, step 43, synthesizing anisotropic Gabor kernel functions in each direction based on the first principal direction angle and the filter parameter set to obtain a single-direction mask, includes: step 431, rotating the spectral coordinates based on the first principal direction angle to obtain the rotated coordinates; step 432, calculating the real part of the Gabor filter response based on the rotated coordinates and the filter parameter set to obtain the anisotropic Gaussian envelope and cosine wave; and step 433, multiplying the anisotropic Gaussian envelope and cosine wave to obtain the single-direction mask.
[0041] The filter parameter set is a predefined set of constants that collectively define the shape and response characteristics of the Gabor filter. Its values are empirically set based on the typical physical characteristics of the scratch to be detected (such as width and contrast) and the size of the spectral image. This parameter set includes: a center frequency f0, which corresponds to the typical width of the scratch in the spatial domain; here, it can be set to 100.0 (indicating that the filter is most sensitive to frequencies 100 pixels from the center of the spectrum); the Gaussian standard deviation σu' along the principal direction, which controls the filter's bandwidth along the energy spectral lines and should be set relatively large to accommodate a range of scratch width variations, for example, σu' = 50.0; and the Gaussian standard deviation σv' along the orthogonal direction, which controls the filter's sensitivity to direction and must be set relatively small to achieve precise directional selectivity, for example, σv' = 5.0. First, in step 431, the frequency coordinate pair (U,V) is rotated based on the first principal direction angle θ1 = 45° to obtain a new coordinate system (u',v') with this angle as the principal axis, simplifying the complex two-dimensional Gabor function calculation into a one-dimensional calculation along the new coordinate axis. The rotation is applied to each corresponding element pair (u,v) in the U and V matrices using the following formulas: u' = u*cos(45°) + v*sin(45°) and v' = -u*sin(45°) + v*cos(45°). This generates two new 1024×1024 matrices U' and V', representing the coordinates of each point in the frequency domain in the new coordinate system rotated by 45 degrees. Then, in step 432, the real part of the Gabor filter's response is calculated based on the rotated coordinate matrices U' and V' and the filter parameter set. This response consists of two parts. The first part is the anisotropic Gaussian envelope, calculated using the following formula: ,in This represents element-wise squaring. Since σu'(50.0) is much larger than σv'(5.0), this Gaussian envelope will be very flat and broad in the new u' axis direction, and very thin and sharp in the v' axis direction, forming a ridge shape along the u' axis (i.e., the 45-degree direction). The second part is the cosine wave, which is calculated by the formula C=cos(2π*f0*U'). This will generate a cosine ripple propagating along the u' axis direction in the entire frequency domain, the frequency of which is determined by f0. Finally, in step 433, the anisotropic Gaussian envelope and the cosine wave are multiplied to obtain a single-direction mask. Specifically, the two 1024×1024 matrices E and C obtained in the previous step are multiplied pixel by pixel: G1(u,v)=E⊙C. The resulting 1024×1024 matrix G1(u,v) is the single-direction mask for the 45-degree direction. Visually, it appears as a narrow, elongated strip filter along a 45-degree direction in the frequency domain, containing bright and dark fringes determined by cosine waves. The mask value is highest in the 45-degree direction, approximately 100 pixels from the center, and rapidly decays to near zero in other areas, thus exhibiting high directional and frequency selectivity. This step is repeated for each principal directional angle in the set of principal directional angles of the scratch in the frequency domain; for example, 135 degrees is extracted next, and the above process is repeated to generate a second single-directional mask G2(u,v).
[0042] Step 44 is an iterative update process that cyclically merges newly generated single-direction masks into the current aggregated filter mask. The current aggregated filter mask is a 1024×1024 matrix H0(u,v) created and initialized to all zeros at the start of the iteration (i.e., in step 41). It is updated in each iteration, recording information about all merged direction masks up to the current iteration. For example, the scratch angle set is {45°, 135°}. In the first iteration, a single-direction mask G1(u,v) for the 45-degree direction has been generated. The input at this point is: the current aggregated filter mask, i.e., the initial all-zero matrix H0(u,v), and the first single-direction mask G1(u,v). The processing involves comparing these two 1024×1024 matrices pixel by pixel. For each coordinate point (u,v) in the frequency domain, H1(u,v) = max{H0(u,v), G1(u,v)} is calculated. Since all elements of H0(u,v) are 0, the result of this operation is actually H1(u,v) = G1(u,v). At this point, the aggregated filter mask is updated to H1(u,v), which contains the filtering information for the first scratch direction. Next, the second iteration begins. First, following the method in step 43, a single-direction mask G2(u,v) is generated for the second angle 135° in the angle set. Then, the fusion operation in step 44 is performed. The inputs at this point are: the current aggregated filter mask, i.e., H1(u,v) updated in the previous step, and the newly generated single-direction mask G2(u,v). The maximum value comparison is performed pixel by pixel again. For each coordinate point (u,v), H2(u,v) = max{H1(u,v),G2(u,v)} is calculated. In this process, if a point (u,v) lies within the response region of the 45-degree filter but outside the response region of the 135-degree filter, then the value of H1(u,v) will be greater than G2(u,v) (close to 0), and H2(u,v) will retain the value of H1(u,v). The reverse is also true. If a point lies precisely within the intersection of the responses of the two filters, H2(u,v) will take the larger of the two values. Since all angles in the scratch angle set {45°, 135°} have been processed, the H2(u,v) obtained after this iteration is the final adaptive filter mask. Visually, this mask presents an X-shape, smoothly fused from two bandpass filters along the 45-degree and 135-degree directions respectively. This final 1024×1024 matrix precisely defines the region in the frequency domain that needs to be enhanced.
[0043] In step 5, the original complex spectrum is frequency-domain filtered and inversely transformed based on the adaptive filter mask to obtain the PVC floor image enhanced with scratches. Correspondingly, the original complex spectrum contains all the information of the original image; it includes the scratch signal to be detected, but also contains a large amount of background, noise, and other irrelevant information. The adaptive filter mask is only open in the frequency region corresponding to the scratch features. However, these two are still separate. To truly enhance the scratches, the mask needs to be applied to the original spectrum to perform a precise screening. Therefore, the theoretical filtering design is transformed into a practical signal processing operation. By multiplying the mask by the spectrum, irrelevant background is suppressed and the scratch signal is highlighted. Then, the purified and enhanced frequency domain information is transformed back into a visually clear spatial domain image with significantly amplified scratch features through inverse Fourier transform, providing high-quality input for the final defect segmentation.
[0044] In one possible implementation, step 5 is as follows: The first step is a frequency domain filtering operation, applying an adaptive filter mask to the original complex spectrum. Specifically, the original complex spectrum F(u,v) is multiplied element-wise with the adaptive filter mask H(u,v) to generate a filtered complex spectrum Ffiltered(u,v). The calculation formula is: For each coordinate point (u,v) in the frequency domain, the original complex spectrum value F(u,v) at that point is multiplied by the corresponding mask value H(u,v) at that point. In this example, the adaptive filter mask H(u,v) is an X-shaped matrix with high response values (close to 1) in the 45-degree and 135-degree directions, and response values close to 0 in other regions. When performing the dot product, the original complex value F(u,v) of the frequency components located within this X-shaped region is largely preserved because it is multiplied by a coefficient close to 1. The original complex values of the frequency components in all other regions are greatly attenuated, almost eliminated, because they are multiplied by a coefficient close to 0. This effectively suppresses low-frequency information such as background texture and uneven lighting that are independent of the scratch direction, as well as high-frequency information such as random noise, leaving only the specific frequency band information matching the scratch direction intact in the new filtered complex spectrum.
[0045] The second step is the inverse transform and post-processing, which aims to convert the filtered frequency domain information back into a spatial domain image. This stage contains three consecutive sub-steps. First, an inverse spectrum centering operation, i.e., IFTshift, is performed on the filtered complex spectrum. This is because the zero frequency of the filtered complex spectrum is located at the center, while the standard inverse fast Fourier transform algorithm requires the zero frequency to be located at a corner of the matrix. This operation restores the spectrum format to the standard state required by the algorithm by swapping the four quadrants of the matrix. Next, a two-dimensional inverse fast Fourier transform (IFFT) is performed on the shifted spectrum. This mathematical transformation is the inverse process of the forward Fourier transform, which resynthesizes the complex data in the frequency domain into image data in the spatial domain. Due to the precision limitations of numerical computation, the result of the inverse transform is a 1024×1024 complex matrix, even though theoretically the result should be real numbers. Finally, the real part is extracted from this complex image matrix as the final output image. The imaginary part of the complex result represents tiny numerical noise generated during the calculation and should be discarded. Taking the real part yields a 1024×1024 real matrix, which is the image of the PVC floor after scratch enhancement. In this final image, the previously faint scratches with extremely low contrast and submerged in the background are now presented as very clear and bright lines, while the original background becomes very dark and uniform.
[0046] Specifically, after constructing the adaptive filter mask, frequency domain filtering and inverse transform are the core steps in achieving scratch enhancement. While standard processing methods are effective, they do not fully utilize the inherent physical properties of the input signal, leaving room for optimization in terms of computational resources and efficiency. Specifically, the original complex spectrum F(u,v) exhibits a special structure called Hermitian symmetry, also known as conjugate symmetry, because the preprocessed PVC floor image is entirely composed of real values. This property explicitly states that the value at coordinate (u,v) in the spectrum is the complex conjugate of the value at coordinate (-u,-v). This means that the amplitude spectrum is centrally symmetric (|F(u,v)|=|F(-u,-v)|), while the phase spectrum is centrally antisymmetric (angle(F(u,v))=-angle(F(-u,-v))). From an information theory perspective, this indicates that half of the data in the spectrum is redundant. Meanwhile, the adaptive filter mask H(u,v) constructed in this application is synthesized from the real part of the Gabor function, which is real-valued and centrally symmetric. Therefore, H(u,v) is a real symmetric matrix satisfying H(u,v) = H(-u,-v). Ignoring this characteristic and operating on the entire spectrum would undoubtedly perform unnecessary calculations in the symmetric redundant parts, slowing down processing and consuming additional memory. Therefore, to maximize filtering efficiency and improve the performance of the entire detection process, it is necessary to introduce a more sophisticated implementation method. This method employs a half-spectrum and phase-preserving strategy to perform a highly optimized, efficient frequency domain enhancement of PVC floor scratches, thereby significantly improving computational speed and numerical stability while ensuring filtering effectiveness.
[0047] Based on this, in a preferred embodiment, step 5, which involves performing frequency domain filtering and inverse transformation on the original complex spectrum based on an adaptive filter mask to obtain an enhanced PVC floor image, includes: performing efficient frequency domain enhancement of PVC floor scratches based on half-spectrum phase preservation on the original complex spectrum using an adaptive filter mask to obtain an enhanced PVC floor image.
[0048] First, an efficient transformation from the real domain to the complex frequency domain is performed. The input to this step is the preprocessed PVC floor image, which is a two-dimensional real matrix. By applying the real-to-complex Fast Fourier Transform (RFFT) algorithm, the semi-complex spectrum HCS can be directly obtained. The formula for this transformation can be expressed as: HCS = RFFT(I). In this formula, I represents the input preprocessed PVC floor image matrix, RFFT is a Fourier transform function that specifically identifies and utilizes the real-valued characteristics of the input signal, and its output HCS is the semi-complex spectrum. Unlike the general FFT, which outputs a complete complex spectrum with the same size as the input image, the RFFT algorithm's output HCS has approximately half the number of elements, yet it contains all the non-redundant frequency information needed to reconstruct the complete signal and fully preserves the crucial phase spectrum information. The fundamental reason for this is to avoid subsequent processing of redundant spectral data, thus improving computational efficiency from the source.
[0049] Next, a precise filtering operation is performed in the half-spectrum space. The input to this step is the half-complex spectrum HCS generated in the previous step, and the corresponding adaptive filter mask Hhalf, which occupies only half the space, obtained by extracting the non-redundant part from the complete adaptive filter mask generated in step 4. By multiplying these two elements one by one, the filtered half-spectrum FHS can be obtained. The formula for this process is: FHS = HCS * Hhalf. Where * represents element-wise multiplication. To understand this operation more clearly, any element in the complex spectrum HCS can be represented in its polar coordinates as |HCS(u,v)|exp(iφ(u,v)), where φ(u,v) is the phase. Since Hhalf is a real number, the above multiplication can be expanded as: FHS(u,v) = (|HCS(u,v)|*Hhalf(u,v))exp(iφ(u,v)). This indicates that the essence of this operation remains phase-preserving amplitude modulation, that is, using the gain value in Hhalf to adjust the amplitude of each frequency component in HCS while maintaining its original phase. Since the data points for the filter multiplication operation are reduced by about half, the execution speed of the entire filtering process is expected to be nearly twice that of operating on the full spectrum. Thus, while preserving the scratch spatial location information (encoded in the phase), the frequency components corresponding to the scratch direction are precisely enhanced, generating the filtered half-spectrum FHS.
[0050] Finally, an efficient inverse transform from the semi-complex frequency domain to the real spatial domain is performed. By applying the Inverse Real Fast Fourier Transform (IRFT) algorithm, the frequency domain information can be converted back to the spatial domain image. The formula for this transform is: Ienhanced = Irfft(FHS). In this formula, the Irfft function receives the non-redundant semi-spectrum FHS as input, and its internal mechanism automatically reconstructs the complete complex spectrum using Hermitian symmetry and performs the inverse transform. The significant advantage of this process is that its output Ienhanced is guaranteed to be a pure real-valued image of the scratch-enhanced PVC floor. This not only avoids the tiny imaginary noise that requires additional post-processing steps to discard due to floating-point precision issues in standard complex IFFT, thus improving numerical stability, but also makes the entire process simpler. Ultimately, this preferred implementation completes the regression from the frequency domain to the spatial domain, obtaining a final image with significantly enhanced scratch features, laying a solid foundation for subsequent segmentation processing. In summary, by utilizing the rfft and irfft algorithms that can identify the Hermite symmetry of real signals, the algorithm itself is executed approximately twice as fast as the general complex FFT / IFFT. Furthermore, storage space is saved by reducing the memory required for the intermediate semi-complex spectrum HCS by about half, ultimately achieving a nearly twofold speedup and higher numerical stability for the entire filtering process.
[0051] In step 6, the enhanced PVC flooring image undergoes scratch segmentation to obtain a defect list. That is, after the frequency domain filtering and inverse transform in the previous steps, the enhanced PVC flooring image successfully highlights the previously indistinguishable weak scratch signals from the complex background and noise, making them the most prominent features in the image. However, this image is essentially still a grayscale image, where defect information exists in the form of pixel brightness, and has not yet been converted into structured geometric and positional data that can be directly used by the quality control system. To accurately convert these enhanced visual features into a quantitative report containing specific parameters for each individual defect, final scratch segmentation and analysis are performed to precisely separate each scratch target from the enhanced image, measure and filter them, and ultimately generate a detailed and accurate defect list.
[0052] In one possible implementation, step 6 is as follows: The first step is binarization. Since the background of the input PVC flooring image after scratch enhancement is very clean, and there is a significant grayscale difference between the scratch and the background, this creates excellent conditions for simple thresholding. Otsu's method is used here to automatically determine a globally optimal threshold T. This method first requires calculating the normalized histogram of the grayscale image, which clearly shows a bimodal distribution, with one peak corresponding to the dark background and the other peak corresponding to the bright scratch. Otsu's method iterates through all possible grayscale levels as candidate thresholds. At each candidate threshold, the image pixels are divided into foreground (scratches) and background classes, and the weighted sum of the intra-class variances of these two classes is calculated. The ultimate goal of this algorithm is to find a threshold that minimizes the sum of the intra-class variances, which is mathematically equivalent to selecting the grayscale level that maximizes the inter-class variance as the global threshold. For example, for an image with a grayscale range of 0 to 255, Otsu's method might calculate an optimal threshold T = 90. Then, each pixel of the 1024×1024 image is iterated over. If its grayscale value is greater than 90, the value of that pixel is set to 255 (white) in the newly generated binary mask image, representing the foreground; if its grayscale value is less than or equal to 90, it is set to 0 (black), representing the background. After this operation, a clear black and white binary mask image is obtained, where the white areas theoretically correspond to all the scratches.
[0053] The second step is morphological post-processing. The binarized image may still contain some imperfections, such as isolated white spots caused by minute noise, or scratches broken into segments in the binary image due to weak original signals. To address these issues, morphological operations are applied. First, an opening operation is performed, which is a process of erosion followed by dilation. Using a small structuring element, such as a 3×3 square, the erosion operation iterates through every white pixel in the image and checks if its 3×3 neighborhood can completely contain the structuring element; only when the structuring element is completely covered by white pixels is the center pixel kept white in the output image; otherwise, it becomes black. This process removes isolated white spots smaller than the structuring element while having less impact on large scratch areas. The subsequent dilation operation is performed in reverse; whenever the structuring element overlaps with any white pixel, its center pixel becomes white in the output image, restoring the size of the eroded scratch body. Next, a closing operation is performed, which is a process of dilation followed by erosion. The initial dilation operation expands the scratched area outward, connecting adjacent broken sections; the subsequent erosion operation restores the overall contour to near its original size, preventing excessive thickening of the scratches. Through this series of processes, noise in the binary mask is effectively removed, and discontinuous scratches are repaired, resulting in a cleaner and more complete scratch representation.
[0054] The third step is connected component analysis. Connected component labeling is performed on the morphologically processed binary mask to identify and separate each independent scratch candidate region. The algorithm scans the entire image, grouping connected white pixels into the same group. Here, 8-neighborhood connections are used, meaning that the pixel's top, bottom, left, right, and diagonal neighbors are all considered connected. A typical implementation is a two-pass scanning method: In the first scan, each encountered white pixel is assigned a label; if its neighborhood already has a label, the equivalence relationship between labels is inherited or recorded. In the second scan, based on the recorded equivalence relationship, all equivalent labels are unified into a single representative label. For example, all pixels corresponding to the first complete scratch in the image are labeled as 1, all pixels corresponding to the second scratch are labeled as 2, and so on, while background pixels remain at 0. After processing, a label matrix is obtained, where different positive integers represent different candidate defect regions.
[0055] The fourth step is feature extraction and filtering. Not all marked white areas are real scratches; some residual noise or artifacts may also be marked. Therefore, filtering is needed by calculating the geometric features of each candidate region. For each connected component, all pixel coordinates are extracted by traversing the label matrix, and key features are calculated based on these coordinates, mainly including: area, i.e., the total number of pixels contained in the component; and aspect ratio, which is obtained by calculating the ratio of the long side to the short side of the smallest bounding rectangle that encloses the component. This rectangle can be arbitrarily rotated to fit the component shape most closely. Based on prior knowledge of the physical morphology of real scratches, a set of filtering rules is set. For example, a real scratch should be long and thin and have a certain size. Therefore, the rule can be set as follows: the aspect ratio of the candidate region must be greater than 10, and its area must be greater than 50 pixels. All connected components are traversed, and only those that simultaneously meet both conditions are identified as real scratches. For example, a component with an area of 300 pixels and an aspect ratio of 40 will be retained, while a component with an area of 20 pixels and an aspect ratio of 2 will be judged as noise and discarded.
[0056] The final step is report generation. For all the real scratches that pass the screening, their relevant information is compiled into a final defect list. This information includes: the location of the scratch in the original high-resolution image, which is obtained through precise inverse coordinate transformation, for example, subtracting the padding amount (256 pixels) from the coordinates in the current 1024×1024 image and then multiplying by the inverse of the scaling factor (16) to recover its precise location in the original 8192×16384 image; its length, which can be accurately calculated by skeletonizing the component, refining it into lines of single-pixel width, and then counting the number of pixels on the skeleton; and its direction, which can be obtained by performing principal component analysis (PCA) on the coordinate set of all pixels of the component and calculating the direction vector of its first principal component. This structured list is the final output of the entire detection method. It describes each defect in a precise, quantitative data form and can be used for subsequent quality rating, statistical analysis, or automated rejection in production processes.
[0057] In summary, the PVC floor surface coating defect detection method based on the embodiments of this application is explained. It solves the problem of stable detection of weak scratches on highly reflective surfaces by combining frequency domain analysis and adaptive filtering. First, the original image containing strong specular reflection and low signal-to-noise ratio scratches is transformed to the frequency domain. Utilizing the principle that scratches, as linear structures, exhibit directional characteristics in the spectrum, they are separated from large-area low-frequency background noise and glare signals. This method does not rely on a preset filter but accurately identifies scratches of arbitrary direction in the current image through intelligent analysis of the image spectrum and extracts their principal direction angle. Subsequently, based on this real-time detected directional information, an adaptive anisotropic filter that perfectly matches it is dynamically constructed. This customized filter can accurately and selectively enhance the frequency components corresponding to the scratch direction in the spectrum while suppressing interference from other irrelevant frequencies. Finally, after filtering and inverse transformation, the characteristic signal of the scratch is significantly amplified, and the contrast is greatly improved, thereby achieving accurate segmentation and detection of weak, randomly oriented scratches in a strong interference background, effectively overcoming the problems of missed detection and computational redundancy in traditional methods.
[0058] Figure 6 This is a block diagram of a PVC flooring surface coating defect detection system according to an embodiment of this application. Figure 6As shown, the PVC flooring surface coating defect detection system 100 according to an embodiment of this application includes: a PVC flooring original image acquisition module 110, used to acquire an original image of the PVC flooring to be detected; a PVC flooring original image preprocessing module 120, used to preprocess the original image of the PVC flooring to be detected to obtain a preprocessed PVC flooring image; a spectrum transformation and analysis module 130, used to perform spectrum transformation and analysis on the preprocessed PVC flooring image to obtain the original complex spectrum and the set of principal direction angles of the scratch in the frequency domain; an adaptive filtering module 140, used to perform adaptive anisotropic filtering on the set of principal direction angles of the scratch in the frequency domain to obtain an adaptive filter mask; a frequency domain filtering and inverse transformation module 150, used to perform frequency domain filtering and inverse transformation on the original complex spectrum based on the adaptive filter mask to obtain a scratch-enhanced PVC flooring image; and a defect generation module 160, used to perform scratch segmentation on the scratch-enhanced PVC flooring image to obtain a defect list.
[0059] Here, those skilled in the art will understand that the specific operations of each step in the above-described PVC floor surface coating defect detection system have been referenced above. Figures 1 to 5 The method for detecting defects in the surface coating of PVC flooring is described in detail in the previous section, and therefore, its repeated description will be omitted.
Claims
1. A method for detecting defects in the surface coating of PVC flooring, characterized in that, include: Acquire the original image of the PVC flooring to be inspected; The original image of the PVC flooring to be inspected is preprocessed to obtain a preprocessed image of the PVC flooring. Spectral transformation and analysis were performed on the preprocessed PVC flooring image to obtain the original complex spectrum and the set of principal direction angles of the scratches in the frequency domain. Adaptive anisotropic filtering is performed on the set of principal direction angles of the scratches in the frequency domain to obtain an adaptive filter mask; The original complex spectrum is filtered and inversely transformed in the frequency domain based on an adaptive filter mask to obtain an enhanced image of the PVC flooring with scratches. Scratch segmentation was performed on the scratch-enhanced PVC flooring image to obtain a defect list.
2. The method for detecting defects in the surface coating of PVC flooring according to claim 1, characterized in that, The original image of the PVC flooring to be inspected is preprocessed to obtain a preprocessed image of the PVC flooring, including: The original image of the PVC flooring to be inspected is normalized and filled to obtain a normalized PVC flooring image; The size-normalized PVC floor image is windowed to obtain the preprocessed PVC floor image.
3. The method for detecting defects in the surface coating of PVC flooring according to claim 1, characterized in that, The preprocessed PVC flooring image was subjected to spectral transformation and analysis to obtain the original complex spectrum and the set of principal direction angles of the scratches in the frequency domain, including: The preprocessed PVC flooring image was subjected to a fast Fourier transform to obtain the original complex spectrum; Logarithmic energy spectrum analysis was performed on the original complex spectrum to obtain a spectral image suitable for analysis; The available spectral images are subjected to parameter space transformation and direction extraction to obtain the set of principal direction angles of the scratch in the frequency domain.
4. The method for detecting defects in the surface coating of PVC flooring according to claim 3, characterized in that, Logarithmic energy spectral analysis is performed on the original complex spectrum to obtain spectral images suitable for analysis, including: Take the modulus of each element of the original complex spectrum to obtain the amplitude spectrum; Perform a logarithmic transformation on the amplitude spectrum to obtain the logarithmic amplitude spectrum; The logarithmic amplitude spectrum is spectrally centered to obtain a spectral image that can be analyzed.
5. The method for detecting defects in the surface coating of PVC flooring according to claim 3, characterized in that, The available spectral images are subjected to parameter space transformation and direction extraction to obtain the set of principal direction angles of the scratch in the frequency domain, including: Perform a Hough transform on the available spectral images to obtain the Hough accumulator matrix; Peak detection and filtering are performed on the Hough accumulator matrix to obtain the filtered peak set; Extract all angular components from the filtered set of peaks to obtain the set of principal direction angles of the scratch in the frequency domain.
6. The method for detecting defects in the surface coating of PVC flooring according to claim 1, characterized in that, Adaptive anisotropic filtering is performed on the set of principal direction angles of the scratches in the frequency domain to obtain an adaptive filter mask, including: Based on the spectral dimension, generate spectral coordinate pairs and aggregated filter masks; Extract the first principal direction angle from the set of principal direction angles of the scratch in the frequency domain; Based on the first principal direction angle and the filter parameter set, anisotropic Gabor kernel function synthesis is performed on the spectral coordinate pairs in each direction to obtain a single-direction mask; The adaptive filter mask is obtained by iteratively fusing the unidirectional mask and the current aggregated filter mask with pixel-wise maximum values.
7. The method for detecting defects in the surface coating of PVC flooring according to claim 6, characterized in that, Based on the first principal direction angle and the filter parameter set, anisotropic Gabor kernel function synthesis is performed on the spectral coordinate pairs in each direction to obtain a single-direction mask, including: The spectral coordinates are rotated based on the first principal direction angle to obtain the rotated coordinates. Based on the rotated coordinates and filter parameter set, the real response of the Gabor filter is calculated to obtain the anisotropic Gaussian envelope and cosine wave. The anisotropic Gaussian envelope and the cosine wave are multiplied to obtain a unidirectional mask.
8. A PVC flooring surface coating defect detection system, characterized in that, include: The PVC flooring original image acquisition module is used to acquire the original image of the PVC flooring to be inspected. The PVC flooring original image preprocessing module is used to preprocess the original image of the PVC flooring to be detected to obtain a preprocessed PVC flooring image. The spectrum transformation and analysis module is used to perform spectrum transformation and analysis on the preprocessed PVC flooring image to obtain the original complex spectrum and the set of principal direction angles of the scratch in the frequency domain. The adaptive filtering module is used to perform adaptive anisotropic filtering on the set of principal direction angles of the scratch in the frequency domain to obtain an adaptive filter mask. The frequency domain filtering and inverse transform module is used to perform frequency domain filtering and inverse transform on the original complex spectrum based on an adaptive filter mask to obtain the PVC floor image after scratch enhancement. The defect generation module is used to segment the scratches on the enhanced PVC flooring image to obtain a list of defects.