Aluminum profile defect analysis method and system based on texture features

By using a texture feature-based method combined with extrusion direction and progressive suppression, the problems of high false detection rate and computational complexity in aluminum profile surface defect detection are solved, achieving rapid and accurate defect identification and improved accuracy under low-cost conditions.

CN120747116BActive Publication Date: 2025-11-04NANJING XIANWEI INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511263034.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-05
Publication Date
2025-11-04
Estimated Expiration
2045-09-05

AI Technical Summary

Technical Problem

Existing technologies for detecting surface defects in aluminum profiles suffer from problems such as high false detection rates, sensitivity to on-site environments, and high computational complexity. They are difficult to effectively avoid interference from the inherent texture and high reflectivity of aluminum surfaces, and it is difficult to achieve rapid and accurate defect identification under low cost and low computational resource conditions.

Method used

By using a texture feature-based method, the surface image of the aluminum profile is acquired, the extrusion direction is determined, local blocks are divided to calculate the gradient direction and magnitude, the direction difference and local block confidence are generated, the confidence is judged, progressive texture suppression and edge detection are used to remove false edges, and defect detection results are generated.

Benefits of technology

It effectively distinguishes typical texture areas from suspected defect areas, reduces false positives, improves defect retention rate and detection accuracy, achieves a balance between accuracy and efficiency under low computing power conditions, and reduces the impact of repetitive textures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747116B_ABST
    Figure CN120747116B_ABST
Patent Text Reader

Abstract

The application provides an aluminum profile defect analysis method and system based on texture features, relates to the technical field of edge detection, and comprises the following steps: obtaining an aluminum profile surface image and determining an extrusion direction; dividing the image into multiple local blocks, calculating the gradient direction and amplitude of each block, and determining whether it belongs to a high-confidence texture area in combination with the direction difference and confidence; performing a first suppression coefficient on the high-confidence texture area to form a first processed image, then re-determining the updated image and applying a second suppression coefficient with stronger strength to the area still having obvious texture features to generate a second processed image; finally, performing defect recognition on the weakened image through edge detection, and removing residual texture false edges through direction consistency or connectivity analysis. The method has the advantages of light weight, low algorithm power consumption and high accuracy, and can be applied to online detection and quality control of aluminum profile surface defects in industrial production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of edge detection technology, and more specifically, to a method and system for analyzing defects in aluminum profiles based on texture features. Background Technology

[0002] Aluminum profiles are widely used in aerospace, rail transportation, automobile manufacturing, building structures, and industrial equipment manufacturing due to their light weight, high strength, excellent corrosion resistance, and ease of processing and manufacturing. During industrial production, the surface of aluminum profiles is prone to surface defects such as scratches, cracks, and pits due to the material's inherent properties, extrusion molding processes, and the production environment. These defects not only reduce the appearance quality of the product but may also affect structural performance and even lead to potential safety hazards. Therefore, strict real-time inspection of the surface quality of aluminum profiles is necessary in industrial production. Currently, machine vision technology exists as a method for detecting surface defects in aluminum profiles in the industrial field. However, due to the strong directionality of aluminum profile surface texture, the complex lighting conditions in the production environment, and the higher demands placed on the real-time performance and economy of detection equipment and processing algorithms by the on-site industrial environment, traditional detection methods generally suffer from high false detection rates, sensitivity to the on-site environment, and high computational complexity in practical applications.

[0003] Therefore, how to effectively avoid interference caused by the inherent texture and high reflectivity of aluminum surfaces during the detection of surface defects, reduce the false detection and missed detection rates, and achieve rapid and accurate defect identification under low cost and low computing resource conditions has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this application provides a method and system for analyzing defects in aluminum profiles based on texture features.

[0005] Firstly, this application provides a method for analyzing defects in aluminum profiles based on texture features, including:

[0006] Acquire a surface image of the target aluminum profile; the aluminum profile has an extrusion direction, which is determined by a global orientational analysis of the surface image;

[0007] The surface image is divided into multiple local blocks. The gradient direction and gradient magnitude of the pixels in each local block are calculated to generate an initial gradient direction distribution for each local block. Based on the initial gradient direction distribution, the principal gradient direction of each local block is calculated, and the principal gradient direction is compared with the extrusion direction to generate a direction difference. The confidence level is determined based on the direction difference and the confidence level of the local block to determine whether the local block belongs to a high-confidence texture region.

[0008] For local blocks identified as high-confidence texture regions, their gradient magnitudes are reduced according to a preset first suppression coefficient to obtain a first processed image. For the first processed image, the gradient direction and magnitude are calculated again for each local block to generate an updated local direction distribution. Based on the updated local direction distribution, a direction difference is generated and a confidence level is determined. For local blocks identified as high-confidence texture regions, progressive texture suppression is performed according to a preset second suppression coefficient to generate a second processed image.

[0009] Edge detection is performed on the second processed image to obtain preliminary edge data, which is then processed to remove false edges that conform to known texture features, and a defect detection result is generated.

[0010] As an optional implementation, determining whether a local block belongs to a high-confidence texture region based on the direction difference and the local block confidence includes:

[0011] When the deviation between the direction difference and the extrusion direction is less than a first preset threshold and the confidence level of the local block is higher than a second preset threshold, it is determined to be a high-confidence texture region.

[0012] As an optional implementation, the first suppression coefficient and the second suppression coefficient have different values; the second suppression coefficient is greater than the first suppression coefficient, so as to progressively deepen and weaken the high-confidence texture region during the iteration process.

[0013] As an optional implementation, before performing gradient direction and magnitude calculations again on each local block for the first processed image to generate an updated local orientation distribution, the method further includes:

[0014] High-reflectivity regions are identified based on the mean or variance of brightness of local blocks in the first processed image, and the second suppression coefficient is increased for the high-reflectivity regions.

[0015] As an optional implementation, obtaining and processing the preliminary edge data includes:

[0016] For each connected edge segment in the preliminary edge data, perform directional consistency analysis. If the deviation of the overall direction of the edge segment from the extrusion direction is less than a third preset threshold and its directional change rate is less than a fourth preset threshold, then it is determined to be a residual texture edge and removed; otherwise, it is retained.

[0017] As an optional implementation, the global directionality analysis includes:

[0018] The surface image is divided into several sub-regions;

[0019] Gradient direction statistics are performed for each sub-region to generate a corresponding local gradient direction distribution histogram;

[0020] The local gradient direction distribution histograms of each sub-region are weighted and merged to obtain the global gradient direction distribution of the surface image;

[0021] In the global gradient direction distribution, the direction with the highest peak value is determined as the extrusion direction.

[0022] As an optional implementation, based on the initial gradient direction distribution, the principal gradient direction of each local block is calculated, and the principal gradient direction is compared with the extrusion direction to generate a direction difference, including:

[0023] Histogram statistics are performed on the gradient directions of all pixels in the local block to generate a gradient direction distribution histogram of the local block. The horizontal axis of the histogram is the discretized direction angle, and the vertical axis is the frequency of the corresponding direction.

[0024] Determine whether there is a main direction peak with a concentration higher than the first threshold in the histogram. If so, take the corresponding direction angle as the main gradient direction of the local block.

[0025] If there are no directional peaks with high concentration, the directional distribution of the local block is considered to be discrete and is denoted as no principal direction.

[0026] For a local block with a principal gradient direction, calculate the angle difference between its principal gradient direction and the extrusion direction, and denot it as the direction difference.

[0027] As an optional implementation, the step of reducing the gradient magnitude of local blocks determined to be high-confidence texture regions according to a preset first suppression coefficient to obtain a first processed image includes:

[0028] Discrete wavelet transform is performed only on local blocks that have been identified as high-confidence texture regions, decomposing the local blocks into several sub-bands of different scales and directions;

[0029] Identify the sub-band corresponding to the main texture frequency component from the sub-bands, and denote it as the target sub-band;

[0030] For coefficients in the target sub-band whose magnitudes are greater than a preset threshold, a first suppression coefficient attenuation is performed;

[0031] No attenuation is performed for other subbands or coefficients that have not reached the threshold;

[0032] All subbands after differential suppression are subjected to inverse wavelet transform to obtain the suppressed image of the local block;

[0033] The suppressed images of each local block are merged into the overall image, and the first processed image is output as the input for subsequent gradient direction and magnitude calculations.

[0034] As an optional implementation, the step of performing inverse wavelet transform on all sub-bands after differential suppression processing to obtain the suppressed image of the local block includes:

[0035] The surface temperature distribution of the target aluminum profile during imaging is obtained, and the surface temperature distribution is compared with a first temperature threshold. Regions with temperatures higher than the first temperature threshold are marked as high-temperature regions.

[0036] Within the local block corresponding to the high temperature region, the temperature gradient is calculated based on the temperature difference between adjacent pixels. The region with a temperature gradient greater than the second temperature threshold is marked as the high temperature gradient region, and the rest is marked as the low temperature gradient region.

[0037] Read the principal gradient direction of the local block in the high-temperature region from the updated local direction distribution, compare the principal gradient direction with the extrusion direction, and if the difference between the two is less than the third direction threshold, mark it as a region with similar directions; if it is not less than the third direction threshold, mark it as a region with different directions.

[0038] For sub-band coefficients that belong to both high-temperature gradient regions and regions with similar orientations, the first amplitude attenuation is performed; for sub-band coefficients that belong to both high-temperature gradient regions and regions with different orientations, the second amplitude attenuation is performed; for sub-band coefficients in the low-temperature gradient region, the amplitude after differential suppression is maintained.

[0039] After the sub-band coefficient processing, the boundary between adjacent sub-regions is smoothed to reduce reconstruction discontinuities caused by different attenuation intensities;

[0040] An inverse wavelet transform is performed on the high-temperature region after subband coefficient processing and boundary smoothing to obtain the locally suppressed image of the high-temperature region; an inverse wavelet transform is directly performed on the non-high-temperature region based on the subband coefficients after differential suppression; and the locally suppressed images formed by the high-temperature region and the non-high-temperature region after the inverse wavelet transform are stitched together.

[0041] Secondly, this application provides a texture-feature-based aluminum profile defect analysis system, including:

[0042] The acquisition module is used to acquire a surface image of the target aluminum profile; the aluminum profile has an extrusion direction, which is determined by global directionality analysis of the surface image;

[0043] The first processing module is used to divide the surface image into multiple local blocks, calculate the gradient direction and gradient magnitude of pixels in each local block, and generate an initial gradient direction distribution for each local block; based on the initial gradient direction distribution, calculate the principal gradient direction of each local block, and compare the principal gradient direction with the extrusion direction to generate a direction difference; and determine the confidence level based on the direction difference and the confidence level of the local block to determine whether the local block belongs to a high-confidence texture region.

[0044] The second processing module is used to reduce the gradient magnitude of local blocks identified as high-confidence texture regions according to a preset first suppression coefficient to obtain a first processed image; for the first processed image, the gradient direction and magnitude are calculated again for each local block to generate an updated local direction distribution; based on the updated local direction distribution, a direction difference is generated and a confidence level is determined; for local blocks identified as high-confidence texture regions, progressive texture suppression is performed according to a preset second suppression coefficient to generate a second processed image.

[0045] The detection module is used to perform edge detection on the second processed image, obtain preliminary edge data and process it, remove false edges that conform to known texture features, and generate defect detection results.

[0046] Compared with existing technologies, this application employs a combination of directional difference and local block confidence to effectively distinguish typical texture areas from suspected defect areas, reducing the false negative impact of large-scale strong suppression on potential defects. By utilizing two reduction coefficients with different intensities—first gently then strongly—repetitive textures are gradually weakened, avoiding excessive initial suppression while ensuring sufficient reduction results. In the final detection stage, true defects can be identified more cleanly, with significantly reduced residual texture influence, thereby improving defect retention rate and detection accuracy. This approach fully utilizes the extrusion direction prior and ensures efficient texture weakening and good defect protection through two-step suppression, achieving a balance between accuracy and efficiency under relatively low computational power conditions in industrial settings. Attached Figure Description

[0047] Figure 1 A flowchart illustrating the aluminum profile defect analysis method based on texture features provided in this application embodiment;

[0048] Figure 2 This is a schematic diagram of an aluminum profile surface image acquisition method provided in an embodiment of this application;

[0049] Figure 3 A schematic diagram illustrating the extrusion direction of an aluminum profile provided in an embodiment of this application;

[0050] Figure 4 This is a schematic diagram of an aluminum profile defect analysis system based on texture features provided in an embodiment of this application.

[0051] Explanation of reference numerals in the attached diagram: 10, acquisition module; 20, first processing module; 30, second processing module; 40, detection module. Detailed Implementation

[0052] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0053] See Figure 1 The diagram shows a flowchart of a method for analyzing aluminum profile defects based on texture features, provided in an embodiment of this application. The method includes steps S101 to S104, wherein:

[0054] S101: Acquire a surface image of the target aluminum profile; the aluminum profile has an extrusion direction, which is determined by a global directionality analysis of the surface image;

[0055] S102: Divide the surface image into multiple local blocks, calculate the gradient direction and gradient magnitude of pixels in each local block, and generate an initial gradient direction distribution for each local block; based on the initial gradient direction distribution, calculate the principal gradient direction for each local block, and compare the principal gradient direction with the extrusion direction to generate a direction difference; determine the confidence level based on the direction difference and the confidence level of the local block, and determine whether the local block belongs to a high-confidence texture region;

[0056] S103: For local blocks identified as high-confidence texture regions, their gradient magnitudes are reduced according to a preset first suppression coefficient to obtain a first processed image; for the first processed image, gradient direction and magnitude calculations are performed again on each local block to generate an updated local direction distribution; based on the updated local direction distribution, a direction difference is generated and a confidence level is determined; for local blocks identified as high-confidence texture regions, progressive texture suppression is performed according to a preset second suppression coefficient to generate a second processed image;

[0057] S104: Perform edge detection on the second processed image to obtain preliminary edge data and process it to remove false edges that conform to known texture features and generate defect detection results.

[0058] For example, please see Figure 2 , Figure 2This is a schematic diagram of an aluminum profile surface image acquisition method provided in an embodiment of this application. In specific implementation, the surface image of the target aluminum profile is first acquired. The method of acquiring this image is not limited; it can be formed using an industrial camera, line scan camera, or other vision acquisition device. Provided that the image meets the requirements for subsequent processing, an appropriate resolution and frame rate can be selected based on the geometric dimensions of the aluminum profile, lighting conditions, and production cycle.

[0059] Since aluminum profiles often exhibit strong directional textures during extrusion or other forming processes, this application determines the extrusion direction of the aluminum profile by performing global directional analysis on the surface image. This extrusion direction can typically be determined by statistical analysis of the gradient direction histogram of the entire image or a portion of the sampled area to find the dominant peak direction in the directional distribution. Alternatively, it can be directly read from the extrusion equipment's machine information when available. Regardless of the method used, the obtained extrusion direction will be used as a reference for comparison with the dominant gradient direction of the local block in subsequent steps.

[0060] In the formal processing stage, the surface image is divided into several local blocks according to preset rules. Gradient calculations are then performed on the pixels within each local block, statistically forming the local gradient direction and magnitude distribution. Based on this distribution information, the principal gradient direction of each local block can be further calculated and compared with the extrusion direction to obtain the direction difference. Combining the direction difference with a comprehensive evaluation of the local block's confidence level, local blocks that are close to the extrusion direction and have high confidence are identified as high-confidence texture regions, while other regions are considered suspicious or low-confidence regions. The purpose of this is to protect areas with potential defects as much as possible in subsequent suppression steps, avoiding excessive attenuation of pixel information that may contain real cracks, scratches, or other morphological anomalies.

[0061] After initial segmentation, the gradient magnitude of high-confidence texture regions can be reduced according to a set first suppression coefficient, thus forming the first processed image. Regions not yet identified as high-confidence texture regions are left as is to prevent overlooking subtle irregularities. The gradient direction and magnitude are then recalculated on the first processed image, updating the local direction distribution and direction difference accordingly. If certain blocks are reconfirmed as consistently high-confidence texture regions, a second suppression coefficient can be applied for stronger suppression, further weakening their gradient magnitude. This gradually eliminates major repetitive extrusion textures without over-processing all regions with extrusion directions in the first round of suppression, thus preserving genuine defect features that may have the same or similar texture directions.

[0062] After the second suppressed image is completed, edge detection can be performed on it using algorithms such as Canny, Sobel, or other lightweight gradient calculation methods. This detection yields a preliminary set of edge data. Considering that some pseudo-edges may still remain on the extruded texture of the aluminum profile surface, this invention can combine methods such as orientation consistency or the rate of change of orientation of connected components in further processing steps to remove edge fragments that conform to typical texture directions and do not possess defect characteristics, ultimately obtaining the defect detection result.

[0063] If necessary, the test results can be output to the host computer or storage device in the form of defect coordinates, area, length and other information, according to the actual production situation, and connected with the subsequent quality control process.

[0064] In summary, this invention, without introducing high hardware resources, uses the extrusion direction prior as the core judgment criterion and combines a progressive suppression mode based on gradient direction distribution to effectively weaken the periodic texture of aluminum profiles and better preserve the edges of potential defects. It has the advantages of being lightweight, having low computing power consumption, and high accuracy, and can meet the needs of aluminum surface defect detection in actual industrial environments.

[0065] For example, on an aluminum profile production line, to achieve real-time quality inspection of the surface of the extruded aluminum profiles, an industrial camera with a resolution of 1920×1080 pixels and a frame rate of 25 frames per second is installed at the end of the production line. The camera continuously captures images of the flowing aluminum profiles from a frontal view, forming a series of surface image frames. To reduce interference from changes in ambient light, a common ring-shaped LED light source surrounds the camera to ensure relatively uniform lighting. Each captured image frame is 1920×1080 pixels in size and undergoes simple brightness normalization processing in the software. Then, within a predefined ROI (Region of Interest), a local gradient direction histogram is calculated, revealing a main peak direction in the image, with a significant peak. This direction is defined as the extrusion direction. .

[0066] Each frame of the image is divided into several local blocks of 32×32 pixels, totaling approximately 2000 blocks, the exact number depending on the image size. The Sobel operator is applied to each block to obtain pixel-level gradients, and then the principal gradient direction is determined. And the average gradient magnitude.

[0067] like and If the difference between the values ​​is less than the set 10° and the local block gradient concentration, i.e. the confidence level is higher than 0.8, it is marked as a "high confidence texture region".

[0068] Otherwise, mark it as a "suspicious area" and retain more original image information.

[0069] In the first identified "high-confidence texture region," its gradient magnitude is multiplied by 0.7, which is the first suppression coefficient. This represents an initial weakening of the texture in that area to avoid compressing texture intensity and interfering with defect observation. The first processed image is obtained by merging all suppressed and unsuppressed blocks. This significantly reduces overall texture noise while retaining a certain margin to prevent accidental damage to potential defect areas.

[0070] The first processed image is subjected to block gradient calculation again. Based on the updated direction difference and confidence level, if it is confirmed that some blocks are still close to the extrusion direction (e.g., the difference is less than 10° and the gradient concentration is higher than 0.8), then their gradient magnitude is further multiplied by 0.4, which is the second suppression coefficient, to form the second processed image. At this point, these regions can almost be considered as typical extrusion textures, so they can be more strongly weakened, thereby minimizing the interference of subsequent detection on periodic textures.

[0071] The Canny algorithm is used to extract edges from the second processed image, and false edges that are parallel to the extrusion direction and have a length and shape similar to texture lines are removed through simple connected component analysis. The edges that are ultimately retained are concentrated around horizontal scratches, cracks, or other small defects. At this point, the system further determines whether a defect is serious based on its shape features and outputs the coordinates, length, and severity of each defect in the detection results.

[0072] As an optional implementation, determining whether a local block belongs to a high-confidence texture region based on the direction difference and the local block confidence includes:

[0073] When the deviation between the direction difference and the extrusion direction is less than a first preset threshold and the confidence level of the local block is higher than a second preset threshold, it is determined to be a high-confidence texture region.

[0074] In practical implementation, to accurately delineate high-confidence texture regions, it is necessary to comprehensively consider the degree of deviation of local blocks relative to the extrusion direction and the confidence level of the gradient direction of the local blocks. Specifically, a first preset threshold for measuring the directional difference and a second preset threshold for measuring the concentration of gradient directions are first set. When the deviation between the main gradient direction and the extrusion direction of a local block is less than the first preset threshold, and the confidence level of the gradient direction of the local block is higher than the second preset threshold, the local block is identified as a high-confidence texture region.

[0075] The so-called "directional difference" can be measured by the absolute difference between the principal gradient direction of a local block and the extrusion direction. For example, if the first preset threshold is set to 10° in the embodiment, when the deviation between the principal gradient direction of a local block and the extrusion direction does not exceed 10°, it indicates that the overall texture direction of the local block is highly consistent with the extrusion direction; if it exceeds this range, it indicates that its directional characteristics may not match the typical extrusion texture, or that the local block may contain other abnormal structures.

[0076] The confidence level of gradient direction can be obtained by calculating the concentration of gradient directions of all pixels in the local block. For example, if a histogram of orientations is used, the gradient directions of pixels in the local block can be counted at a certain step size, such as 1° or 2°, and the proportion of the main peak direction can be observed. If the frequency proportion of the main peak direction exceeds a certain threshold, such as 0.8 in some embodiments, it indicates that the gradient distribution in the block is highly concentrated and directional, thus supporting that it belongs to a reliable extruded texture block. If the proportion of the main peak direction is relatively low, the texture direction of the block is relatively scattered, and it may also contain defects or noise components, making it difficult to determine the confidence level as high.

[0077] Using the above-described determination method, it is possible to quickly identify which blocks in a large batch of local blocks truly meet the characteristics of "obvious extrusion direction and high texture concentration". Blocks identified as high-confidence texture areas will be prioritized in subsequent suppression steps to ensure effective reduction of periodic texture intensity; while blocks with excessive deviation or insufficient confidence will be left as suspicious areas to retain more original information, so as not to suppress potential defective parts prematurely. In addition, to adapt to different extrusion processes or aluminum profile types, the first and second preset thresholds mentioned above can be appropriately adjusted based on experience or test results during actual deployment, thereby achieving the best balance between suppressing texture interference and avoiding missed defects.

[0078] For example, please see Figure 3 , Figure 3 This diagram illustrates the extrusion direction of an aluminum profile according to an embodiment of this application. The diagram shows a typical aluminum profile with a continuous and consistent surface texture distributed along its long axis, reflecting processing traces indicating the material flow direction during the extrusion process. The arrow in the diagram indicates the extrusion direction of the aluminum profile. This direction is used in image processing to compare with local texture directions to identify high-confidence texture areas and distinguish potential defects.

[0079] In an exemplary application of this invention, if the first preset threshold is set to 10° and the second preset threshold is set to 0.8, then when the deviation between the main gradient direction and the extrusion direction of a local block is less than 10°, and the frequency proportion of the main peak gradient direction within the local block exceeds 0.8, the block is automatically included in the high-confidence texture region, and the corresponding suppression coefficient is applied in the subsequent suppression process. Actual measurements show that this dual-threshold determination method can significantly reduce false edges of extruded textures while ensuring that defects such as microcracks and transverse scratches on the aluminum profile surface are not mistakenly detected, demonstrating the effectiveness and applicability of this invention in industrial defect detection.

[0080] As an optional implementation, the first suppression coefficient and the second suppression coefficient have different values; the second suppression coefficient is greater than the first suppression coefficient, so as to progressively deepen and weaken the high-confidence texture region during the iteration process.

[0081] In a further implementation, to achieve a better balance between suppressing and compressing textures and protecting defect signals, this invention sets two different suppression coefficients when suppressing high-confidence texture regions: a first suppression coefficient and a second suppression coefficient. The second suppression coefficient is larger than the first suppression coefficient, used to achieve progressively deeper texture weakening during iterative processing.

[0082] Within the initially identified high-confidence texture regions, a relatively weak first suppression coefficient is applied to reduce the gradient magnitude of the target region, generating a first processed image. This is because, although such regions are highly aligned with the extrusion direction, the possibility of micro-cracks or scratches embedded within them cannot be completely ruled out. Using a large attenuation ratio in the initial suppression might cause the defect signal to be lost along with the defect, hindering subsequent detection. Therefore, the first suppression coefficient is typically set to a relatively mild value, such as 0.5 or 0.7, allowing more potential defect information to be preserved.

[0083] After obtaining the first processed image, the orientation and confidence of each local block are recalculated. If a block still exhibits high-confidence texture features at this point, it means that the block did not show obvious defect features or abnormal directional distribution after the previous suppression round, and can basically be identified as the core region of the repetitive extrusion texture. Since weakening the true extrusion texture requires a higher intensity to obtain cleaner subsequent edge detection results, a second suppression coefficient greater than the first suppression coefficient, such as 0.6 or 0.8, is used in the second suppression stage to more significantly weaken the gradient magnitude of the block, thus obtaining the second processed image. At this point, these regions that have been suppressed twice are generally considered unlikely to hide real defects, because if there are indeed defect signals inside after the initial suppression, they will usually show changes in orientation and gradient or a decrease in confidence.

[0084] This progressive suppression approach, starting weak and then strengthening, avoids excessive attenuation of suspected defects in the first round, while the second round significantly weakens confirmed texture areas. This achieves a balance between suppressing texture noise and preserving defect details on aluminum profiles with abundant periodic textures. Furthermore, in industrial deployments, the specific values ​​of these two suppression coefficients can be adjusted based on factors such as production line quality requirements, image resolution, and defect type to meet different detection accuracy or speed needs. Practical testing shows that if the difference between the first and second suppression coefficients is too small, the incremental effect of the second suppression cannot be effectively highlighted; if the difference is too large, the first round of suppression is too weak, resulting in a high residual noise rate, while the second round of suppression is too strong, potentially damaging minor local defects. Therefore, in practice, it is necessary to combine experience or data analysis to select the optimal combination of the two suppression coefficients to maximize the effectiveness of the progressive weakening strategy.

[0085] In summary, by applying two rounds of different intensities to weaken high-confidence texture regions, this invention achieves "successive deepening" suppression of typical squeezed textures during batch image processing without significantly increasing algorithm complexity, effectively improving the accuracy and robustness of subsequent defect detection and edge recognition.

[0086] As an optional implementation, before performing gradient direction and magnitude calculations again on each local block for the first processed image to generate an updated local orientation distribution, the method further includes:

[0087] High-reflectivity regions are identified based on the mean or variance of brightness of local blocks in the first processed image, and the second suppression coefficient is increased for the high-reflectivity regions.

[0088] In the specific implementation, to further enhance the suppression effect on high-reflectivity areas, after obtaining the first processed image, a brightness evaluation operation is performed on each local block before performing the gradient direction and amplitude calculation again. Specifically, based on the mean brightness or brightness variance index of each local block in the first processed image, it can be determined whether there is a significant high-reflectivity phenomenon in the block. If a high-reflectivity area is detected, the area is marked as a "high-reflectivity block".

[0089] For the highly reflective blocks, the present invention appropriately increases the second suppression coefficient in the subsequent progressive suppression steps. For example, if the original value of the second suppression coefficient does not adequately account for the texture enhancement caused by light reflection, the coefficient can be lowered based on the brightness assessment results, resulting in a greater reduction in the gradient amplitude of the block. This adjustment can be quantified based on a preset brightness threshold, variance threshold, or a combination of both, and the local blocks are marked at the software level. Thus, when the local direction and amplitude calculation is performed again and the reliability is determined, the marked highly reflective blocks are suppressed more strongly, thereby effectively reducing the pseudo-texture interference caused by strong reflection.

[0090] This method enables rapid statistical analysis and comparison of the mean or variance of brightness in the first processed image at the software level without adding additional hardware, thereby distinguishing between regular texture areas and excessively reflective areas. For excessively reflective areas, continuing to reduce brightness solely based on the first suppression coefficient or the originally predetermined second suppression coefficient may not adequately offset the high brightness gradient noise caused by light reflection, leading to a large number of false edges in the subsequent edge detection stage. Increasing the second suppression coefficient can significantly reduce the gradient amplitude of high-reflectivity areas in the secondary suppression stage, thus avoiding excessive interference from such areas in subsequent processing. This method is particularly suitable for industrial environments with significant lighting variations, helping to maintain the overall accuracy and stability of aluminum profile surface defect detection.

[0091] As an optional implementation, obtaining and processing the preliminary edge data includes:

[0092] For each connected edge segment in the preliminary edge data, perform directional consistency analysis. If the deviation of the overall direction of the edge segment from the extrusion direction is less than a third preset threshold and its directional change rate is less than a fourth preset threshold, then it is determined to be a residual texture edge and removed; otherwise, it is retained.

[0093] In practical implementation, after edge detection of the second processed image is completed, a set of preliminary edge data can be obtained. Since the aluminum profile surface may still retain weak texture lines or pseudo-edges similar to the extrusion direction in some areas after undergoing two rounds of texture attenuation, this invention further distinguishes between true defect edges and residual texture edges through directional consistency analysis of connected edge segments, thereby improving the reliability of the final defect detection results.

[0094] To achieve the above objectives, this invention performs directional consistency analysis on each connected edge segment in the preliminary edge data. Specifically, the following steps can be adopted:

[0095] Step 1: Connected Edge Segment Extraction: In the obtained binary edge map, perform connectivity detection on adjacent pixels and treat all connected pixel sets as an edge segment. This can be achieved using 8-connectivity or 4-connectivity methods. After extraction, each connected edge segment typically consists of a series of continuous coordinate points.

[0096] Step 2: Overall direction calculation:

[0097] For each connected edge segment, the overall orientation can be estimated based on its spatial distribution or the local gradient direction of the corresponding pixels. If the coordinate distribution method is used, the main direction of the edge segment can be obtained by fitting a straight line or using the least squares method; if the pixel gradient method is used, the main direction angle can be obtained by synthesizing or statistically analyzing the pixel gradient vectors within the segment.

[0098] Step 3: Directional Consistency Determination

[0099] The overall direction of the edge segment is compared with the extrusion direction of the aluminum profile. If the deviation angle between the two is less than a third preset threshold, the macroscopic orientation of the edge segment is considered to be basically consistent with the extrusion direction. This third preset threshold can be set according to different production processes or testing accuracy requirements, such as 5°, 10°, 15°, etc.

[0100] Step 4: Calculation of the rate of change of direction:

[0101] Furthermore, the rate of change of direction along the edge segment is quantified. This rate of change can be characterized by statistically analyzing the standard deviation or maximum variation of the direction vector within several local windows or segments of the edge segment. A low rate of change indicates a clear, consistent orientation of the edge segment, often representing a regular texture; a high rate of change may indicate defects such as bending or crack propagation.

[0102] Step 5: Residual Texture Judgment and Removal

[0103] If the deviation between the overall direction of a connected edge segment and the extrusion direction is less than the third preset threshold, and its direction change rate is less than the fourth preset threshold, then the edge segment is determined to be a highly probable remaining extrusion texture and is therefore removed; otherwise, it is retained in the subsequent defect contour results.

[0104] Step 6: Output complete defect edge:

[0105] The above analysis removes most texture lines that are aligned with the extrusion direction and lack obvious bends, retaining only edge segments with more defect-like characteristics, such as transverse or diagonal cracks and isolated spots. The final edge output can be further matched with common defect morphological features or statistical indicators to generate defect coordinates, area, direction, and other data for quality control or subsequent algorithms.

[0106] By using dual thresholds for directional consistency and directional change rate, this invention can further eliminate interference from the weaker texture edges remaining after the extrusion direction weakens, thereby effectively improving detection accuracy. In practice, the third and fourth preset thresholds can be adjusted according to the texture complexity of the aluminum profile surface, the defect size range, and the system's computing power. If the third preset threshold is too high, some genuine defect edges may be mistakenly rejected, such as defect edges slightly overlapping with the extrusion direction; if the threshold is too low, too many texture segments may be retained. The selection of the directional change rate threshold also depends on the estimation of the defect shape change rate. In most industrial production sites, by reasonably setting the values ​​of these two thresholds, false alarms caused by residual texture in the extrusion direction can be significantly reduced, and the ability to identify anisotropic or bending defects can be ensured, thereby meeting the accuracy and efficiency requirements for aluminum profile surface defect detection.

[0107] As an optional implementation, the global directionality analysis includes:

[0108] The surface image is divided into several sub-regions;

[0109] Gradient direction statistics are performed for each sub-region to generate a corresponding local gradient direction distribution histogram;

[0110] The local gradient direction distribution histograms of each sub-region are weighted and merged to obtain the global gradient direction distribution of the surface image;

[0111] In the global gradient direction distribution, the direction with the highest peak value is determined as the extrusion direction.

[0112] In practical implementation, to more accurately obtain the overall orientation information of the aluminum profile surface image, when performing global orientation analysis, the image can be divided into blocks according to predetermined rules based on the acquired original image or the image after preliminary processing, such as fixed-size or adaptive region division. The size and number of each sub-region can be adjusted according to the aluminum profile surface size, camera resolution, and computing resource limitations. Typically, the selection of sub-regions needs to balance the full representation of local image features with computational efficiency.

[0113] Within each sub-region, the local gradient direction and magnitude of a pixel are obtained using a gradient operator. Subsequently, the gradient directions of all pixels in that sub-region are discretized and counted to form a direction histogram. The horizontal axis of each histogram corresponds to a different direction interval, and the vertical axis represents the frequency or weight of that interval. In practical implementation, the refinement of the direction intervals can be selected based on the image resolution and desired accuracy, for example, in increments of 1°, 2°, or even finer steps.

[0114] Furthermore, to obtain the overall directional distribution information of the image, it is necessary to merge the directional histograms of each sub-region. Based on factors such as sub-region area, illumination uniformity, and the degree of attention given to compressed areas, appropriate weights can be assigned to the histograms of different sub-regions. These local histograms are then superimposed on the same directional interval. If there are local abnormal regions such as noise or defects, they can be given lower weights during weighting to reduce interference with the overall directional distribution judgment. The merged histogram represents the comprehensive distribution of the main directions of the entire image.

[0115] After merging, a histogram curve reflecting the directional distribution characteristics of the global image is obtained. This curve typically shows several peaks, with the direction corresponding to the highest peak being considered the main direction of the image. If multiple similar or equal-height peaks appear in a specific situation, the final extrusion direction can be determined by combining prior image information or a threshold determination mechanism. Generally, industrial extrusion processes produce relatively single and significant directional peaks in aluminum profiles; therefore, the direction of the highest peak usually accurately represents the extrusion direction.

[0116] By performing global directionality analysis in the above manner, the computational load can be kept relatively controllable while suppressing local noise or defect areas in the image. This allows the present invention to quickly and accurately obtain the extrusion direction of aluminum profiles in industrial production environments. Compared with direction detection only at a few sampling points or within a single image region, this seed regionization and weighted merging method exhibits higher robustness to large-format images or complex surface scenes. Experimental results show that even under interference from local high reflectivity or surface defects, as long as the sub-region size and weighting strategy are set appropriately, a global directionality result that highly matches the actual extrusion direction can still be obtained, thus providing a data foundation for subsequent texture suppression, defect localization, and other processing.

[0117] As an optional implementation, based on the initial gradient direction distribution, the principal gradient direction of each local block is calculated, and the principal gradient direction is compared with the extrusion direction to generate a direction difference, including:

[0118] Histogram statistics are performed on the gradient directions of all pixels in the local block to generate a gradient direction distribution histogram of the local block. The horizontal axis of the histogram is the discretized direction angle, and the vertical axis is the frequency of the corresponding direction.

[0119] Determine whether there is a main direction peak with a concentration higher than the first threshold in the histogram. If so, take the corresponding direction angle as the main gradient direction of the local block.

[0120] If there are no directional peaks with high concentration, the directional distribution of the local block is considered to be discrete and is denoted as no principal direction.

[0121] For a local block with a principal gradient direction, calculate the angle difference between its principal gradient direction and the extrusion direction, and denot it as the direction difference.

[0122] In a specific implementation of the present invention, in order to calculate the principal gradient direction of each local block and compare it with the extrusion direction to generate a direction difference, the following method can be used:

[0123] First, a histogram of gradient directions is generated for all pixels within the local block, producing a histogram of gradient direction distribution for that local block. Typically, the gradient direction and magnitude of each pixel are calculated using operators such as Sobel, Prewitt, or Scharr. Then, the direction value of each pixel is statistically counted within a specified step range, resulting in a distribution curve with discretized direction angle as the x-axis and direction frequency as the y-axis. This histogram reflects the concentration of the main gradient directions within the local block and their proportion in each direction.

[0124] After obtaining the directional distribution histogram, it is determined whether there are any dominant directional peaks with a concentration higher than a first threshold. This first threshold can usually be determined based on production requirements or empirical data. For example, when the proportion of dominant peaks or relative peaks exceeds a certain percentage threshold, the local block is considered to have a clear dominant direction. If a peak that meets the above threshold requirement is found, the direction angle corresponding to the peak is recorded as the dominant gradient direction of the local block. If no peaks with high concentration are detected, the directional distribution of the local block is determined to be relatively discrete and recorded as "no dominant direction". Blocks without a dominant direction can be regarded as suspicious areas or noise blocks in subsequent processing, and appropriate strategies can be applied during texture suppression or defect identification, such as retaining more details to prevent missed detections.

[0125] Once the principal gradient direction of a local block is confirmed, its angle can be compared with the extrusion direction of the aluminum profile to obtain the directional difference. For example, it can be measured using the following formula: = .

[0126] in This represents the principal gradient direction for the local block. This refers to the extrusion direction of the aluminum profile. When the difference in direction is within a small range, it can be considered that the texture within the block is highly consistent with the extrusion direction; if the difference is large, it indicates that the texture of this block deviates significantly, which may suggest defects or local structural changes. Combining the confidence level of the local block, it can be further determined whether it belongs to a suspected defect area or a high-confidence texture area.

[0127] The method described above generates a histogram of orientation distribution by statistically analyzing each pixel. This not only accurately identifies the dominant orientation of each local block but also avoids erroneous judgments caused by minor noise or slight deviations. Compared to simply averaging or summing, using a concentration threshold to identify the dominant orientation gives the system better robustness under various interference environments, such as uneven lighting and high reflectivity.

[0128] As an optional implementation, the step of reducing the gradient magnitude of local blocks determined to be high-confidence texture regions according to a preset first suppression coefficient to obtain a first processed image includes:

[0129] Discrete wavelet transform is performed only on local blocks that have been identified as high-confidence texture regions, decomposing the local blocks into several sub-bands of different scales and directions;

[0130] Identify the sub-band corresponding to the main texture frequency component from the sub-bands, and denote it as the target sub-band;

[0131] For coefficients in the target sub-band whose magnitudes are greater than a preset threshold, a first suppression coefficient attenuation is performed;

[0132] No attenuation is performed for other subbands or coefficients that have not reached the threshold;

[0133] All subbands after differential suppression are subjected to inverse wavelet transform to obtain the suppressed image of the local block;

[0134] The suppressed images of each local block are merged into the overall image, and the first processed image is output as the input for subsequent gradient direction and magnitude calculations.

[0135] In another implementation of the invention, to more precisely reduce the gradient magnitude of high-confidence texture regions and retain potentially hidden weak defect information to the greatest extent, discrete wavelet transform can be introduced when performing reduction operations on local blocks identified as high-confidence texture regions. Compared to simply multiplying pixel or local gradient magnitudes by coefficients, wavelet domain processing can achieve more accurate attenuation for texture components of different scales and directions.

[0136] First, for local blocks identified as high-confidence texture regions, a Discrete Wavelet Transform (DWT) is performed to decompose the local block into several sub-bands of multiple scales and directions. This step typically employs binary wavelet decomposition or corresponding improved algorithms, selecting appropriate wavelet bases (such as Daubechies, Haar, Coiflet, etc.) and the number of decomposition levels as needed to balance frequency domain analysis accuracy with computational resources.

[0137] After wavelet decomposition, sub-band coefficient matrices at different scales (low / mid / high frequency) and in different directions (horizontal / vertical / diagonal) are obtained. To extract the frequency components corresponding to the main extrusion texture of a local block, it is necessary to combine prior or test data on the texture characteristics of aluminum profiles to determine which sub-bands / areas the main texture frequencies are typically concentrated in. If it is known experimentally that the extrusion texture is often significant in the low-to-mid frequency range, the corresponding sub-band can be considered as the target sub-band; alternatively, the sub-band with the highest energy proportion or matching texture direction can be selected as the target sub-band through statistical analysis of the energy distribution of each sub-band.

[0138] Within the identified target subbands, a preset threshold is used to determine which coefficient amplitudes exceed that threshold. This preset threshold is set, for example, based on the absolute value of the coefficients or their energy level. If the coefficient amplitudes in certain regions are significantly higher than the preset threshold, it indicates the presence of strong extrusion texture components. A first suppression coefficient is applied to these regions for multiplicative attenuation, thereby weakening the periodic texture. For coefficients that do not reach the threshold or coefficients in other subbands, no attenuation is performed to preserve as many low-amplitude components as possible that may indicate defects or detailed information.

[0139] By performing inverse wavelet transform on all subband coefficients after differential suppression, the suppressed image of local blocks can be reconstructed in the time domain or pixel domain. By attenuating only the subband with the most significant texture component, while moderately preserving or not attenuating other subbands, the details of potential defects can be better preserved, making subsequent in-depth or iterative processing more targeted.

[0140] Finally, the inverse wavelet transform results of the local blocks corresponding to all high-confidence texture regions are combined with image regions of other unsuppressed or conventionally suppressed blocks to generate a unified first processed image. This image can be used as input when gradient direction and magnitude calculations are performed again in subsequent iterations to further iteratively judge and differentiate texture / defect regions.

[0141] By employing this discrete wavelet decomposition, main texture component attenuation, and inverse transform reconstruction method, a first suppression coefficient is applied only to the key extrusion texture main frequency band, avoiding blind attenuation of low-amplitude coefficients in other sub-bands that may contain defect features. This differentiated wavelet domain processing significantly reduces redundant texture intensity while preserving weak defect signals to the maximum extent. In cases where the aluminum profile surface texture is deep or the texture direction distribution is complex, the sub-band separation advantage of the wavelet domain can more effectively suppress periodic textures and reduce the occurrence rate of false edges in subsequent edge detection.

[0142] Therefore, by performing discrete wavelet transform only on high-confidence texture regions and applying a first suppression coefficient to attenuate the overthreshold coefficients in the target subband to form a first processed image, the efficiency of the present invention in effectively weakening squeezed textures under complex textures and multi-scale interference can be greatly improved.

[0143] As an optional implementation, the step of performing inverse wavelet transform on all sub-bands after differential suppression processing to obtain the suppressed image of the local block includes:

[0144] The surface temperature distribution of the target aluminum profile during imaging is obtained, and the surface temperature distribution is compared with a first temperature threshold. Regions with temperatures higher than the first temperature threshold are marked as high-temperature regions.

[0145] Within the local block corresponding to the high temperature region, the temperature gradient is calculated based on the temperature difference between adjacent pixels. The region with a temperature gradient greater than the second temperature threshold is marked as the high temperature gradient region, and the rest is marked as the low temperature gradient region.

[0146] Read the principal gradient direction of the local block in the high-temperature region from the updated local direction distribution, compare the principal gradient direction with the extrusion direction, and if the difference between the two is less than the third direction threshold, mark it as a region with similar directions; if it is not less than the third direction threshold, mark it as a region with different directions.

[0147] For sub-band coefficients that belong to both high-temperature gradient regions and regions with similar orientations, the first amplitude attenuation is performed; for sub-band coefficients that belong to both high-temperature gradient regions and regions with different orientations, the second amplitude attenuation is performed; for sub-band coefficients in the low-temperature gradient region, the amplitude after differential suppression is maintained.

[0148] After the sub-band coefficient processing, the boundary between adjacent sub-regions is smoothed to reduce reconstruction discontinuities caused by different attenuation intensities;

[0149] An inverse wavelet transform is performed on the high-temperature region after subband coefficient processing and boundary smoothing to obtain the locally suppressed image of the high-temperature region; an inverse wavelet transform is directly performed on the non-high-temperature region based on the subband coefficients after differential suppression; and the locally suppressed images formed by the high-temperature region and the non-high-temperature region after the inverse wavelet transform are stitched together.

[0150] In another alternative embodiment of the invention, to achieve more flexible and hierarchical suppression of high-temperature regions in the discrete wavelet domain, and to suppress potential strong textures or optical interference before inverse wavelet reconstruction, the following processing can be performed:

[0151] In actual production lines, aluminum profiles may be under extrusion or heating, resulting in a gradient distribution of their surface temperature. The surface temperature information of the aluminum profile during imaging can be obtained using infrared thermal imagers, temperature sensors, or other detection equipment. This temperature information is then mapped to an image coordinate system and compared with a first temperature threshold. If the temperature of a region is higher than the threshold, it is marked as a "high-temperature region"; otherwise, it is considered a normal or low-temperature region. This classification helps to effectively suppress localized overheating areas and reduce the impact of abnormal brightness or texture caused by high temperatures.

[0152] Within local blocks of high-temperature regions, further differential or gradient calculations are performed on the temperature values ​​between adjacent pixels. If a temperature gradient in a certain region is detected to be greater than a second temperature threshold, this region is marked as a "high-temperature gradient region"; other regions with smaller temperature differences are marked as "low-temperature gradient regions." By using temperature gradients, "hot spots" or hotspot regions with significant local temperature differences that still exist under high-temperature conditions can be identified, allowing for the application of more targeted attenuation strategies in subsequent subband suppression.

[0153] The principal gradient direction of the corresponding local block in the high-temperature region is read from the updated local orientation distribution and compared with the extrusion direction. If the difference between the two directions is less than a third orientation threshold, it is considered a "similar orientation region"; if it exceeds the threshold, it is recorded as a "different orientation region". This step aims to distinguish between textures that are close to the extrusion direction and textures / defects with large orientation deviations, so as to maintain strong suppression of extrusion textures under thermal perturbation scenarios.

[0154] For sub-band coefficients belonging to both the "high-temperature gradient region" and the "similar direction region," a first amplitude attenuation is applied. This first amplitude attenuation coefficient is a coefficient reduction parameter applied to the main texture frequency component in the wavelet domain. It is applicable to sub-bands within the high-temperature region where the direction is highly consistent with the compression direction, focusing on weakening strong texture features. This processing is limited to the sub-band coefficient level in the frequency domain. Its specific value reflects stronger suppression relative to other sub-bands, but its value should not be directly compared with the first suppression coefficient used in the pixel domain. It should be emphasized that the "amplitude attenuation coefficient" in the frequency domain and the "suppression coefficient" in the pixel domain are applicable to different data representation levels and are not comparable, but both represent relatively strong texture weakening operations within their respective domains.

[0155] For sub-band coefficients that belong to both the "high temperature gradient region" and the "directional difference region", a second amplitude attenuation is applied. The value of this attenuation is appropriately reduced compared to the first amplitude attenuation coefficient, for example, it is set to 0.5 to 0.8, so as to retain texture feature information such as cracks and defects that may deviate in the direction in the high temperature region. For sub-band coefficients in the "low temperature gradient region", the amplitude formed after the original differential processing is maintained to avoid interfering with the weakening of potential minor anomalies in the normal temperature region.

[0156] When high-temperature regions are adjacent to normal-temperature regions or regions with different attenuation intensities, significant abrupt changes may occur in the sub-band coefficient matrix due to uneven amplitude attenuation. By performing smoothing operations on the boundary positions of adjacent sub-regions, such as window interpolation or weighted averaging, the brightness discontinuities caused by these abrupt changes in subsequent inverse image transformation can be reduced, thereby improving reconstruction quality.

[0157] Perform inverse wavelet transform on the local blocks of the high-temperature region after subband coefficient processing and boundary smoothing to obtain the suppressed image of the high-temperature region.

[0158] For non-high temperature regions, the inverse transformation is performed directly using the subband coefficients after the previous "differential suppression";

[0159] Finally, the local block images formed by the high-temperature and non-high-temperature regions after inverse wavelet transform are stitched together to output the updated locally suppressed image.

[0160] By utilizing temperature information, high-temperature hotspots can be identified and suppressed in a targeted manner. This approach is particularly suitable for scenarios involving thermal flow disturbances in aluminum profiles during extrusion, heat treatment, or welding, thereby reducing interference from temperature-related brightness anomalies or texture enhancements on defect detection. For non-high-temperature regions, a conventional sub-band attenuation strategy is still employed to avoid over-processing normal-temperature blocks and compromising potential defect details. Experiments demonstrate that this high-temperature / non-high-temperature fusion wavelet inverse transform method is more flexible and applicable, maintaining overall image consistency after suppression and ensuring that temperature differences do not cause excessive quality degradation or a surge in false edges during the inverse transform stage.

[0161] Thus, this invention achieves further optimization of the extrusion texture and defect information on aluminum profile surfaces under high-temperature perturbations by performing differentiated attenuation in the discrete wavelet domain for regions with different temperatures and orientations, and by appropriately smoothing the boundaries of adjacent sub-regions before the inverse transform. This method can effectively adapt to industrial production conditions with large temperature variations and is of great significance for ensuring the stability and accuracy of surface defect detection in large-scale continuous production.

[0162] Based on the same inventive concept, this application also provides a texture-based aluminum profile defect analysis system corresponding to the texture-based aluminum profile defect analysis method. Since the principle of the system in this application is similar to the texture-based aluminum profile defect analysis method described above, the implementation of the system can refer to the implementation of the method, and the repeated parts will not be described again.

[0163] Reference Figure 4 The diagram shown is a schematic of an aluminum profile defect analysis system based on texture features provided in an embodiment of this application. The system includes:

[0164] The acquisition module 10 is used to acquire a surface image of the target aluminum profile; the aluminum profile has an extrusion direction, which is determined by global directionality analysis of the surface image;

[0165] The first processing module 20 is used to divide the surface image into multiple local blocks, calculate the gradient direction and gradient magnitude of pixels in each local block, and generate an initial gradient direction distribution for each local block; based on the initial gradient direction distribution, calculate the principal gradient direction of each local block, and compare the principal gradient direction with the extrusion direction to generate a direction difference; and determine the confidence level of the local block based on the direction difference and the confidence level of the local block to determine whether the local block belongs to a high-confidence texture region.

[0166] The second processing module 30 is used to reduce the gradient magnitude of local blocks identified as high-confidence texture regions according to a preset first suppression coefficient to obtain a first processed image; for the first processed image, the gradient direction and magnitude are calculated again for each local block to generate an updated local direction distribution; based on the updated local direction distribution, a direction difference is generated and a confidence level is determined; for local blocks identified as high-confidence texture regions, progressive texture suppression is performed according to a preset second suppression coefficient to generate a second processed image.

[0167] The detection module 40 is used to perform edge detection on the second processed image, obtain preliminary edge data and process it, remove false edges that conform to known texture features, and generate defect detection results.

[0168] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in 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. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

Claims

1. A method for analyzing defects in aluminum profiles based on texture features, characterized in that, include: Obtain a surface image of the target aluminum profile; The aluminum profile has an extrusion direction, which is determined by a global directionality analysis of the surface image; The surface image is divided into multiple local blocks. The gradient direction and gradient magnitude of the pixels in each local block are calculated to generate an initial gradient direction distribution for each local block. Based on the initial gradient direction distribution, the principal gradient direction of each local block is calculated, and the principal gradient direction is compared with the extrusion direction to generate a direction difference. The confidence level is determined based on the direction difference and the confidence level of the local block to determine whether the local block belongs to a high-confidence texture region. For local blocks identified as high-confidence texture regions, their gradient magnitudes are reduced according to a preset first suppression coefficient to obtain a first processed image. For the first processed image, the gradient direction and magnitude are calculated again for each local block to generate an updated local direction distribution. Based on the updated local direction distribution, a direction difference is generated, and a confidence level is determined. For local blocks identified as high-confidence texture regions, progressive texture suppression is performed according to a preset second suppression coefficient to generate a second processed image. The first suppression coefficient and the second suppression coefficient have different values; the second suppression coefficient is greater than the first suppression coefficient, used to progressively deepen and weaken high-confidence texture regions during iteration. Edge detection is performed on the second processed image to obtain preliminary edge data, which is then processed to remove false edges that conform to known texture features, and a defect detection result is generated.

2. The method for analyzing aluminum profile defects based on texture features according to claim 1, characterized in that, Determining whether a local block belongs to a high-confidence texture region based on the directional difference and the local block confidence includes: When the deviation between the direction difference and the extrusion direction is less than a first preset threshold and the confidence level of the local block is higher than a second preset threshold, it is determined to be a high-confidence texture region.

3. The method for analyzing aluminum profile defects based on texture features according to claim 1, characterized in that, Before performing gradient direction and magnitude calculations again on each local block for the first processed image to generate an updated local direction distribution, the method further includes: High-reflectivity regions are identified based on the mean or variance of brightness of local blocks in the first processed image, and the second suppression coefficient is increased for the high-reflectivity regions.

4. The method for analyzing aluminum profile defects based on texture features according to claim 1, characterized in that, The process of obtaining and processing preliminary edge data includes: For each connected edge segment in the preliminary edge data, perform directional consistency analysis. If the deviation of the overall direction of the edge segment from the extrusion direction is less than a third preset threshold and its directional change rate is less than a fourth preset threshold, then it is determined to be a residual texture edge and removed; otherwise, it is retained.

5. The method for analyzing aluminum profile defects based on texture features according to claim 1, characterized in that, The global directionality analysis includes: The surface image is divided into several sub-regions; Gradient direction statistics are performed for each sub-region to generate a corresponding local gradient direction distribution histogram; The local gradient direction distribution histograms of each sub-region are weighted and merged to obtain the global gradient direction distribution of the surface image; In the global gradient direction distribution, the direction with the highest peak value is determined as the extrusion direction.

6. The method for analyzing aluminum profile defects based on texture features according to claim 5, characterized in that, Based on the initial gradient direction distribution, the principal gradient direction of each local block is calculated, and the principal gradient direction is compared with the extrusion direction to generate a direction difference, including: Histogram statistics are performed on the gradient directions of all pixels in the local block to generate a gradient direction distribution histogram of the local block. The horizontal axis of the histogram is the discretized direction angle, and the vertical axis is the frequency of the corresponding direction. Determine whether there is a main direction peak with a concentration higher than the first threshold in the histogram. If so, take the corresponding direction angle as the main gradient direction of the local block. If there are no directional peaks with high concentration, the directional distribution of the local block is considered to be discrete and is denoted as no principal direction. For a local block with a principal gradient direction, calculate the angle difference between its principal gradient direction and the extrusion direction, and denot it as the direction difference.

7. The method for analyzing aluminum profile defects based on texture features according to claim 1, characterized in that, The step of reducing the gradient magnitude of local blocks identified as high-confidence texture regions according to a preset first suppression coefficient to obtain a first processed image includes: Discrete wavelet transform is performed only on local blocks that have been identified as high-confidence texture regions, decomposing the local blocks into several sub-bands of different scales and directions; Identify the sub-band corresponding to the main texture frequency component from the sub-bands, and denote it as the target sub-band; For coefficients in the target sub-band whose magnitudes are greater than a preset threshold, a first suppression coefficient attenuation is performed; No attenuation is performed for other subbands or coefficients that have not reached the threshold; All subbands after differential suppression are subjected to inverse wavelet transform to obtain the suppressed image of the local block; The suppressed images of each local block are merged into the overall image, and the first processed image is output as the input for subsequent gradient direction and magnitude calculations.

8. The method for analyzing aluminum profile defects based on texture features according to claim 7, characterized in that, The step of performing inverse wavelet transform on all sub-bands after differential suppression processing to obtain the suppressed image of the local block includes: The surface temperature distribution of the target aluminum profile during imaging is obtained, and the surface temperature distribution is compared with a first temperature threshold. Regions with temperatures higher than the first temperature threshold are marked as high-temperature regions. Within the local block corresponding to the high temperature region, the temperature gradient is calculated based on the temperature difference between adjacent pixels. The region with a temperature gradient greater than the second temperature threshold is marked as the high temperature gradient region, and the rest is marked as the low temperature gradient region. Read the principal gradient direction of the local block in the high-temperature region from the updated local direction distribution, compare the principal gradient direction with the extrusion direction, and if the difference between the two is less than the third direction threshold, mark it as a region with similar directions; if it is not less than the third direction threshold, mark it as a region with different directions. For sub-band coefficients that belong to both high-temperature gradient regions and regions with similar orientations, the first amplitude attenuation is performed; for sub-band coefficients that belong to both high-temperature gradient regions and regions with different orientations, the second amplitude attenuation is performed; for sub-band coefficients in the low-temperature gradient region, the amplitude after differential suppression is maintained. After the sub-band coefficient processing, the boundary between adjacent sub-regions is smoothed to reduce reconstruction discontinuities caused by different attenuation intensities; An inverse wavelet transform is performed on the high-temperature region after subband coefficient processing and boundary smoothing to obtain the locally suppressed image of the high-temperature region; an inverse wavelet transform is directly performed on the non-high-temperature region based on the subband coefficients after differential suppression; and the locally suppressed images formed by the high-temperature region and the non-high-temperature region after the inverse wavelet transform are stitched together.

9. A texture-feature-based aluminum profile defect analysis system, characterized in that, include: The acquisition module is used to acquire surface images of the target aluminum profile; The aluminum profile has an extrusion direction, which is determined by a global directionality analysis of the surface image; The first processing module is used to divide the surface image into multiple local blocks, calculate the gradient direction and gradient magnitude of pixels in each local block, and generate an initial gradient direction distribution for each local block; based on the initial gradient direction distribution, calculate the principal gradient direction of each local block, and compare the principal gradient direction with the extrusion direction to generate a direction difference; and determine the confidence level based on the direction difference and the confidence level of the local block to determine whether the local block belongs to a high-confidence texture region. The second processing module is used to reduce the gradient magnitude of local blocks identified as high-confidence texture regions according to a preset first suppression coefficient to obtain a first processed image; for the first processed image, the gradient direction and magnitude are calculated again for each local block to generate an updated local direction distribution; based on the updated local direction distribution, a direction difference is generated and a confidence level is determined; for local blocks identified as high-confidence texture regions, progressive texture suppression is performed according to a preset second suppression coefficient to generate a second processed image; wherein the values ​​of the first suppression coefficient and the second suppression coefficient are different; the second suppression coefficient is greater than the first suppression coefficient, so as to progressively deepen and weaken the high-confidence texture regions during the iteration process; The detection module is used to perform edge detection on the second processed image, obtain preliminary edge data and process it, remove false edges that conform to known texture features, and generate defect detection results.

Citation Information

Patent Citations

  • Industrial equipment anomaly detection method and system based on machine vision

    CN120339254A

  • Unmanned aerial vehicle inspection defect sample generation method and system based on diffusion model

    CN120580537A