Spark plug micro-crack defect recognition method based on high-resolution imaging feature analysis
By employing high-resolution imaging feature analysis and multi-dimensional feature fusion, the problems of image distortion and anti-interference in spark plug microcrack identification were solved, achieving efficient, accurate, and automated identification of spark plug microcracks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-23
- Publication Date
- 2026-06-23
Smart Images

Figure CN122265715A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spark plug microcrack defect identification technology, specifically a spark plug microcrack defect identification method based on high-resolution imaging feature analysis. Background Technology
[0002] Spark plugs are a crucial component of internal combustion engines. As a key part for igniting the air-fuel mixture, their performance directly affects engine efficiency and emissions. During spark plug production, traditional defect detection methods mainly rely on manual inspection or simple visual checks. However, these methods suffer from slow speed, low accuracy, and cumbersome operation, making it difficult to meet the requirements of efficient and precise production. Therefore, achieving efficient, accurate, and automated spark plug crack defect identification has become an urgent problem to be solved in the current technical field. Meanwhile, the surface of a spark plug is a complex curved surface, and under natural light or conventional illumination, the contrast of crack features is low, and the imaging is not obvious, easily leading to missed detections. Existing technologies face many problems when using high-resolution imaging for full-surface inspection. First, direct imaging of the curved surface leads to image distortion and blurred details, making accurate global observation difficult. Second, existing technologies face difficulties in surface unfolding and alignment during image stitching, affecting subsequent analysis. Third, when identifying microcracks and magnifying local areas, the imaging depth and resolution often decrease sharply, making it impossible to stably capture the complete morphology of sub-millimeter-level cracks. Furthermore, existing methods often rely on operator experience or simple image thresholding, are sensitive to illumination, and have weak anti-interference capabilities, making it difficult to achieve automated, quantitative, and accurate identification and evaluation of microcracks. Therefore, there is an urgent need for a new defect identification method that can adapt to the curved surface characteristics of spark plugs, overcome the limitations of high-resolution imaging, and significantly enhance crack features.
[0003] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0004] The purpose of this invention is to provide a method for identifying spark plug microcrack defects based on high-resolution imaging feature analysis, so as to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides the following technical solution: A method for identifying spark plug microcrack defects based on high-resolution imaging feature analysis, comprising the following steps: Step 1: Analyze the size of the cracks in the spark plug sample with cracks, determine the basic length and basic adjustment value of the identification grid based on the size analysis results, calculate the grid length of the identification grid based on the basic length and basic adjustment value, and regularly divide the outer surface of the spark plug to be identified to form multiple identification grids for crack detection. Step 2: Obtain the diameter of the spark plug at each identification grid location. Based on the grid length and the diameter of the area where the identification grid is located, calculate the beam illumination angle corresponding to each identification grid. Use a high-resolution camera to obtain the illumination image sequence of each identification grid under different illumination directions at the beam illumination angle. Step 3: After preprocessing the illumination image sequence for the same identification grid, calculate the surface normal field and reflectance map of each grid to be identified using photometric stereo technology. By extracting the gray values of the same identification grid under different illumination directions, calculate the variance map and minimum projection map of the pixel gray values. Step 4: Calculate the crack feature value of each pixel based on the surface normal vector field, reflectivity map, variance map, and minimum projection map. Calculate the crack identification threshold by statistically analyzing the normal distribution of the crack feature values of each image to be identified. Mark the pixels as crack points based on the crack feature values and the crack identification threshold. Determine whether there is a crack in the identification grid based on the number and location of the crack points.
[0006] Furthermore, the method for determining the basic length and basic adjustment value of the identification grid is as follows: The dimensions of each spark plug sample with cracks are measured, and the measurement interval is set. The width of the crack is measured at each interval point. For intersecting cracks, the intersection point is used as the boundary point of the crack. Based on the width data of the measured samples, the samples are sorted in ascending order. The minimum identifiable width of the crack is used as the base length. The base adjustment value is determined based on the non-uniformity of the crack distribution in the axial and circumferential directions. The grid length of the identification grid is calculated based on the base length and the base adjustment value.
[0007] Furthermore, the method for calculating the beam illumination angle is as follows: in, The beam illumination angle, For grid length, The diameter of the spark plug at the location of the grid is [diameter]. Set the minimum illumination angle.
[0008] Furthermore, the method for acquiring the illumination image sequence of each identification grid under different illumination directions at the beam illumination angle using a high-resolution camera is as follows: According to the beam illumination angle, the multi-directional light source is controlled to illuminate each identification grid from at least three different directions. Under each illumination direction, the corresponding grid illumination image is acquired using a high-resolution industrial camera, thereby forming an illumination image sequence of the same identification grid under multiple illumination conditions.
[0009] Furthermore, the method for preprocessing the illumination image sequence for the same recognition grid is as follows: For the same grid of illumination image sequences, one image is selected as the reference image, and the remaining images are used as images to be registered. The SIFT feature detection algorithm is used to extract the key point feature descriptors of the illumination images to be aligned. The fast nearest neighbor matching algorithm is used to find the corresponding feature point pairs between the reference image and the images to be registered, and the affine transformation matrix is calculated based on the corresponding feature point pairs. The bilinear interpolation algorithm is used to perform spatial geometric transformation and resampling coordinate mapping on the images to be registered.
[0010] Furthermore, the method for calculating the surface normal field and reflectance map of each grid to be identified using photometric stereo technology is as follows: A light source direction matrix is constructed based on the direction of the light beam illumination. The gray values of the same pixel under different light beam illuminations in the aligned illumination image sequence are extracted and a brightness observation vector is formed. A set of linear mathematical equations between the brightness value and the light source direction and the surface normal are established based on the Lambertian diffuse reflection physical model. The gradient vector containing surface geometric information is solved by matrix operation using the least squares method. The magnitude of this vector directly corresponds to the reflectivity map of the surface material. After normalizing the gradient vector, the surface normal vector field describing the surface micro-geometric tilt direction is obtained. The specific steps for taking the grayscale values of the same identification grid under different lighting directions and calculating the variance map and minimum value projection map of the pixel grayscale values are as follows: Based on the aligned illumination image sequence, by iterating through the gray values of the same pixel location under all beam illumination directions, the minimum value is selected as the response value of the pixel in the minimum value projection map. Simultaneously, the gray statistical mean of the pixel location under different illumination changes is calculated, and its sample variance is calculated according to the dispersion formula to generate a variance map reflecting the surface dynamic illumination response sensitivity.
[0011] Furthermore, the method for calculating the crack feature value of each pixel based on the surface normal vector field, reflectivity map, variance map, and minimum projection map is as follows: The gradient magnitude of the surface normal field is calculated based on the surface normal field. The reflectance map is inverted and normalized to obtain the diffuse reflection anomaly feature value. The variance map of the pixel gray value is retained as the light and shadow fluctuation feature value. The minimum projection map is inverted to obtain the dark area sinking feature value. The gradient magnitude, diffuse reflection anomaly feature value, light and shadow fluctuation feature value, and dark area sinking feature value are weighted and summed to obtain the crack feature value of each pixel.
[0012] Furthermore, the method for calculating the crack identification threshold by statistically analyzing the normal distribution of crack feature values for each image to be identified is as follows: The mean and variance of the crack feature values are calculated based on the number of pixels in each grid. Perform normal distribution statistics, based on the mean and variance According to the formula Calculate the crack detection threshold ,in To improve recognition accuracy, pixels with crack feature values greater than the crack recognition threshold are marked as crack points.
[0013] Furthermore, the calculation method for determining whether the identification mesh has cracks based on the number and location of crack points is as follows: in, This is the crack assessment value. For the first Crack feature values of pixels marked with crack points In order to be with the first The first pixel adjacent to the first Crack feature values of pixels marked with crack points For the first The pixel and its neighboring pixel pixel distance between pixels This represents the number of pixels on the spark plug surface. In order to be with the first The number of pixels adjacent to each pixel that is marked as a crack point; A crack assessment threshold is set, and meshes with crack assessment values greater than the crack assessment threshold are considered to have cracks.
[0014] Compared with the prior art, the beneficial effects of the present invention are: This invention analyzes the size of cracks in historical spark plugs, divides the spark plug surface into identification grids by calculating the grid length, calculates the beam illumination angle based on the base length and the diameter of the area where the identification grid is located, and obtains the illumination image sequence of the grid under different beam illumination directions. For the illumination image of the same grid, the surface normal vector field, reflectivity map, variance map of gray values and minimum projection map of each grid are calculated. The existence of cracks is determined by calculating the crack evaluation value of each grid. By introducing data-driven adaptive mesh generation and multi-dimensional high-resolution imaging feature fusion, the inherent defects of traditional methods are effectively overcome. Based on the mesh parameters determined by the statistical analysis of real crack sample sizes, the detection resolution and crack physical scale are accurately matched. By calculating the beam illumination angle adapted to the mesh size and curvature, and combining it with multi-directional photometric stereo imaging technology, the surface micro-geometry (normal vector field) and optical properties (reflectivity map) unaffected by surface curvature and reflection are stably reconstructed, eliminating the negative impact of complex surfaces on imaging consistency. At the same time, the four complementary physical features of surface normal vector field, reflectivity map, variance map and minimum projection map are innovatively weighted and fused to generate comprehensive feature values that are highly specific to cracks, greatly enhancing the characterization ability and anti-interference ability of the features. This scheme realizes the quantitative evaluation of crack structure continuity and can effectively distinguish between real linear cracks and discrete noise points, thus making reliable existence determinations in complex backgrounds. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the overall method flow of the present invention. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0017] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0018] Example: Please see Figure 1 The present invention provides a technical solution: A method for identifying spark plug microcrack defects based on high-resolution imaging feature analysis, comprising the following steps: Step 1: Perform size analysis on the cracks in the spark plug sample with cracks, determine the basic length of the identification grid based on the size analysis results, and determine the basic adjustment value based on the minimum identifiable width of the crack. Calculate the grid length of the identification grid based on the basic length and the basic adjustment value, and regularly divide the outer surface of the spark plug to be identified to form multiple identification grids for crack detection.
[0019] This step transforms experience-based or fixed-size mesh generation into a data-driven, feature-adaptive intelligent meshing strategy. Its beneficial effects lay a quantifiable and optimizable spatial analysis foundation for subsequent high-precision identification. Specifically, this step first obtains the statistical and spatial distribution characteristics of crack width through systematic dimensional analysis of sample cracks. The "basic length" determined by this essentially anchors the smallest detectable physical feature scale, ensuring that the method's theoretical detection limit matches the minimum physical size of the crack, avoiding the missed detection of minute cracks due to excessively large meshes. Simultaneously, the introduced "basic adjustment value" cleverly addresses the differences in the probability and morphology of cracks that may exist on the spark plug surface. This ensures that the mesh generation is not mechanically uniform in the circumferential and axial directions. This non-uniform, regular meshing, while guaranteeing full coverage, achieves adaptive optimization of computational resources, avoiding the huge image acquisition and processing overhead caused by using excessively small meshes. This not only improves the sensitivity and specificity of detection from the source, but also provides a standardized processing unit for subsequent processes, enabling photometric stereo, feature fusion and statistical judgment to be performed efficiently in local areas of appropriate scale, thereby driving the method towards higher accuracy, higher efficiency and stronger engineering applicability as a whole.
[0020] In this embodiment, the method for determining the basic length and basic adjustment value of the identification grid is as follows: The dimensions of each spark plug sample with cracks are measured, and the measurement interval is set. The width of the crack is measured at each interval point. For intersecting cracks, the intersection point is used as the boundary point of the crack. Based on the width data of the measured samples, the samples are sorted in ascending order. The minimum identifiable width of the crack is used as the base length. The base adjustment value is determined based on the non-uniformity of the crack distribution in the axial and circumferential directions. The grid length of the identification grid is calculated based on the base length and the base adjustment value.
[0021] This method determines mesh parameters by systematically measuring the physical dimensions of actual crack samples and analyzing their spatial distribution patterns. Its core advantage lies in achieving a fundamental shift in mesh generation from "empirical fixed parameters" to "data-driven adaptive parameters." First, by meticulously measuring the dimensions of multiple real crack samples, the method obtains the actual statistical distribution data of crack width. The key physical indicator of "minimum identifiable width" is directly anchored as the base length of the mesh. This ensures that the subsequent imaging and recognition processes strictly match the scale of real-world defects in terms of spatial resolution, guaranteeing the method's theoretical detection capability for even the finest cracks from the outset and avoiding the risk of missed detections due to overly coarse mesh generation. Simultaneously, this method innovatively introduces a "base adjustment value" determined based on the non-uniformity of crack distribution in the axial and circumferential directions. This means that the final mesh generation is not mechanically uniform but intelligently adjusted according to the historical probability and morphological characteristics of cracks occurring in different areas of the spark plug. For example, a denser mesh is automatically used in easily cracked areas such as the thread root to improve detection sensitivity, while a wider mesh is appropriately used in relatively flat, low-risk areas to save computational resources. This data-driven parameter determination method constructs a quantifiable and interpretable optimized spatial analysis framework for the entire identification scheme that is deeply consistent with the physical nature and statistical laws of defects. This allows subsequent steps such as beam angle calculation, image acquisition, feature extraction, and crack determination to be performed on a scientifically calibrated, variable-resolution cell. This significantly improves the reliability, adaptability, and processing efficiency of the detection method at the global level, overcoming the inherent contradiction between accuracy and efficiency in fixed-grid methods.
[0022] Step 2: Obtain the diameter of the spark plug at the location of each identification grid. Based on the grid length and the diameter of the area where the identification grid is located, calculate the beam illumination angle corresponding to each identification grid. Use a high-resolution camera to obtain the illumination image sequence of each identification grid under different illumination directions at the beam illumination angle.
[0023] Based on the location of the identified grid, the diameter of the spark plug at the grid's center is measured. This step dynamically correlates the grid's geometric properties with optical detection parameters, achieving adaptive optimal illumination for local surface features. This solves the common problem that traditional uniform or fixed-angle illumination cannot effectively highlight the three-dimensional features of microcracks on complex surfaces. Compared to existing technologies using a globally uniform light source or simple ring light, this method, by calculating the dynamic beam illumination angle based on the real-time diameter and base length of each grid location, ensures that the incident light covers the entire grid area at a specific angle that best matches the local curvature. This fundamentally avoids illumination blind spots, overexposure due to surface undulations, or shadow occlusion, ensuring that subsequent images have uniform and consistent illumination conditions within each local grid. Furthermore, multi-directional, multi-angle sequential illumination can "depict" the three-dimensional morphology of the crack from different directions. Cracks with specific orientations always produce the strongest contrast under tilted illumination from a certain direction, thus being clearly captured by the high-resolution camera. This step provides a multi-source image input that strictly conforms to the assumptions of the Lambert model for subsequent photometric stereoscopic reconstruction of high-precision surface normal vector fields and reflectivity maps. It also provides a rich data foundation of illumination variation for calculating variance maps and minimum projection maps. It is a key technical step to ensure that the weak optical signals of microcracks are reliably separated and enhanced from complex backgrounds.
[0024] In this embodiment, the method for calculating the beam illumination angle is as follows: in, The beam illumination angle, Based on length, The diameter of the spark plug at the location of the grid is [diameter]. Set the minimum illumination angle.
[0025] The formula for calculating the beam illumination angle enables adaptive matching between illumination conditions and local surface geometry and target defect size, thereby providing optimized defect highlighting illumination for each individual mesh cell on complex surfaces. This ratio essentially calculates the central angle corresponding to an arc segment with the radius at the grid as a reference and the base length as the span. It directly relates to the potential range of crack extension on the curved surface and the local curvature. Multiplying this radian value by 180 / π to convert it to degrees yields a base tilt angle that matches the local geometry. This angle ensures that when a beam of light shines at this angle, its rays can fully cover and "glide" across a curved area comparable to the size of a typical crack, thereby maximizing the contrast between the crack and the surrounding normal area caused by the height difference in shadows or highlights. The formula introduces a minimum illumination setting angle. This is a safeguard parameter that sets the minimum lower limit of the beam illumination angle. Its function is to prevent the calculated base tilt angle from being too small in areas with a larger spark plug diameter, leading to excessively "frontal" light illumination and weakening the imaging contrast of textures and micro-undulations. This is achieved through superposition. This ensures that even in large-diameter areas, the beam maintains a minimum tilt angle sufficient to produce effective contrast.
[0026] In this embodiment, the method for acquiring the illumination image sequence of each identification grid under different illumination directions at the beam illumination angle using a high-resolution camera is as follows: According to the beam illumination angle, the multi-directional light source is controlled to illuminate each identification grid from at least three different directions. Under each illumination direction, the corresponding grid illumination image is acquired using a high-resolution industrial camera, thereby forming an illumination image sequence of the same identification grid under multiple illumination conditions.
[0027] Step 3: After preprocessing the illumination image sequence for the same identification grid, calculate the surface normal field and reflectance map of each grid to be identified using photometric stereo technology. By extracting the gray values of the same identification grid under different illumination directions, calculate the variance map and minimum projection map of the pixel gray values.
[0028] This step, driven by multi-source information fusion and physical models, extracts and reconstructs deep surface features from multi-angle illumination images that are extremely sensitive to microcracks, surpassing traditional two-dimensional grayscale images. It effectively solves the problem of blurred crack features and high false detection rate caused by interference from surface reflections, oil stains, scratches, etc., due to reliance on a single illumination image in existing technologies. By precisely aligning the images, pixel-level misalignment caused by minute camera displacement or curved surface imaging is eliminated, ensuring that all subsequent calculations are based on a strictly aligned pixel coordinate system. This lays the data foundation for quantitative analysis. Using photometric stereo technology, grayscale changes under different lighting directions are transformed into microscopic geometric information (normal vector field) and material information (reflectivity map) of the surface. This is equivalent to transforming the influence of lighting from an "interference factor" into a "detection tool," allowing the local normal abrupt change and reflectivity anomaly caused by the physical surface fracture of the crack to be clearly quantified and presented, significantly enhancing the distinction between cracks and smooth backgrounds. By calculating the grayscale variance and minimum projection of the same pixel under different lighting conditions, a dynamic response map that is highly sensitive to lighting changes and a most stable dark state map that is insensitive to specular reflection are obtained. The former can amplify the shadow change characteristics of the crack edge, while the latter can effectively suppress bright spot noise caused by specular reflection.
[0029] In this embodiment, the method for preprocessing the illumination image sequence for the same recognition grid is as follows: For the same grid of illumination image sequences, one image is selected as the reference image, and the remaining images are used as images to be registered. The SIFT feature detection algorithm is used to extract the key point feature descriptors of the illumination images to be aligned. The fast nearest neighbor matching algorithm is used to find the corresponding feature point pairs between the reference image and the images to be registered, and the affine transformation matrix is calculated based on the corresponding feature point pairs. The bilinear interpolation algorithm is used to perform spatial geometric transformation and resampling coordinate mapping on the images to be registered.
[0030] After selecting a reference image (usually the one with the most uniform lighting conditions and the richest features), SIFT feature extraction is performed on each image to be registered, generating a large number of key point feature descriptors with high-dimensional descriptive vectors. A fast nearest neighbor matching algorithm is used to find the two closest and second closest candidate matching points in the reference image for each key point of the image to be registered, thereby initially filtering out a large number of erroneous matches. Based on these corresponding point pairs after filtering, a robust estimation method is used to iteratively calculate the optimal affine transformation matrix model, thereby obtaining an accurate and stable spatial transformation relationship. Using the solved affine transformation matrix, the entire image to be registered is inversely mapped. A bilinear interpolation algorithm is used to calculate the weighted average gray value of the non-integer coordinate position of each pixel in the output image grid in the original image, and the value is assigned to generate a corrected image that is completely aligned with the reference image in space.
[0031] The SIFT feature detection algorithm is used to extract key point feature descriptors. Due to its invariance to image rotation, scaling, and brightness changes, it is particularly suitable for images taken from the same grid under different lighting directions. Even if the image has drastically different bright and dark areas due to different lighting angles, SIFT can still stably extract feature points based on the inherent texture and geometric structure of the surface, ensuring the robustness of the matching. By finding corresponding point pairs through the fast nearest neighbor matching algorithm and calculating the affine transformation matrix on this basis, it can accurately simulate and correct complex spatial deformations such as translation, rotation, and shearing caused by small fluctuations in camera viewpoint or surface tilt. Its correction accuracy far exceeds that of simple translation or rotation alignment. The bilinear interpolation algorithm is used to perform resampling, which can smoothly estimate the pixel value of the new coordinate position when performing spatial geometric transformations, effectively avoiding pixel holes and jagged edges caused by direct rounding, and maximizing the continuity and information integrity of the image.
[0032] In this embodiment, the method for calculating the surface normal field and reflectance map of each grid using photometric stereo technology is as follows: Based on the beam illumination direction and beam illumination angle, a light source direction matrix is constructed. The grayscale values of the same pixel in the aligned illumination image under different beam illumination are extracted and used to form a brightness observation vector. Based on the Lambert diffuse reflection physical model, a set of linear mathematical equations between the brightness value, the light source direction, and the surface normal are established. The gradient vector containing surface geometric information is solved by matrix operation using the least squares method. The magnitude of this vector directly corresponds to the reflectivity map of the surface material. After normalizing the gradient vector, the surface normal vector field describing the surface micro-geometric tilt direction is obtained.
[0033] After obtaining multiple illumination images of the same grid with strict alignment and different lighting directions, for each pixel position (x, y) in the image, a k-row, 3-column light source direction matrix S is first constructed based on the pre-calibrated beam direction vectors of each illumination (determined by the beam illumination angle and direction), where k is the number of illumination images and each row is a normalized light source direction vector. Simultaneously, the grayscale value corresponding to the pixel is extracted from the k images, forming a k-dimensional brightness observation vector I. If the surface satisfies the Lambertian reflection property, meaning its brightness is only proportional to the dot product of the surface normal vector n (unit vector) and the light source direction, as well as the surface reflectivity ρ, then a linear equation can be established: This is about unknown quantities ( This is an overdetermined system of equations (i.e., the gradient vector containing reflectance). Solving this system using the least squares method yields the optimal gradient vector for that pixel. The magnitude of this gradient vector is then calculated, and this magnitude represents the reflectance of that pixel. It reflects the inherent properties of the surface material. For spark plug ceramic insulators, subtle changes in the material properties of the cracked area or the scattering of light by open cracks may cause its reflectivity to differ from that of the surrounding area. Normalizing this gradient vector, i.e., dividing it by its modulus, yields the surface unit normal vector of that pixel. Its direction precisely describes the orientation of the microscopic region. After traversing all pixels, the reflectance map and surface normal field of the entire mesh are obtained. The normal field is extremely sensitive to the microscopic tilt of the surface; even very fine cracks will cause drastic changes in the normal vector at their edges, thus appearing as clear discontinuities or edge features in the normal vector map. In principle, this method transforms the absolute grayscale information, which is easily affected by lighting conditions, into more fundamental and stable surface geometry and material properties, providing feature data that is far more reliable and discriminative for subsequent crack identification than the original grayscale image.
[0034] The core advantage of this method in calculating the surface normal field and reflectance map for each grid lies in its ability to transform the grayscale information of multiple two-dimensional images under different illumination directions into a precise and stable quantitative description of the surface's three-dimensional microscopic geometric and physical properties. This overcomes the fundamental problems of severe light and shadow interference and difficulty in extracting three-dimensional features of defects in traditional single-image analysis. A light source direction matrix is constructed based on precisely known beam directions, providing accurate input parameters for the physical model. By extracting the grayscale values of the same pixel under different illuminations to form the observation vector, the information redundancy of multi-source data is fully utilized, enhancing the ability to resist random noise. A linear equation system is established based on the Lambert diffuse reflection model and solved using the least squares method. This allows the algorithm to robustly deduce the surface normal and reflectance that best conform to physical laws from brightness observations mixed with noise, achieving pixel-level high-sensitivity measurement of surface micro-undulations (such as depressions or edges caused by cracks).
[0035] The specific steps for extracting the grayscale values of the same grid under different lighting conditions and calculating the variance map and minimum value projection map of the pixel grayscale values are as follows: Based on the aligned illumination image, by iterating through the grayscale values of the same pixel location under all illumination angles, the minimum value is selected as the response value of the pixel in the minimum value projection map. Simultaneously, the grayscale statistical mean of the pixel location under different illumination changes is calculated, and its sample variance is calculated according to the dispersion formula to generate a variance map reflecting the surface dynamic illumination response sensitivity.
[0036] After obtaining ik images of the same grid with different lighting directions, strictly spatially aligned, a grayscale array of length ik is initialized for each pixel position (x, y) within the grid. The algorithm iterates through all ik images, reading the grayscale value of the pixel in each image and filling it into the array, thus completing data acquisition. Simultaneously, all grayscale values in the array are sorted, and the minimum value I_min(x, y) is quickly found. This value is directly assigned to the pixel response value at the corresponding coordinates (x, y) in the minimum value projection map. The generated minimum value projection map has an overall dark tone, with crack areas appearing as deeper dark lines or dark spots. While scanning the array, the sum and sum of squares of grayscale values are accumulated for efficient calculation of statistics. After traversal, the grayscale variance hσ of the pixel is calculated using the mean formula and variance formula. 2 ((x,y)), let this variance value hσ 2((x,y)) is assigned to the pixels at the corresponding coordinates in the variance map. The brightness distribution of the final variance map reflects the illumination stability of the surface texture, with bright areas corresponding to microscopic geometric features such as cracks that are extremely sensitive to the direction of illumination. This pair of feature maps complements the aforementioned surface normal field and reflectivity map, together forming a comprehensive feature set that describes the surface state from geometric, physical, and statistical perspectives. This provides extremely rich and complementary information input for subsequent deep learning models, enabling them to more accurately and robustly separate real crack defects from complex industrial background textures and various imaging artifacts.
[0037] This method calculates the variance map and minimum projection map of pixel grayscale values, enabling the characterization of surface response under varying illumination from two complementary statistical dimensions. This suppresses different types of interference noise and amplifies the characteristic signals of cracks, effectively solving the problems of feature blurring and misjudgment caused by local highlights, shadows, or uniform stains in traditional single-image analysis. The variance map, by calculating the dispersion of grayscale values for each pixel under different illumination directions, keenly captures the surface's sensitivity to illumination changes. Since cracks are physical surface fractures and discontinuities, their edges and depressions produce drastically changing shadows and highlights under different angles of illumination, resulting in grayscale value fluctuations (variance) in this area that are much higher than in flat, uniform background areas. Therefore, the variance map can transform this dynamic texture difference into a high-contrast image, greatly suppressing interference from uniform spots or stains that maintain constant grayscale values under various illumination conditions. Meanwhile, the minimum projection map, by selecting the minimum grayscale value of each pixel under all lighting conditions, essentially captures the signal that can still be observed at that point under the "most unfavorable lighting," or in other words, the "darkest state" after eliminating all possibilities of specular highlights. For cracks, regardless of the direction of light, shadows will always be produced at some angle in the depths of the crack or on steep edges, so their minimum value is usually very low; while for smooth curved surfaces, even if highlights are produced at certain angles, there is always a lighting direction that makes them appear darker, and the minimum value is not as extreme as at cracks. Therefore, the minimum projection map can effectively eliminate bright spot noise caused by specular reflection and highlight the persistent dark crack features.
[0038] Step 4: Calculate the crack feature value of each pixel based on the surface normal vector field, reflectivity map, variance map, and minimum projection map. Calculate the crack identification threshold by statistically analyzing the normal distribution of the crack feature values of each image to be identified. Mark the pixels as crack points based on the crack feature values and the crack identification threshold. Determine whether there is a crack in the identification grid based on the number and location of the crack points.
[0039] This step creatively fuses multidimensional physical features into a single quantitative index and achieves adaptive crack discrimination through data-driven statistical methods. Its beneficial effect lies in transforming the complex image pattern recognition problem into a rigorously computationally and optimizable signal detection problem. By weighted fusion of four features characterizing surface anomalies from different physical dimensions—the surface normal field, reflectivity map, variance map, and minimum projection map—a "crack feature value" is generated for each pixel. This design cleverly overcomes the risk of single features failing in specific scenarios. Multi-evidence cross-validation significantly improves the robustness and discriminative power of feature representation. This step uses a statistical method based on the normal distribution assumption to dynamically calculate the crack identification threshold. This approach ensures that the discrimination criteria no longer rely on fixed values set by human experience. It can adapt to natural fluctuations in surface characteristics of different regions and imaging conditions, spark plug models, and even different areas, greatly improving the generalization ability and stability of this solution. By introducing a "crack evaluation value" that integrates the spatial distribution relationship of crack points for comprehensive judgment, it effectively distinguishes between cracks with true structural continuity and randomly scattered noise points. While improving detection accuracy, it ensures the credibility of the physical meaning of the results. This step, as a key transformation hub from "feature extraction" to "defect decision-making", condenses the high-dimensional heterogeneous data generated in the previous steps into clear engineering judgments. Its data-driven, adaptive threshold, and spatial correlation analysis characteristics enable the whole method to maintain high sensitivity while having strong anti-interference ability, ultimately transforming fine imaging technology into stable and reliable automated detection capabilities.
[0040] In this embodiment, the method for calculating the crack feature value of each pixel based on the surface normal vector field, reflectivity map, variance map, and minimum projection map is as follows: The gradient magnitude of the surface normal field is calculated based on the surface normal field. This value is used to characterize the drastic change in surface normal caused by cracks. The reflectance map is reversed and normalized to obtain diffuse reflection anomaly feature values. The low reflectance characteristics caused by rough light absorption inside the crack are utilized. The variance map of pixel gray values is directly retained as the light and shadow fluctuation feature value. It is used to reflect the drastic shadow jump caused by the change of the crack edge with the light angle. The minimum projection map is reversed to obtain the dark area deep feature value. The aim is to convert the low gray value of the crack into a high value signal. By using a weighted allocation method, the crack feature value of each pixel is obtained by summing the weights assigned to the gradient magnitude, diffuse reflection anomaly feature value, light and shadow fluctuation feature value, and dark area sinking feature value.
[0041] This method calculates the crack feature value of each pixel to construct a robust, physically meaningful and interpretable composite defect characterization index, thereby transforming the complex visual pattern recognition problem into a more reliable signal detection and decision problem.
[0042] This method achieves the synergistic capture of multi-dimensional attributes of cracks by carefully selecting and fusing four features with clear physical meanings. The surface normal gradient magnitude accurately depicts the abrupt changes in surface geometry caused by cracks as physical trenches. Outliers in the reflectance map directly reflect the dark areas caused by the absorption characteristics of the rough surface inside the crack. The variance map captures the dramatic dynamic changes in brightness and darkness at the crack edge and inside under varying lighting conditions, which are distinct from smooth surfaces. The inverted value of the minimum projection map stably extracts the inherent dark features of the crack as a "deep trench" that still exist under the most unfavorable lighting conditions. The key advantage of this multi-feature strategy lies in its complementarity and redundancy. When a feature fails or becomes interfering due to surface contamination, minor scratches, or uneven lighting (for example, non-crack stains may also cause a decrease in reflectance, but their geometric shape is regular and the normal vector changes smoothly), other features can provide cross-validation, ensuring that only regions that simultaneously possess the multiple attributes of "geometric abrupt changes," "optical dark areas," "dynamic shadows," and "inherent deep darkness" are assigned high feature values, thereby significantly suppressing false alarms.
[0043] By using a weighted summation method, this multi-dimensional judgment is further integrated into a single scalar value, providing great flexibility and optimizability. The weights can be adjusted based on experimental data according to different spark plug materials, coatings, or typical defect morphologies (for example, for cracks with significant geometric deformation, the normal vector gradient is given a higher weight; for shallow cracks with significant light and shadow changes, the weight of the variance map can be increased). This makes the method highly adaptable to engineering applications, achieves a high degree of information condensation, and provides an effective basis for subsequent statistical threshold segmentation and pixel-level labeling. It greatly simplifies the decision-making process and avoids the dilemma of having to set complex judgment rules for multiple feature maps separately.
[0044] In this embodiment, the method for calculating the crack recognition threshold by statistically analyzing the normal distribution of crack feature values for each image to be identified is as follows: The mean and variance of the crack feature values are calculated based on the number of pixels in each grid. Perform normal distribution statistics, based on the mean and variance According to the formula Calculate the crack detection threshold ,in To improve recognition accuracy, pixels with crack feature values greater than the crack recognition threshold are marked as crack points.
[0045] The crack identification threshold is calculated based on normal distribution statistics, transforming the threshold setting from a static process that relies on subjective experience into a data-driven, adaptive, and dynamic optimization process. This achieves a balance of robustness, flexibility, and scientific rigor in complex and ever-changing real-world industrial testing scenarios.
[0046] By calculating the mean value of crack feature values of all pixels within the grid. and standard deviation Within a finite grid, the vast majority of pixels belong to a defect-free, normal background region, and their fused feature values should revolve around a certain central value (i.e., the mean). It exhibits random fluctuations (its dispersion is determined by the standard deviation of the pixel crack feature values). (Characteristics), this distribution approximates a normal distribution, while the true crack pixels, as a minority of outliers, will have feature values that significantly deviate from the mainstream group, falling at the tail end of the normal distribution. Therefore, using the formula As a threshold, a "normal range upper limit" based on background statistical characteristics is defined. Pixels with feature values exceeding this threshold are statistically considered to be extremely low-probability events and are therefore judged as anomalies (crack points). The crack identification threshold Qsb is no longer a fixed value, but rather varies with the characteristics of each grid cell (the mean of the pixel crack feature values). and standard deviation Dynamic changes. This automatically compensates for baseline drift in overall feature values caused by differences in surface curvature, local lighting, or minor material variations in different meshes, avoiding the problem of a fixed threshold being too loose in some areas (leading to false alarms) or too tight in others (leading to missed detections). The recognition accuracy k is a positive integer, providing a clear and intuitive control knob. Increasing the k value (e.g., using...) (or higher), meaning a stricter judgment standard, only capturing statistically significant anomalies, which helps suppress false alarms and is suitable for situations with extremely high reliability requirements; reducing the k value (e.g., using...) This makes it more sensitive, able to detect weaker or earlier signs of cracks, which helps improve the detection rate. This adjustability allows the method to flexibly adapt to different business needs, from "precise screening" to "rapid coarse inspection".
[0047] In this embodiment, the calculation method for determining whether the identification mesh has cracks based on the number and location of crack points is as follows: in, This is the crack assessment value. For the first Crack feature values of pixels marked with crack points In order to be with the first The first pixel adjacent to the first Crack feature values of pixels marked with crack points For the first The pixel and its neighboring pixel pixel distance between pixels This represents the number of pixels on the spark plug surface. In order to be with the first The number of pixels adjacent to each pixel that is marked as a crack point; A crack assessment threshold is set, and meshes with crack assessment values greater than the crack assessment threshold are considered to have cracks.
[0048] This formula calculates crack evaluation values by simulating the physical nature and spatial structural characteristics of cracks. Its core lies in using the weighted interaction between crack feature values and pixel distance to quantify the continuity and aggregation degree of cracks. The inner summation in the formula... For each marked crack point A local influence field based on spatial proximity was constructed, with adjacent crack points... eigenvalues Through the exponential decay function The function is weighted and varies with pixel distance. The rapid decay as the value increases accurately reflects the characteristic that defect pixels in a real crack should exhibit a continuous or near-neighbor distribution in physical space—that is, a true crack point not only has a high eigenvalue itself, but also has other high eigenvalue points around it to form a coherent linear or network-like pattern; while isolated noise points, even with high eigenvalues, contribute little due to the lack of spatial support from neighboring points. The outer layer summation applies to each crack point... its own eigenvalues The crack assessment value is obtained by multiplying it by its local influence field and then summing the results. This also amplifies the synergistic effect between high eigenvalue points and high spatial density regions. If crack points cluster within the mesh and eigenvalues are prominent, the crack evaluation value... The value is significantly improved; however, if the crack points are sparse or discrete, the crack assessment value will be significantly improved. The value remains low due to distance attenuation. Therefore, this formula, through the dual embedding of characteristic intensity and spatial correlation, transforms the morphological continuity, geometrical extension, and signal intensity of the crack into a comprehensive scalar index. This allows for accurate differentiation between the coherent structure of a real crack and the scattered distribution of random noise. Finally, by comparing the crack evaluation values... A reliable detection of crack presence is achieved by comparing the result with a preset threshold.
[0049] All the above formulas use dimensionless numerical values for calculation, and the numerical values substituted into the formulas are all in the International System of Units (SI). The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0050] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.
[0051] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0052] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for identifying spark plug microcrack defects based on high-resolution imaging feature analysis, characterized in that, The specific steps include: Step 1: Analyze the size of the cracks in the spark plug sample with cracks, determine the basic length and basic adjustment value of the identification grid based on the size analysis results, calculate the grid length of the identification grid based on the basic length and basic adjustment value, and regularly divide the outer surface of the spark plug to be identified to form multiple identification grids for crack detection. Step 2: Obtain the diameter of the spark plug at each identification grid location. Based on the grid length and the diameter of the area where the identification grid is located, calculate the beam illumination angle corresponding to each identification grid. Use a high-resolution camera to obtain the illumination image sequence of each identification grid under different illumination directions at the beam illumination angle. Step 3: After preprocessing the illumination image sequence for the same identification grid, calculate the surface normal field and reflectance map of each grid to be identified using photometric stereo technology. By extracting the gray values of the same identification grid under different illumination directions, calculate the variance map and minimum projection map of the pixel gray values. Step 4: Calculate the crack feature value of each pixel based on the surface normal vector field, reflectivity map, variance map, and minimum projection map. Calculate the crack identification threshold by statistically analyzing the normal distribution of the crack feature values of each image to be identified. Mark the pixels as crack points based on the crack feature values and the crack identification threshold. Determine whether there is a crack in the identification grid based on the number and location of the crack points.
2. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The method for determining the basic length and basic adjustment value of the identification grid is as follows: The dimensions of each spark plug sample with cracks are measured, and the measurement interval is set. The width of the crack is measured at each interval point. For intersecting cracks, the intersection point is used as the boundary point of the crack. Based on the width data of the measured samples, the samples are sorted in ascending order. The minimum identifiable width of the crack is used as the base length. The base adjustment value is determined based on the non-uniformity of the crack distribution in the axial and circumferential directions. The grid length of the identification grid is calculated based on the base length and the base adjustment value.
3. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The method for calculating the beam illumination angle is as follows: in, The beam illumination angle, For grid length, The diameter of the spark plug at the location of the grid is [diameter]. Set the minimum illumination angle.
4. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The method for acquiring the illumination image sequence of each identification grid under different illumination directions at the illumination angle of the light beam using a high-resolution camera is as follows: According to the beam illumination angle, the multi-directional light source is controlled to illuminate each identification grid from at least three different directions. Under each illumination direction, the corresponding grid illumination image is acquired using a high-resolution industrial camera, thereby forming an illumination image sequence of the same identification grid under multiple illumination conditions.
5. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The method for preprocessing the illumination image sequence for the same recognition grid is as follows: For the same grid of illumination image sequences, one image is selected as the reference image, and the remaining images are used as images to be registered. The SIFT feature detection algorithm is used to extract the key point feature descriptors of the illumination images to be aligned. The fast nearest neighbor matching algorithm is used to find the corresponding feature point pairs between the reference image and the images to be registered, and the affine transformation matrix is calculated based on the corresponding feature point pairs. The bilinear interpolation algorithm is used to perform spatial geometric transformation and resampling coordinate mapping on the images to be registered.
6. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The method for calculating the surface normal vector field and reflectance map of each grid to be identified using photometric stereo technology is as follows: A light source direction matrix is constructed based on the direction of the light beam illumination. The gray values of the same pixel under different light beam illuminations in the aligned illumination image sequence are extracted and a brightness observation vector is formed. A set of linear mathematical equations between the brightness value and the light source direction and the surface normal are established based on the Lambertian diffuse reflection physical model. The gradient vector containing surface geometric information is solved by matrix operation using the least squares method. The magnitude of this vector directly corresponds to the reflectivity map of the surface material. After normalizing the gradient vector, the surface normal vector field describing the surface micro-geometric tilt direction is obtained. The specific steps for taking the grayscale values of the same identification grid under different lighting directions and calculating the variance map and minimum value projection map of the pixel grayscale values are as follows: Based on the aligned illumination image sequence, by iterating through the gray values of the same pixel location under all beam illumination directions, the minimum value is selected as the response value of the pixel in the minimum value projection map. Simultaneously, the gray statistical mean of the pixel location under different illumination changes is calculated, and its sample variance is calculated according to the dispersion formula to generate a variance map reflecting the surface dynamic illumination response sensitivity.
7. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The method for calculating the crack feature value of each pixel based on the surface normal vector field, reflectivity map, variance map, and minimum projection map is as follows: The gradient magnitude of the surface normal field is calculated based on the surface normal field. The reflectance map is inverted and normalized to obtain the diffuse reflection anomaly feature value. The variance map of the pixel gray value is retained as the light and shadow fluctuation feature value. The minimum projection map is inverted to obtain the dark area sinking feature value. The gradient magnitude, diffuse reflection anomaly feature value, light and shadow fluctuation feature value, and dark area sinking feature value are weighted and summed to obtain the crack feature value of each pixel.
8. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The method for calculating the crack identification threshold by statistically analyzing the normal distribution of crack feature values for each image to be identified is as follows: The mean and variance of the crack feature values are calculated based on the number of pixels in each grid. Perform normal distribution statistics, based on the mean and variance According to the formula Calculate the crack detection threshold ,in To improve recognition accuracy, pixels with crack feature values greater than the crack recognition threshold are marked as crack points.
9. The spark plug microcrack defect identification method based on high-resolution imaging feature analysis according to claim 1, characterized in that: The calculation method for determining whether the identification grid has cracks based on the number and location of crack points is as follows: in, This is the crack assessment value. For the first Crack feature values of pixels marked with crack points In order to be with the first The first pixel adjacent to the first Crack feature values of pixels marked with crack points For the first The pixel and its neighboring pixel pixel distance between pixels This represents the number of pixels on the spark plug surface. In order to be with the first The number of pixels adjacent to each pixel that is marked as a crack point; A crack assessment threshold is set, and meshes with crack assessment values greater than the crack assessment threshold are considered to have cracks.