Image enhancement based method for detecting defects in a sliding spray coating
Patent Information
- Application Number
- CN202611081596.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-21
- Publication Date
- 2026-10-23
AI Technical Summary
[0003]现有涂层缺陷检测方法大多基于单帧图像灰度分析、边缘检测或纹理特征提取实现缺陷识别,但滑动式喷涂形成的规则方向纹理容易与真实缺陷在灰度变化上相互混叠,导致传统检测方法难以准确区分规则喷涂纹理与异常缺陷区域;尤其在喷涂表面存在方向性条带结构时,传统均匀滤波或普通增强方法容易同时增强背景纹理与缺陷响应,使规则纹理被误识别为缺陷,造成误检率较高;同时,对于针孔、细裂纹等弱缺陷,由于缺陷响应幅值较低,传统固定阈值检测方式又容易出现漏检问题
[0039]本发明提供的基于图像增强的滑动式喷涂涂层缺陷检测方法,通过构建滑动方向约束场,并将滑动方向约束场贯穿于方向增强、结构解耦以及轨迹一致性筛选全过程,实现了滑动式喷涂场景下规则纹理与真实缺陷的分离;相较于传统仅依赖灰度差异或静态纹理分析的检测方式,能够结合喷涂过程中形成的方向连续性特征,对沿滑动方向的规则纹理进行定向增强与约束分析,使喷涂条带结构得到稳定保留,同时削弱与滑动方向不一致的随机纹理和背景干扰,从而提高复杂喷涂环境下的缺陷识别稳定性与方向一致性分析能力。
Smart Images

Figure CN122966552A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image enhancement defect detection technology, and more particularly to a method for detecting defects in sliding spray coatings based on image enhancement. Background Technology
[0002] Sliding spraying technology is widely used in automotive parts, rail transit structural components, engineering machinery housings, metal sheets, and surface protection for high-end equipment. It achieves rapid and uniform coverage of large areas by continuously sliding the spray nozzle along a preset trajectory. Due to the relatively continuous movement between the nozzle and the surface being sprayed during sliding spraying, the coating surface typically forms a distinctly directional striped texture structure. Simultaneously, the spraying process is susceptible to defects such as pinholes, cracks, particle aggregation, missed areas, and abnormal stripes due to factors such as spraying pressure fluctuations, localized nozzle clogging, uneven atomization, surface-adhered particles, and changes in substrate condition. Therefore, high-precision defect detection of sliding-sprayed coatings is crucial for ensuring product surface quality and the stability of the spraying process.
[0003] Most existing coating defect detection methods rely on single-frame image grayscale analysis, edge detection, or texture feature extraction for defect identification. However, the regular directional textures formed by sliding spraying are easily mixed with real defects in terms of grayscale changes, making it difficult for traditional detection methods to accurately distinguish between regular spraying textures and abnormal defect areas. Especially when there are directional stripe structures on the sprayed surface, traditional uniform filtering or ordinary enhancement methods tend to enhance both background textures and defect responses simultaneously, causing regular textures to be misidentified as defects, resulting in a high false detection rate. At the same time, for weak defects such as pinholes and fine cracks, due to the low amplitude of the defect response, traditional fixed threshold detection methods are prone to missed detections. In addition, existing defect detection methods usually only perform static analysis on single-frame images, lacking the utilization of directional continuity and temporal trajectory characteristics during sliding spraying, and cannot combine the nozzle sliding direction to perform dynamic consistency verification of defect areas. When there is local reflection, random noise, or transient interference on the sprayed surface, traditional methods are prone to misjudging random pseudo-responses as real defects, resulting in poor stability of detection results. Summary of the Invention
[0004] This invention provides an image enhancement-based sliding spray coating defect detection method, which combines the sliding direction characteristics during the spraying process to achieve effective separation of regular textures and real defects, and improves the detection capability of weak defects and the elimination capability of false defects.
[0005] The image enhancement-based method for detecting defects in sliding spray coatings includes the following steps:
[0006] S1: Obtain a continuous coating image sequence in the same area during the sliding spraying process, analyze the sliding direction of the coating image sequence, construct the corresponding sliding direction constraint field, and perform direction consistency enhancement processing on the coating image sequence based on the sliding direction constraint field to generate a direction-enhanced image sequence;
[0007] S2: Input the orientation enhancement image sequence into the structure decoupling processing module, separate the orientation texture component and abnormal response component in the image according to the sliding orientation constraint field to obtain a detextured interference image, and perform adaptive contrast enhancement processing on the detextured interference image to generate a defect response enhancement image;
[0008] S3: Construct a defect candidate region based on the defect response enhancement image, and perform trajectory consistency screening on the defect candidate region in combination with the sliding direction constraint field, and output the final defect detection result.
[0009] Optionally, S1 specifically includes:
[0010] S11: By using a linear array image acquisition device fixedly installed above the spraying production line, during the process of the spraying nozzle moving along the sliding direction, the acquisition of coating surface images is triggered at fixed time intervals to obtain multiple consecutive images covering the same coating area, and the multiple consecutive images are arranged in the order of acquisition time to form the continuous coating image sequence.
[0011] S12: For each frame of the continuous coating image sequence, extract the main direction features of the texture in the image, determine the sliding motion vector based on the displacement estimation of the image content between adjacent frames, establish a direction field pixel by pixel or local region by local region according to the projection direction and amplitude of the sliding motion vector on the image plane, and use the direction field as the sliding direction constraint field.
[0012] S13: Based on the sliding direction constraint field, for each frame of the continuous coating image sequence, anisotropic diffusion filtering is performed along the main direction indicated by the sliding direction constraint field, while suppressing texture noise perpendicular to the main direction, enhancing the consistent structural information along the sliding direction in the image, and generating the direction-enhanced image sequence.
[0013] Optionally, S12 specifically includes:
[0014] Gradient information is extracted from each frame of the continuous coating image sequence. A structure tensor is constructed at each pixel position based on the gradient information. Eigenvalue decomposition is performed on the structure tensor to obtain the main direction vector, which is used as the texture main direction vector at the pixel position.
[0015] Displacement estimation is performed on adjacent frame images to determine the sliding motion vector, and the sliding motion vector is normalized in direction.
[0016] At each pixel position, the texture main direction vector and the sliding motion vector direction are combined according to a preset fusion weight to obtain a fusion direction vector;
[0017] The fused direction vector is normalized and a continuously distributed direction field is formed across the entire image. This direction field is then used as a sliding direction constraint field.
[0018] Optionally, the anisotropic diffusion filtering process includes: during image smoothing, applying diffusion control of different intensities to different directions based on the directional characteristics indicated by the sliding direction constraint location, so that pixel information along the sliding direction is enhanced and propagated, while restricting the propagation of pixel information perpendicular to the sliding direction, thereby performing directional denoising and structural enhancement while maintaining the boundary features of the coating structure.
[0019] Optionally, S2 specifically includes:
[0020] S21: Input each frame of the orientation enhancement image in the orientation enhancement image sequence and the corresponding sliding direction constraint field into the structure decoupling processing module, set a directional filter along the main direction indicated by the sliding direction constraint field, align the main axis of the directional filter with the sliding direction, filter the orientation enhancement image to extract regular texture features extending along the sliding direction, and use the extracted regular texture features as orientation texture components.
[0021] S22: Subtract the directional texture component from the original pixel value of the directional enhancement image to obtain the residual image signal, and take the high amplitude local change region in the residual image signal as the abnormal response component, retain the abnormal response component and suppress the residual noise, and output the detextured interference image.
[0022] S23: Perform grayscale histogram statistical analysis on the detextured interference image, stretch and expand the grayscale range of the low-contrast region according to the adaptive threshold of grayscale distribution, and perform nonlinear enhancement mapping on the high grayscale abnormal region to generate a defect response enhancement image, wherein the abnormal response component corresponding to the defect is assigned a higher pixel value than the background region in the defect response enhancement image.
[0023] Optionally, the orientation enhancement image can be decoupled from the corresponding sliding orientation constraint field input structure processing module;
[0024] The structural decoupling processing module acquires sliding direction information at each pixel position, constructs a directional filtering window along the sliding direction, performs directional filtering processing on the directional enhancement image to extract regular texture features continuously distributed along the sliding direction, and obtains directional texture components; the directional texture components are subtracted from the original pixel values of the directional enhancement image to obtain residual image signals;
[0025] The structural decoupling processing module performs amplitude statistical analysis on the residual image signal, filters out high-amplitude local change regions as abnormal response components based on a preset response threshold, and determines low-amplitude regions as background candidate regions.
[0026] The structural decoupling processing module performs connectivity constraints and minimum scale filtering on the abnormal response components, retaining spatially continuous abnormal regions that meet the size requirements; it performs smoothing suppression processing on the background candidate regions to reduce residual noise, and then merges the retained abnormal response components with the suppressed background regions to output a texture-free image.
[0027] Optionally, the 23 specifically includes:
[0028] Perform pixel-by-pixel gray-level statistics on the texture-de-interference image and construct a gray-level histogram;
[0029] Based on gray-level histograms, the main peak region, transition region and high gray-level tail region in gray-level distribution are identified, and the boundary between background region and abnormal response region is determined by gray-level cumulative distribution.
[0030] The image contrast status is determined based on the degree of concentration of grayscale distribution, and an enhancement strategy is determined accordingly;
[0031] Gray-scale stretching is performed on low-gray-scale concentrated areas to expand the gray-scale dynamic range; smoothing mapping is performed on transition areas to maintain gray-scale continuity; and nonlinear enhancement is performed on high-gray-scale tail areas to improve the abnormal response amplitude. Mapping is performed pixel by pixel according to the corresponding gray-scale interval across the entire image to output a defect response enhanced image.
[0032] Optionally, S31 specifically includes:
[0033] S31: Perform adaptive threshold segmentation processing on the defect response enhancement image, mark the set of connected pixels whose pixel values exceed the adaptive threshold as the initial defect region, and perform morphological closing operation on each initial defect region to fill the small holes to obtain the defect candidate region.
[0034] S32: For each defect candidate region, extract the local principal direction of the corresponding defect candidate region in the sliding direction constraint field, traverse the same spatial position in multiple consecutive frames of defect response enhancement images along the local principal direction, and determine whether the corresponding defect candidate region appears continuously between multiple frames with an offset consistent with the sliding direction constraint field.
[0035] Optionally, the morphological closing operation includes filling small holes to obtain a defect candidate region. Specifically, for each initial defect region, a corresponding structural element is selected based on the morphological characteristics of the defect region; the structural element is used to perform an expansion process on the initial defect region, so that the small gaps, local fracture regions and internal holes in the initial defect region are filled, and the edges of adjacent defects are connected.
[0036] After the expansion process is completed, the same structural element is used to perform erosion on the expanded area to shrink the outer boundary while retaining the filled hole area and the connected continuous area. The area after erosion is then smoothed to output a defect candidate area with continuous boundary and complete interior.
[0037] Optionally, S3 further includes retaining the defect candidate regions that meet the trajectory consistency condition as real defects, removing the defect candidate regions that do not meet the trajectory consistency condition as false defects, and marking and outputting the position, size and defect type of each retained real defect as the final defect detection result.
[0038] The beneficial effects of this invention are:
[0039] The image enhancement-based sliding spray coating defect detection method provided by this invention constructs a sliding direction constraint field and integrates it throughout the entire process of direction enhancement, structural decoupling, and trajectory consistency screening. This achieves the separation of regular textures from real defects in sliding spray coating scenarios. Compared with traditional detection methods that rely solely on grayscale differences or static texture analysis, this method combines the directional continuity features formed during the spraying process to perform directional enhancement and constraint analysis on regular textures along the sliding direction. This ensures the stable preservation of the spray strip structure while reducing random textures and background interference that are inconsistent with the sliding direction, thereby improving the defect recognition stability and directional consistency analysis capability in complex spray coating environments.
[0040] This invention separates the directional texture component and the abnormal response component in the directional enhancement image through a structural decoupling processing module. Combined with an adaptive grayscale distribution enhancement strategy, it performs nonlinear enhancement processing on the defect response region, causing minute defects to exhibit significantly higher response characteristics than the background region in the defect response enhancement image. Specifically, directional filtering extracts regular texture features, and high-amplitude local variation regions in the residual image signal are filtered to avoid the regular spraying texture masking defect detection. Simultaneously, through an adaptive enhancement mechanism based on grayscale histogram statistical analysis, the enhancement strategy can be dynamically adjusted according to the grayscale distribution under different spraying conditions, improving the response capability to weak defects such as pinholes, cracks, particles, and localized missed spraying, enhancing the contrast between the defect region and the background region, and increasing the detection rate of weak defects.
[0041] This invention further incorporates a sliding direction constraint field to perform cross-frame trajectory consistency screening on defect candidate regions. By analyzing the spatial offset continuity and directional consistency of defect candidate regions in consecutive multi-frame images, only true defects that meet the trajectory consistency condition are retained, while random noise, transient reflections, and isolated pseudo-response regions are eliminated. Compared to single-frame detection methods, this scheme utilizes the temporal continuity characteristics of the sliding spraying process to extend defect detection from single-frame spatial analysis to multi-frame spatiotemporal joint analysis, which can improve the detection reliability of true defects and effectively reduce the false detection rate. The final output defect detection result can simultaneously include the location, size, and defect type information of the true defects. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only for this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a schematic diagram of the method flow according to an embodiment of the present invention;
[0044] Figure 2 This is a schematic diagram illustrating the enhancement of directional consistency in an embodiment of the present invention. Detailed Implementation
[0045] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. For some well-known technologies, those skilled in the art may also use other alternative methods to implement the invention. Moreover, the accompanying drawings are only for more specific description of the embodiments and are not intended to specifically limit the present invention.
[0046] like Figures 1-2 As shown, the image enhancement-based sliding spray coating defect detection method includes the following steps:
[0047] S1: Obtain a continuous coating image sequence in the same area during the sliding spraying process, analyze the sliding direction of the coating image sequence, construct the corresponding sliding direction constraint field, and perform direction consistency enhancement processing on the coating image sequence based on the sliding direction constraint field to generate a direction-enhanced image sequence;
[0048] S1 specifically includes:
[0049] S11: A linear array image acquisition device, fixedly installed above the spraying production line, continuously images the same area during the sliding spraying process; as the spraying nozzle moves along a predetermined sliding direction, trigger acquisition is performed at preset fixed time intervals to obtain multiple frames of coating surface images covering the same coating area; the images are sorted according to the order of acquisition time to construct a continuous coating image sequence, which can be represented as:
[0050] ; ;
[0051] in, Indicates the first Frame coating image, This indicates the number of consecutively acquired image frames. The above method ensures that the continuous coating image sequence spatially covers the same coating area and temporally reflects the dynamic changes during the sliding spraying process, providing a data basis for subsequent sliding direction analysis.
[0052] S12: Extract the main direction features of the texture for each frame in the continuous coating image sequence, and determine the sliding motion vector by combining the displacement estimation between adjacent frames;
[0053] S121: For each frame image Calculate its gradient information and construct the structure tensor:
[0054] ;
[0055] in, and These represent the gradient components of the image in the horizontal and vertical directions, respectively; the principal direction vector is obtained by eigenvalue decomposition of the structure tensor. The eigenvalue decomposition refers to solving for the eigenvalues and corresponding eigenvectors of a matrix so that the matrix can be represented as a combination of several eigenvectors with specific weights, i.e., eigenvalues. In other words, a linear transformation is decomposed into several scaling operations along a specific direction, where the eigenvectors represent the direction and the eigenvalues represent the intensity of the change along that direction. In this section, the structure tensor is a two-dimensional symmetric matrix. The specific steps for eigenvalue decomposition are as follows: First, construct a structure tensor matrix at each pixel location; then solve for the eigenvalues of this matrix to obtain two eigenvalues. and , Simultaneously solve for the two corresponding eigenvectors. and Since the structure tensor reflects the local gradient distribution, the eigenvectors corresponding to larger eigenvalues represent the directions of most dramatic changes in image grayscale, while the eigenvectors corresponding to smaller eigenvalues represent directions of more gradual changes. In texture analysis, the eigenvectors corresponding to smaller eigenvalues are used as the principal texture direction vectors. This is because the direction along which the texture extends is the most gradual, which better matches the direction of the strip-like structure formed by sliding spraying. After normalizing this feature vector, it is used as the principal direction feature of the pixel position. The smaller feature value refers to the smaller value among the two feature values obtained after decomposing the structure tensor. It reflects the weak gray-level change of the image in the corresponding direction, that is, the pixel change in this direction is gradual and continuous. In sliding spraying images, the strip-like texture usually extends continuously in a certain direction, so the gray-level change along the texture extension direction is small. Therefore, the feature vector corresponding to the smaller feature value is used as the principal direction of the texture to represent the extension direction of the spraying texture.
[0056] S122: For adjacent frame images and Perform displacement estimation to obtain the sliding motion vector:
[0057] ;
[0058] in, and These represent the displacement components in the horizontal and vertical directions between adjacent frames, respectively.
[0059] S123: Project the sliding motion vector onto the image plane, and combine it with the main direction features of the texture to construct a direction field for each pixel or local region:
[0060] ;
[0061] S123 obtains the sliding motion vector based on the displacement estimation results between adjacent frames and maps the sliding motion vector to the coordinate system of the current frame image, so that each frame image corresponds to a global sliding direction reference. Then, the texture principal direction vector obtained by structural tensor eigenvalue decomposition in each frame image is normalized to ensure the consistency of direction representation. At the pixel level or local neighborhood level, the texture principal direction vector and the sliding motion vector direction are fused. The sliding motion vector is first normalized to eliminate amplitude influence, retaining only direction information. During fusion, for each pixel position, the two types of directions are linearly combined according to preset weights to obtain the direction vector at that position. For regions with local noise or unstable textures, neighborhood smoothing or confidence filtering can be performed on the texture principal direction vector before fusion to reduce the interference of abnormal directions on the fusion result. After fusion, the obtained direction vector is normalized again to ensure the spatial continuity and stability of the direction field. Finally, a pixel-wise or block-wise consistent sliding direction constraint field is formed across the entire image for subsequent direction consistency enhancement processing. Represents pixels The direction field vector at that location, Represents the magnitude of the sliding motion vector; the direction field As a sliding direction constraint field, it is used to describe the dominant structural orientation along the sliding direction in the coating image. The fusion weight coefficient represents the combination of the main texture direction and the sliding motion direction. The value of the fusion weight coefficient is between 0.6 and 0.85, prioritizing the dominant role of the main texture direction features while introducing the sliding motion direction as a global constraint for correction. When the image texture is clear and the strip structure is obvious, a larger value is taken to highlight the main texture direction. When the image has noise, texture discontinuity, or unstable local structure, the weight coefficient is appropriately reduced to increase the proportion of the sliding motion direction and enhance the overall directional consistency. Based on the characteristics of the strip structure with obvious directional continuity and the global stability of the sliding motion direction from the spraying process, the fusion of the two can take into account both local details and overall consistency, and improve the robustness of the orientation field construction.
[0062] S13: Based on the sliding direction constraint field, perform orientation consistency enhancement processing on each frame of the continuous coating image sequence;
[0063] Anisotropic diffusion filtering is performed along the principal direction indicated by the sliding direction constraint field to suppress texture noise perpendicular to this principal direction; the anisotropic diffusion process can be represented as:
[0064] ;
[0065] By performing the anisotropic diffusion filtering process described above on each frame of the image, a direction-enhanced image sequence is obtained:
[0066] ;
[0067] S13 first obtains the corresponding principal direction unit vector and its perpendicular unit direction at each pixel position based on the sliding direction constraint field. Then, it calculates the gradient information for the current frame image and decomposes the gradient in the principal and perpendicular directions, obtaining the variation components along the sliding direction and perpendicular to the sliding direction. During the diffusion process, a larger diffusion intensity is applied to the gradient components along the sliding direction, making the pixel grayscale values in the same sliding direction gradually more consistent, strengthening the strip-like continuous structure. Simultaneously, a smaller diffusion intensity is applied to the gradient components in the perpendicular direction, or even suppressed, making it difficult for horizontal texture noise and random perturbations to diffuse, thus gradually weakening them. This diffusion process can be executed through multiple iterations, with each iteration recalculating the gradient components based on the current image update results, and locally... Information propagates along the main direction within the neighborhood, while the propagation range in the vertical direction is limited until the image forms a clear continuous structure in the sliding direction and lateral noise is effectively suppressed. The final output image exhibits enhanced consistent texture in the sliding direction, while fine textures inconsistent with the sliding direction are weakened. Anisotropic diffusion filtering refers to using diffusion of different intensities in different directions during image smoothing, i.e., a smoothing strategy, to enhance the continuous structure of the image in some directions and suppress unwanted changes in other directions, achieving selective smoothing. Unlike ordinary uniform filtering, it does not blur the image with equal intensity in all directions. Instead, based on the structural characteristics of the image, it allows information diffusion in the main structural direction and restricts diffusion in non-main structural directions, which can maintain or even enhance structural boundaries or texture directions while denoising. Represents the image gradient. This represents the unit direction vector of the constraint field along the sliding direction. This represents the unit direction vector perpendicular to the sliding direction constraint field. and Let represent the diffusion coefficients along the principal direction and the perpendicular direction, respectively, and satisfy . To enhance the consistency of structural information along the sliding direction and suppress lateral texture noise, the diffusion coefficient along the main direction is generally 0.2 to 0.5, and the diffusion coefficient in the vertical direction is generally 0.01 to 0.1, always ensuring that the diffusion coefficient in the main direction is greater than that in the vertical direction. When the stripe structure in the coating image is clear and has good continuity, the diffusion coefficient in the main direction can be appropriately increased to further enhance structural consistency. When the image noise is strong or there are many lateral interference textures, the diffusion coefficient in the vertical direction should be reduced to strengthen the suppression effect. The structure formed by sliding spraying has obvious directional continuity characteristics. By enhancing the diffusion in the main direction and suppressing the vertical diffusion, irrelevant texture interference can be removed to the greatest extent while preserving the defect response, thus improving the reliability of subsequent defect detection. This indicates the first [unit / item] after directional consistency enhancement. Frame images; orientation-enhanced image sequences, while maintaining the continuity of the coating structure, reduce texture interference that is inconsistent with the sliding direction, providing highly consistent input data for subsequent structural decoupling and defect detection.
[0068] S2: Input the orientation enhancement image sequence into the structure decoupling processing module, separate the orientation texture component and abnormal response component in the image according to the sliding orientation constraint field to obtain a detextured interference image, and perform adaptive contrast enhancement processing on the detextured interference image to generate a defect response enhancement image;
[0069] S2 specifically includes:
[0070] S21: Input each frame of the orientation enhancement image sequence and the corresponding sliding direction constraint field into the structure decoupling processing module; under the guidance of the sliding direction constraint field, construct a directional filter consistent with the sliding direction at each pixel position, so that the principal axis of the directional filter is aligned with the direction vector in the sliding direction constraint field; perform directional filtering processing on the orientation enhancement image to extract the regular texture structure continuously distributed along the sliding direction;
[0071] The directional filtering process can be represented as: ;
[0072] Through the above processing, the regular texture features extending along the sliding direction are separated from the directional enhancement image and used as directional texture components.
[0073] S21 is the structural decoupling processing module. First, it reads each frame of the orientation-enhanced image and the corresponding sliding direction constraint field, and obtains the sliding direction information for each pixel in the image. Then, using this direction as a constraint, a directional filtering window is constructed in the neighborhood of each pixel. The directional filtering window extends along the sliding direction to form a slender structure, ensuring that the main axis of the window is consistent with the sliding direction, while maintaining a narrow range in the vertical direction. During the filtering calculation, several consecutive pixels are selected along the main axis, centered on the current pixel. The gray values of these pixels are weighted and accumulated or smoothed to enhance the continuously distributed gray structure along the sliding direction. Simultaneously, neighboring pixels deviating from the main axis are given lower weights or ignored to weaken the influence of lateral texture and random noise. This process is repeated across the entire image, continuously enhancing regular striped textures in the main direction while effectively suppressing irregular or non-directional textures. The final output is the regular texture features extending along the sliding direction extracted from the orientation-enhanced image, used as the directional texture component for subsequent processing. Represents pixels The directional texture component at that location, Indicates a directionally enhanced image. This indicates a directional filter kernel whose principal axis direction is aligned with the direction of the sliding constraint field. This indicates the sliding direction angle at that pixel. Indicates the filtering neighborhood;
[0074] S22: Subtract the orientation texture component from the original pixel values of the orientation-enhanced image to obtain the residual image signal;
[0075] S221, the residual image signal can be represented as: ;
[0076] in, This represents the residual image signal; in the residual image signal, the regular texture structure has been weakened, and the remaining signal mainly includes information on local abnormal changes.
[0077] Further amplitude analysis of the residual image signal is performed, and regions with grayscale change amplitudes exceeding a preset response threshold are identified as abnormal response components. This preset response threshold distinguishes abnormal response components from background noise in the residual image signal, and its value is adaptively determined based on the grayscale change amplitude distribution of the residual image signal. Specifically, the overall grayscale mean and fluctuation range of the residual image signal are first statistically analyzed, and the grayscale standard deviation or median absolute deviation is used as the fluctuation scale. The preset response threshold is then set to a range higher than the background fluctuation level, typically 1.5 to 3 times the background fluctuation scale, to ensure that only local changes significantly higher than normal texture residues are responded to. In practical applications, when the sprayed surface is relatively uniform and the noise level is low, the threshold can be appropriately lowered to improve sensitivity to minor defects. Conversely, when there is strong residual texture or noise interference in the image, the threshold should be appropriately increased to avoid false detections. The above values are based on the fact that background noise in residual image signals usually exhibits a low-amplitude random distribution, while defect responses typically show local abrupt changes. By setting the threshold outside the background fluctuation range, noise interference can be effectively suppressed while ensuring detection sensitivity.
[0078] S222 simultaneously performs smoothing or suppression processing on low-amplitude regions to reduce the impact of residual noise; finally, it preserves anomalous response components and suppresses residual noise, outputting a texture-free image. ;
[0079] ;
[0080] Where, represents the texture-removed interference image, This describes a processing function for threshold screening and noise suppression of residual image signals. The specific approach involves first performing amplitude statistics on the residual image signal to calculate the gray-level distribution characteristics of the entire image or a local area, and determining an adaptive response threshold based on the gray-level distribution. Then, the residual image signal is compared pixel by pixel, with pixels having gray-level amplitudes higher than the response threshold marked as abnormal response candidate points, and pixels having gray-level amplitudes lower than the response threshold marked as background candidate points. Next, connectivity analysis is performed on the abnormal response candidate points, retaining only regions that form a continuous spatial region with an area or length exceeding a preset minimum scale to eliminate isolated noise points. Simultaneously, smoothing suppression processing is performed on the background candidate points to further reduce low-amplitude random fluctuations. The retained abnormal response regions undergo boundary refinement processing to make the abnormal region outline clearer and suppress boundary spikes. Finally, the processed abnormal response regions are recombine with the suppressed background regions to generate a detextured interference image, ensuring that the abnormal response components are preserved while background noise is effectively suppressed.
[0081] S23: Perform gray-level histogram statistical analysis on the detextured interference image to obtain the gray-level distribution features of the image, and adaptively determine the enhancement strategy based on the gray-level distribution;
[0082] S231, First, calculate the gray-level probability distribution function of the texture-de-interference image:
[0083] ;
[0084] in, Indicates grayscale value The probability, Indicates grayscale value The number of pixels, The grayscale probability distribution function of the detextured image, representing the total number of pixels in the image, describes the proportion of different grayscale values appearing in the entire detextured image. The specific approach is as follows: First, determine the grayscale value range of the detextured image, for example, normalize the image grayscale to 0 to 255; then, count the number of pixels corresponding to each grayscale value, i.e., count how many times a pixel with a certain grayscale value appears in the entire image; next, count the total number of pixels in the detextured image; then, divide the number of pixels corresponding to a certain grayscale value by the total number of pixels to obtain the probability of that grayscale value appearing in the entire image; repeat the above statistical process for all grayscale values to form the complete grayscale probability distribution function. In this section, the role of this grayscale probability distribution function is to reflect the distribution of background areas, low-contrast areas, and high-grayscale abnormal areas in the detextured image; if the number of pixels is concentrated within a certain grayscale range, it indicates that the grayscale range mainly corresponds to the background or regular residual areas; if a small number of pixels appear at the high grayscale end but are clearly concentrated, it usually corresponds to defective abnormal response areas. Subsequently, an adaptive threshold can be determined based on the grayscale probability distribution results, and grayscale stretching can be performed on low-contrast regions, while nonlinear enhancement mapping can be performed on high-grayscale abnormal regions.
[0085] S232, based on the grayscale distribution characteristics, an adaptive threshold is determined to stretch and expand the grayscale range of the low-contrast region, while a nonlinear enhancement mapping is applied to the high grayscale abnormal region. The mapping process can be expressed as:
[0086] ;
[0087] Through the above grayscale stretching and nonlinear enhancement processing, the region corresponding to the abnormal response component obtains a higher grayscale value in the defect response enhancement image, while the background region remains at a relatively low level, thereby improving the contrast between the defect region and the background and generating a defect response enhancement image.
[0088] S232, based on the grayscale probability distribution results of the texture-removed interference image, first analyzes the grayscale histogram to identify the main concentrated and tail distribution intervals in the grayscale distribution. The low-to-medium grayscale concentrated areas typically correspond to background or low-contrast regions, while the high-grayscale sparsely distributed areas typically correspond to abnormal response regions. By statistically analyzing the cumulative proportion of the grayscale distribution, two key dividing points are determined: one as the upper threshold for the low-contrast interval, selected from grayscale values corresponding to approximately 70% to 85% of the cumulative pixel proportion; the other as the lower threshold for the abnormal response interval, selected from grayscale values corresponding to approximately 90% to 98% of the cumulative pixel proportion. These thresholds are set to ensure that most background areas are classified as low-contrast regions while effectively separating high-grayscale abnormal response regions, thus achieving the distinction between background and defects. This represents a defect response enhancement image. This represents a piecewise or nonlinear grayscale mapping function. The specific approach involves performing piecewise or nonlinear processing on the grayscale mapping after determining an adaptive threshold: First, linear stretching is applied to low-contrast regions, remapping the grayscale range to a wider output range to improve overall contrast and amplify previously similar grayscale differences. Second, a smooth transition mapping is maintained for intermediate transition regions to avoid abrupt grayscale changes. Finally, nonlinear enhancement processing is applied to high-grayscale abnormal regions, such as using exponential enhancement to further increase the brightness of high-grayscale pixels and strengthen the prominence of abnormal response regions. During the execution process, the grayscale values of the detextured interference image are read pixel by pixel, and the corresponding mapping rule is selected based on the grayscale value interval to complete the grayscale conversion. Simultaneously, the mapping function is ensured to change continuously at the boundaries of each interval to avoid piecewise distortion of the image. The resulting defect response enhancement image improves background contrast, amplifies abnormal response regions, and enhances the accuracy of subsequent defect detection.
[0089] S3: Construct a defect candidate region based on the defect response enhancement image, and perform trajectory consistency screening on the defect candidate region in combination with the sliding direction constraint field, and output the final defect detection result.
[0090] S3 specifically includes:
[0091] S31: Perform adaptive threshold segmentation on the defect response enhancement image to achieve initial localization of the defect region;
[0092] S311, First, perform grayscale statistical analysis on the defect response enhancement image, determine an adaptive threshold based on the image's grayscale distribution characteristics, and extract pixels whose pixel values exceed the adaptive threshold to form a binary segmentation result; the segmentation process can be represented as:
[0093] ;
[0094] in, This represents the result of binary segmentation. This represents a defect response enhancement image. The adaptive threshold is used to separate abnormal response regions from background regions in the defect response enhancement image. The adaptive threshold is typically set to 1.1 to 1.8 times the overall grayscale mean of the defect response enhancement image, or to the grayscale value corresponding to the cumulative grayscale distribution in the 85% to 97% range. When the background region in the defect response enhancement image is relatively uniform and the abnormal region contrast is obvious, the adaptive threshold can be appropriately reduced to improve the detection sensitivity of small defects. When there are still strong residual textures, local reflections, or noise interference in the image, the adaptive threshold should be appropriately increased to avoid a large amount of background noise being mis-segmented as defect regions. Based on the enhancement processing after S23, the real defect region usually exhibits a significantly higher grayscale response than the background region, while the background region is mostly concentrated in the low to medium grayscale range. Therefore, by setting the threshold near the tail of the grayscale distribution, the high grayscale region corresponding to the real defect can be preserved, while suppressing most of the background and residual texture interference. Furthermore, since the image brightness, reflection characteristics, and texture intensity vary under different spraying conditions, a dynamic adjustment method based on grayscale statistical results can improve the stability and adaptability of defect segmentation.
[0095] S312, for a binary image with values... Connectivity analysis is performed on the pixels to divide the spatially connected set of pixels into multiple initial defect regions. Then, morphological closing operations are performed on each initial defect region to fill the small holes within the region and smooth the boundaries, obtaining structurally complete defect candidate regions. The closing operation process can be represented as:
[0096] ;
[0097] The morphological closing operation in S312 specifically includes two consecutive steps: first, dilation is performed, followed by erosion. In the dilation stage, each defect pixel in the initial defect region is used as the center, and the region expands outward according to the shape and size of the preset structuring element. This fills the originally narrow gaps, small breaks, and local voids, while connecting the edges of adjacent defects. After dilation, the defect region becomes more continuous overall, but the boundaries may expand outward. Subsequently, erosion is performed. While maintaining the overall connected structure, the outwardly expanded boundaries are contracted, restoring the defect region to near its original size, while retaining the small holes and connecting areas that have been filled. Finally, a defect candidate region with smoother boundaries and a more complete interior is obtained. In practical implementation, structural elements are typically chosen as circular, rectangular, or elliptical neighborhoods. When the defect shape is slender, elliptical structural elements extending along the sliding direction are preferred to improve the connection effect on strip-shaped defects. When the defects are distributed in blocks, circular or square structural elements can be used. The size of the structural elements is generally set according to the minimum defect scale, so that the structural elements can fill small holes without causing excessive merging of multiple independent defect regions. Through the above processing, at least candidate defect regions are obtained, providing a basis for subsequent trajectory consistency analysis. This represents the result after the closing operation. Represents a structural element. This indicates an expansion operation. The erosion operation, or morphological closing operation, is an image processing method that optimizes the shape of image regions. Its main functions are to fill small holes inside the target region, connect adjacent broken areas, and smooth the target boundary. In defect detection, the initial defect region after threshold segmentation is prone to edge breakage, internal voids, or local gaps, resulting in an incomplete defect region. Therefore, morphological closing operation can make the defect region more continuous and complete, thereby improving the stability of subsequent defect screening and trajectory analysis.
[0098] S32: For each defect candidate region, the local principal direction information of the region is extracted by combining the sliding direction constraint field. Local statistics of the sliding direction constraint field are performed in the defect candidate region to obtain the dominant direction vector of the region. Then, with the local principal direction as a reference, the same spatial position is tracked and analyzed in multiple consecutive frames of defect response enhancement images.
[0099] Let the first The center position of a certain defect candidate region in the frame is Based on the motion offset relationship corresponding to the sliding direction constraint field, the predicted position in the next frame is:
[0100] ;
[0101] in, This represents the displacement along the sliding direction. In the actual detection process, we check whether there is a corresponding defect response area near the predicted position in multiple consecutive frames of images, and determine whether its spatial position change is consistent with the sliding direction constraint field. If a defect area consistent with the predicted position or within the tolerance range can be detected in multiple frames, then the defect candidate area is determined to have trajectory continuity and directional consistency in the time dimension.
[0102] S33: Based on the trajectory consistency analysis results, all candidate defect regions are screened. Candidate defect regions that meet the trajectory consistency conditions are identified as real defects and retained. Candidate defect regions that do not meet the trajectory consistency conditions are identified as false defects and eliminated. After screening, the spatial location, area size, and morphological features of each real defect are extracted, and the defect type is determined according to the preset defect classification rules. Finally, the location information, size information, and corresponding defect type of all real defects are marked and output as the final defect detection result, realizing the accurate identification and location of defects in sliding spray coatings.
[0103] This invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of this invention. To provide the public with a thorough understanding of this invention, specific details are described in detail in the following preferred embodiments; however, those skilled in the art will fully understand the invention even without these details. Furthermore, to avoid unnecessary misunderstanding of the essence of this invention, well-known methods, processes, procedures, components, and circuits are not described in detail.
[0104] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for detecting defects in sliding spray coatings based on image enhancement, characterized in that, Includes the following steps: S1: Obtain a continuous coating image sequence in the same area during the sliding spraying process, analyze the sliding direction of the coating image sequence, construct the corresponding sliding direction constraint field, and perform direction consistency enhancement processing on the coating image sequence based on the sliding direction constraint field to generate a direction-enhanced image sequence; S2: Input the orientation enhancement image sequence into the structure decoupling processing module, separate the orientation texture component and abnormal response component in the image according to the sliding orientation constraint field to obtain a detextured interference image, and perform adaptive contrast enhancement processing on the detextured interference image to generate a defect response enhancement image; S3: Construct a defect candidate region based on the defect response enhancement image, and perform trajectory consistency screening on the defect candidate region in combination with the sliding direction constraint field, and output the final defect detection result.
2. The image enhancement-based sliding spray coating defect detection method according to claim 1, characterized in that, S1 specifically includes: S11: By using a linear array image acquisition device fixedly installed above the spraying production line, during the process of the spraying nozzle moving along the sliding direction, the acquisition of coating surface images is triggered at fixed time intervals to obtain multiple consecutive images covering the same coating area, and the multiple consecutive images are arranged in the order of acquisition time to form the continuous coating image sequence. S12: For each frame of the continuous coating image sequence, extract the main direction features of the texture in the image, determine the sliding motion vector based on the displacement estimation of the image content between adjacent frames, establish a direction field pixel by pixel or local region by local region according to the projection direction and amplitude of the sliding motion vector on the image plane, and use the direction field as the sliding direction constraint field. S13: Based on the sliding direction constraint field, for each frame of the continuous coating image sequence, anisotropic diffusion filtering is performed along the main direction indicated by the sliding direction constraint field, while suppressing texture noise perpendicular to the main direction, enhancing the consistent structural information along the sliding direction in the image, and generating the direction-enhanced image sequence.
3. The image enhancement-based sliding spray coating defect detection method according to claim 2, characterized in that, S12 specifically includes: Gradient information is extracted from each frame of the continuous coating image sequence. A structure tensor is constructed at each pixel position based on the gradient information. Eigenvalue decomposition is performed on the structure tensor to obtain the main direction vector, which is used as the texture main direction vector at the pixel position. Displacement estimation is performed on adjacent frame images to determine the sliding motion vector, and the sliding motion vector is normalized in direction. At each pixel position, the texture main direction vector and the sliding motion vector direction are combined according to a preset fusion weight to obtain a fusion direction vector; The fused direction vector is normalized and a continuously distributed direction field is formed across the entire image. This direction field is then used as a sliding direction constraint field.
4. The image enhancement-based sliding spray coating defect detection method according to claim 2, characterized in that, The anisotropic diffusion filtering process includes: during image smoothing, applying diffusion control of different intensities to different directions based on the directional characteristics indicated by the sliding direction constraint location, so that pixel information along the sliding direction is enhanced and propagated, while restricting the propagation of pixel information perpendicular to the sliding direction, thereby performing directional denoising and structural enhancement while maintaining the boundary features of the coating structure.
5. The image enhancement-based sliding spray coating defect detection method according to claim 1, characterized in that, S2 specifically includes: S21: Input each frame of the orientation enhancement image in the orientation enhancement image sequence and the corresponding sliding direction constraint field into the structure decoupling processing module, set a directional filter along the main direction indicated by the sliding direction constraint field, align the main axis of the directional filter with the sliding direction, filter the orientation enhancement image to extract regular texture features extending along the sliding direction, and use the extracted regular texture features as orientation texture components. S22: Subtract the directional texture component from the original pixel value of the directional enhancement image to obtain the residual image signal, and take the high amplitude local change region in the residual image signal as the abnormal response component, retain the abnormal response component and suppress the residual noise, and output the detextured interference image. S23: Perform grayscale histogram statistical analysis on the detextured interference image, stretch and expand the grayscale range of the low-contrast region according to the adaptive threshold of grayscale distribution, and perform nonlinear enhancement mapping on the high grayscale abnormal region to generate a defect response enhancement image, wherein the abnormal response component corresponding to the defect is assigned a higher pixel value than the background region in the defect response enhancement image.
6. The image enhancement-based sliding spray coating defect detection method according to claim 5, characterized in that, S22 specifically includes: Decouple the direction-enhanced image from the corresponding sliding direction constraint field input structure processing module; The structural decoupling processing module acquires sliding direction information at each pixel position, constructs a directional filtering window along the sliding direction, performs directional filtering processing on the directional enhancement image to extract regular texture features continuously distributed along the sliding direction, and obtains directional texture components; the directional texture components are subtracted from the original pixel values of the directional enhancement image to obtain residual image signals; The structural decoupling processing module performs amplitude statistical analysis on the residual image signal, filters out high-amplitude local change regions as abnormal response components based on a preset response threshold, and determines low-amplitude regions as background candidate regions. The structural decoupling processing module performs connectivity constraints and minimum scale filtering on the abnormal response components, retaining spatially continuous abnormal regions that meet the size requirements; it performs smoothing suppression processing on the background candidate regions to reduce residual noise, and then merges the retained abnormal response components with the suppressed background regions to output a texture-free image.
7. The image enhancement-based sliding spray coating defect detection method according to claim 5, characterized in that, The 23 specifically includes: Perform pixel-by-pixel gray-level statistics on the texture-detextured image and construct a gray-level histogram; Based on gray-level histograms, the main peak region, transition region and high gray-level tail region in gray-level distribution are identified, and the boundary between background region and abnormal response region is determined by gray-level cumulative distribution. The image contrast status is determined based on the degree of concentration of grayscale distribution, and an enhancement strategy is determined accordingly; Gray-scale stretching is performed on low-gray-scale concentrated areas to expand the gray-scale dynamic range; smoothing mapping is performed on transition areas to maintain gray-scale continuity; and nonlinear enhancement is performed on high-gray-scale tail areas to improve the abnormal response amplitude. Mapping is performed pixel by pixel according to the corresponding gray-scale interval across the entire image to output a defect response enhanced image.
8. The image enhancement-based sliding spray coating defect detection method according to claim 1, characterized in that, S31 specifically includes: S31: Perform adaptive threshold segmentation processing on the defect response enhancement image, mark the set of connected pixels whose pixel values exceed the adaptive threshold as the initial defect region, and perform morphological closing operation on each initial defect region to fill the small holes to obtain the defect candidate region. S32: For each defect candidate region, extract the local principal direction of the corresponding defect candidate region in the sliding direction constraint field, traverse the same spatial position in multiple consecutive frames of defect response enhancement images along the local principal direction, and determine whether the corresponding defect candidate region appears continuously between multiple frames with an offset consistent with the sliding direction constraint field.
9. The image enhancement-based sliding spray coating defect detection method according to claim 8, characterized in that, The morphological closing operation includes filling small holes to obtain defect candidate regions. Specifically, for each initial defect region, the corresponding structural element is selected based on the morphological characteristics of the defect region. The initial defect region is expanded using the structural element to fill the small gaps, local fracture areas and internal pores in the initial defect region, and to connect the edges of adjacent defects. After the expansion process is completed, the same structural element is used to perform erosion on the expanded area to shrink the outer boundary, while preserving the filled hole area and the connected continuous area. After the corrosion treatment is completed, the boundary is smoothed to output a defect candidate region with continuous boundary and complete interior.
10. The image enhancement-based sliding spray coating defect detection method according to claim 9, characterized in that, S3 further includes retaining the defect candidate regions that meet the trajectory consistency condition as real defects, removing the defect candidate regions that do not meet the trajectory consistency condition as false defects, and marking and outputting the position, size and defect type of each retained real defect as the final defect detection result.