Aluminum profile surface defect automatic detection method and system based on image recognition

Through three-dimensional scanning and multi-view image processing technology, the observation angle and light intensity are dynamically adjusted, and the problem of blind spots in shadow areas in traditional aluminum profile detection methods is solved, achieving high-precision detection of full coverage of aluminum profile surfaces.

CN120374615AActive Publication Date: 2025-07-25CHONGQING JIUHAI ALUMINUM CO LTD

Patent Information

Application Number
CN202510856667.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-07-25
Estimated Expiration
2045-06-25

AI Technical Summary

Technical Problem

The surface defect detection methods of traditional aluminum profiles are inefficient and subjective, making it difficult to adapt to complex cross-sectional shapes, resulting in shaded areas becoming detection blind spots, affecting the continuity and accuracy of detection.

Method used

The three-dimensional geometric data of the aluminum profile section is obtained through three-dimensional scanning, the optimal observation angle is dynamically designed, the shadowed area is eliminated, the camera lighting intensity and trigger timing are adjusted, and the multi-view angle configuration and image registration technology are used to generate a complete surface image and perform defect detection.

Benefits of technology

It realizes all-round blind spot detection on the surface of aluminum profiles, improves the accuracy and comprehensiveness of defect detection, adapts to changes in complex section shapes and production beats, and supports high-precision quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120374615A_ABST
    Figure CN120374615A_ABST
Patent Text Reader

Abstract

The invention discloses an aluminum profile surface defect automatic detection method and system based on image recognition, and relates to the technical field of image processing and intelligent detection.The method comprises the steps that three-dimensional geometric data of the section of an aluminum profile are obtained through a three-dimensional scanning device, candidate observation angles and geometric feature parameters needed by coverage calculation are extracted, and the three-dimensional geometric data of the section of the aluminum profile are obtained; if the section shape contains a groove or a curved surface structure, marking a space coordinate range corresponding to the area of the shadow region to obtain a section geometric feature vector and a shadow region coordinate set; according to the aluminum profile surface defect automatic detection method and system based on image recognition, all-dimensional dead-corner-free detection of the surface of the aluminum profile is achieved, the method and system can adapt to the production takt of complex section shapes and changes, the accuracy and comprehensiveness of defect detection are improved, and effective technical support is provided for aluminum profile quality control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing and intelligent detection, and particularly relates to an automatic detection method and system for surface defects of aluminum profiles based on image recognition. Background Art

[0002] As a core basic material in modern industrial manufacturing, aluminum profiles are widely used in key fields such as aerospace, automotive manufacturing, and architectural decoration. Their surface quality directly affects the product performance and service life. With the continuous improvement of the manufacturing industry's requirements for product quality, the detection of surface defects of aluminum profiles has become an important link in ensuring product quality.

[0003] Traditional manual detection methods have problems such as low efficiency, strong subjectivity, and high missed detection rates. Although existing automated detection systems have improved the detection efficiency to a certain extent, when facing aluminum profiles with complex cross-sectional shapes, they often adopt fixed observation angles and unified detection parameters, and it is difficult to meet the personalized needs of different products. These methods show obvious limitations when dealing with diverse aluminum profile products. The diversity and complexity of the cross-sectional shapes of aluminum profiles bring technical difficulties in optimizing the observation angle. Different cross-sectional shapes require different observation angles to ensure that all surface areas can be effectively detected, and fixed camera arrangement schemes cannot meet this requirement. The improper selection of the observation angle directly leads to the generation of shadow areas, which become detection blind spots, making it impossible to identify surface defects hidden in them. The existence of shadow areas further exacerbates the problem of incomplete image acquisition. Especially in a high-speed production environment, product size changes and production speed fluctuations make it difficult to precisely control the camera trigger timing. When the trigger timing does not match the actual production rhythm, it will cause intermittent or overlapping image acquisition, seriously affecting the continuity and accuracy of detection. Summary of the Invention

[0004] The purpose of the present invention is to provide an automatic detection method and system for surface defects of aluminum profiles based on image recognition, which dynamically designs the optimal observation angle for different cross-sectional shapes of aluminum profiles, effectively eliminates shadow areas at the same time, and realizes the adaptive adjustment of the camera trigger timing according to product specifications and production parameters to ensure full coverage and high precision of the detection process.

[0005] To achieve the above object, the present invention provides the following technical solution: An automatic detection method for surface defects of aluminum profiles based on image recognition, the method comprising: obtaining three-dimensional geometric data of the cross-section of the aluminum profile through a three-dimensional scanning device, extracting geometric feature parameters required for calculating the candidate observation angle and coverage range, if the cross-sectional shape includes a groove or a curved surface structure, marking the spatial coordinate range corresponding to the area of the shadow region, to obtain a cross-sectional geometric feature vector and a shadow region coordinate set; according to the cross-sectional geometric feature vector, obtaining a unified complete surface image in space, through the complete surface image, using a defect detection algorithm to extract surface anomaly features and defect boundary segmentation results, if defect features are detected, performing defect type label classification and severity level assessment, to obtain a detection report including defect position coordinates, defect type labels and severity levels; according to the defect position coordinates and defect type labels in the detection report, adjusting the camera illumination intensity parameters through the illumination compensation coefficient, if the defect boundary segmentation accuracy rate of the region is lower than a preset threshold, updating the candidate observation angle and the view switching frequency, to obtain an optimized multi-view configuration scheme and a trigger timing table.

[0006] Preferably, the obtaining a unified complete surface image in space according to the cross-sectional geometric feature vector includes: according to the cross-sectional geometric feature vector, using a view optimization algorithm to calculate the coverage range of the candidate observation angle, if the area of the shadow region under a certain observation angle exceeds a preset threshold, then adjusting the camera position parameters and the angle adjustment strategy, to determine an optimal multi-view configuration scheme and the corresponding three-dimensional spatial coordinate position and tilt angle parameters of the camera.

[0007] Preferably, the obtaining a unified complete surface image in space according to the cross-sectional geometric feature vector further includes: through the optimal multi-view configuration scheme, obtaining the image acquisition parameter settings under different candidate observation angles, detecting the overlapping region detection results between adjacent views, if there is an overlapping region, then establishing a spatial mapping relationship between the views, to obtain the registration reference points of the multi-view images and the multi-view fusion weights.

[0008] Preferably, the obtaining a unified complete surface image in space according to the cross-sectional geometric feature vector further includes: according to the product specifications of the aluminum profile and the current production line speed, using a dynamic timing calculation module to analyze the time interval for the product to pass through the detection area, if the production beat changes, then adjusting the view switching frequency, the camera trigger frequency and the exposure time parameters, to determine a synchronous trigger timing table and an image acquisition time window.

[0009] Preferably, the obtaining a unified complete surface image in space according to the cross-sectional geometric feature vector further includes: controlling the coordinated work of multiple cameras through the synchronous trigger timing table, obtaining an image sequence of the same product cross-section under different candidate observation angles, if a product position offset is detected within the image acquisition time window, then starting a position compensation mechanism, to obtain a time-synchronized multi-view image data set.

[0010] Preferably, obtaining a spatially unified complete surface image according to the cross-section geometric feature vector further includes: spatially aligning images at different angles using image registration technology according to a multi-view image data set synchronized in time and multi-view fusion weights. If the registration accuracy is lower than the registration accuracy threshold, recalculate the registration reference points to obtain a spatially unified complete surface image.

[0011] Preferably, the three-dimensional scanning device is a laser three-dimensional contour scanner or a structured light scanning system, which is used to improve the geometric data acquisition accuracy of complex cross-section structures.

[0012] Preferably, the geometric feature parameters include the curvature change rate, the normal direction distribution, and the groove depth index.

[0013] Preferably, the shadow area coordinate set is automatically generated by calculating the included angle between the local view occlusion degree and the surface normal direction.

[0014] An automatic aluminum profile surface defect detection system based on image recognition, which is used to implement the steps of the automatic aluminum profile surface defect detection method based on image recognition. The system includes: a data acquisition and preprocessing module, which is used to obtain the three-dimensional geometric data of the aluminum profile cross-section through a three-dimensional scanning device, extract the geometric feature parameters required for calculating the candidate observation angle and coverage range, and mark the spatial coordinate range corresponding to the shadow area area if the cross-section shape includes a groove or a curved surface structure, to obtain a cross-section geometric feature vector and a shadow area coordinate set; an image construction and defect recognition module, which is used to obtain a spatially unified complete surface image according to the cross-section geometric feature vector, extract surface abnormal features and defect boundary segmentation results through the complete surface image, and if defect features are detected, perform defect type label classification and severity level evaluation to obtain a detection report including defect position coordinates, defect type labels, and severity levels; an intelligent control module, which is used to adjust the camera illumination intensity parameters according to the defect position coordinates and defect type labels in the detection report through the illumination compensation coefficient, and if the defect boundary segmentation accuracy of the area is lower than the preset threshold, update the candidate observation angle and the view switching frequency to obtain an optimized multi-view configuration scheme and a trigger timing table.

[0015] As can be seen from the above technical solutions, the present invention has the following beneficial effects: The automatic detection method and system for surface defects of aluminum profiles based on image recognition obtain cross-section geometric data through three-dimensional scanning, extract characteristic parameters and mark shadow areas, and optimize the observation angle configuration scheme. Dynamically adjust the camera trigger timing according to the production line speed, and collect synchronous multi-view images. Use image registration technology to align images at different angles, fuse and generate a complete surface image, and perform defect detection and classification. For the detection results, dynamically optimize the lighting parameters and observation angles to improve the accuracy of defect boundary segmentation. The present invention realizes the all-round and non-blind detection of the surface of aluminum profiles, can adapt to complex cross-section shapes and changing production rhythms, improves the accuracy and comprehensiveness of defect detection, and provides effective technical support for the quality control of aluminum profiles. Brief Description of the Drawings

[0016] Figure 1 It is a flow chart of the method of the present invention; Figure 2 It is a connection diagram of system modules of the present invention. Detailed Embodiment

[0017] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0018] As Figure 1 shown, the present invention provides a technical solution: an automatic detection method for surface defects of aluminum profiles based on image recognition, the method includes: obtaining three-dimensional geometric data of the cross-section of the aluminum profile through a three-dimensional scanning device, extracting geometric characteristic parameters required for calculating candidate observation angles and coverage ranges, if the cross-section shape includes grooves or curved surface structures, marking the spatial coordinate range corresponding to the shadow area, and obtaining a cross-section geometric feature vector and a shadow area coordinate set; according to the cross-section geometric feature vector, obtaining a complete surface image unified in space, through the complete surface image, using a defect detection algorithm to extract surface abnormal features and defect boundary segmentation results, if defect features are detected, performing defect type label classification and severity level evaluation to obtain a detection report including defect position coordinates, defect type labels and severity levels; according to the defect position coordinates and defect type labels in the detection report, adjusting the camera lighting intensity parameters through the lighting compensation coefficient, if the defect boundary segmentation accuracy of the area is lower than a preset threshold, updating the candidate observation angles and view switching frequencies to obtain an optimized multi-view configuration scheme and trigger timing table.

[0019] This method is based on the three-dimensional geometric modeling of the cross-section of aluminum profiles. High-precision point cloud data of the cross-section of aluminum profiles is collected using three-dimensional scanning equipment (such as laser scanners or structured light systems). Through surface reconstruction algorithms, features such as the shape information of the cross-section, the position of grooves, and the curvature change are extracted to generate a geometric feature vector of the cross-section, and the shadow areas that may be formed due to structural occlusion are identified to construct the corresponding spatial coordinate set. In the surface imaging stage, a complete spatially unified surface image is synthesized by taking multiple-angle photographs to ensure that each area is covered by the imaging system. Subsequently, defects such as abnormal textures, cracks, and bubbles in the image are identified through deep learning or traditional image processing methods (such as a defect recognition model based on the convolutional neural network CNN), the defect boundaries are extracted and image segmentation is performed, the defect types (such as indentations, scratches, bubbles, etc.) are labeled and classified according to the severity level. Further, according to the coordinate positions and type labels fed back by the defect report, the lighting module in the imaging system is intelligently compensated by adjusting the intensity or direction of the LED light source or laser illumination. In areas where the detection accuracy is insufficient, the perspective selection strategy and shooting frequency are automatically adjusted through a feedback mechanism to form a multi-perspective shooting and processing scheme to achieve optimal image coverage and defect recognition rate.

[0020] The method of the present invention starts with obtaining the complete geometric information of the cross-section of aluminum profiles. A three-dimensional scanning device (such as a laser triangulation sensor or a structured light device) is used to perform high-density scanning on the cross-section of aluminum profiles to obtain a set of discrete three-dimensional point coordinate data that constitutes the surface. First, the system adjusts the pose and normalizes the point cloud data through the principal component analysis algorithm, and extracts a set of vectors that describe the main structural directions and contour features of the cross-section. These vectors are used to characterize the structural characteristics of the overall shape of the cross-section.

[0021] During the processing, for each scanned point, the system extracts the normal direction of the local area around the point, that is, by fitting a small plane near the point to determine its facing direction. These normal directions can be used to judge the curvature change of the cross-section surface. For example, when there is a sudden change in the normal direction or a drastic angular change in a certain area, it means that there may be grooves, protrusions or other curved surface structures. The system further calculates the visibility of each point at the current viewing angle, that is, to judge whether the point is easily occluded or in the shadow when viewed from the current imaging direction. The judgment criteria are based on the angle between the normal direction and the viewing direction, as well as the severity of the local surface change. If an area has both obvious concave structures and faces a non-viewing direction, it is considered likely to be in the shadow area, and the system records the 3D coordinates of this area as the compensation target of the potential defect area. Then, according to the extracted cross-section structure characteristics, the system plans multiple observation angles and performs image acquisition in sequence. Finally, a complete image covering the entire surface of the aluminum profile is generated through image stitching and registration algorithms. This image covers all suspicious areas and complex geometric surfaces to ensure that no key information is missed in subsequent inspections. In the defect detection stage, the system inputs the complete image into the defect recognition algorithm model. The model obtains the ability to recognize surface defects such as scratches, indentations, and bubbles through training. For each pixel point in the image, the system evaluates the possibility that it belongs to the defect area and compares it with a set probability threshold. For example, when the defect possibility of a certain pixel point exceeds the set threshold (such as 50%), the system marks it as the defect area. To set this threshold, it is usually necessary to use an artificially labeled dataset for training and cross-validation, and finally select the value that can achieve the best balance between precision and recall. Once the defect area is detected, the system further extracts geometric information such as the area, boundary length, and surface depth of the area, and calculates the severity score of each defect. For example, when a certain defect has a large area, a tortuous boundary, and a deep depth, its severity score will be higher. The weights of each scoring dimension are determined by the actual industrial inspection standards. For example, the weight coefficients are set by referring to the tolerance limits of the indentation width and depth in the national standard. After defect recognition, the system will intelligently adjust the lighting system in the next imaging task according to the type and location of the defect. This lighting adjustment determines the lighting compensation coefficient according to the ratio between the image brightness of the current defect area and the expected brightness. For example, when the local brightness in the detected image is significantly lower than the target brightness set by the system, it means that the recognition effect in this area may be affected by insufficient lighting, and the system will correspondingly increase the light source brightness in this area. In addition, if the accuracy of defect boundary segmentation detected by the system in some areas is lower than the preset threshold (such as lower than 80%), an automatic optimization mechanism is triggered to re-plan the image acquisition angles and adjust the frequency and order of view switching. The system selects the optimal angle combination through the analysis of the image coverage at different angles to improve the coverage rate and image clarity of the entire system.The system will also generate a multi-perspective image acquisition plan based on the detection results and determine the specific time points for triggering acquisitions at each angle. Through the above process, the present invention constructs an adaptive and closed-loop adjustable surface defect detection system, which can not only accurately identify defects but also adjust the detection strategy in real time to cope with the challenges brought by complex geometric structures.

[0022] Compared with the traditional single-angle imaging detection method, the present invention has significant advantages in obtaining the complete cross-sectional structure information and compensating for occluded areas. By constructing a cross-sectional geometric feature vector, precise perspective planning and imaging strategy deployment can be achieved, effectively avoiding image blind spots caused by grooves or curved surface structures. The introduction of multi-perspective synthesis technology and an intelligent light compensation mechanism significantly improves the uniformity of surface imaging and the accuracy of defect detection. Defect recognition uses an efficient image recognition algorithm, taking into account both detection speed and accuracy in the automated processing flow. Through the defect level evaluation and feedback adjustment mechanism, the system's ability to adaptively adjust parameters is also realized, improving the overall robustness and intelligence level of the system. Finally, the output detection report has three-dimensional information of spatial positioning, type classification, and severity evaluation, meeting the actual needs of industrial automation detection and quality control.

[0023] Obtaining a spatially unified complete surface image according to the cross-sectional geometric feature vector includes calculating the coverage range of candidate observation angles using a perspective optimization algorithm according to the cross-sectional geometric feature vector. If the area of the shadow region under a certain observation angle exceeds a preset threshold, the camera position parameters and angle adjustment strategy are adjusted to determine the optimal multi-perspective configuration scheme and the corresponding three-dimensional spatial coordinate position and tilt angle parameters of the camera.

[0024] In this embodiment, the system first analyzes the structural shape and occlusion characteristics of the aluminum profile based on the obtained cross-section geometric feature vector. This feature vector is obtained through principal component analysis, curvature analysis, and concave-convex structure recognition of the cross-section scanned point cloud, comprehensively describing the geometric changes of the profile surface in all directions, including groove depth, curvature distribution, and edge mutation positions. Subsequently, the system predefines a set of candidate observation angles. Based on these angles, through simulation calculations, it evaluates their occlusion degree and coverage ability when observing the cross-section surface, providing a basis for subsequent optimization of the imaging configuration. At each candidate angle, the system calculates the angle between each known structural point on the aluminum profile surface and the current camera viewing direction one by one, and evaluates the occlusion possibility in combination with the curvature characteristics of the area where the point is located. Specifically, the occlusion index is calculated by the ratio of the cosine value of the angle to the local surface curvature. When this index is lower than a set occlusion threshold (generally between 0.3 and 0.5, set according to curvature statistics experience), it indicates that the point may be in the shadow area at this viewing angle. By summarizing the occlusion indexes of all points, the system can identify the shadow area at this viewing angle, thereby calculating the total area covered by the shadow at this angle. To determine whether an observation angle is valid, the system performs a ratio operation on the shadow area at this angle and the total visible area to obtain the shadow area ratio. If this ratio is higher than the preset area ratio threshold (usually 15%), it is considered that this angle cannot provide sufficient image information and needs to be excluded from the candidate set. This area ratio threshold is obtained through statistical experiments on the detection accuracy of various types of aluminum profiles, ensuring the improvement of the coverage quality within an acceptable error range. After excluding unqualified viewing angles from the candidate angles, the system performs combined optimization on the remaining valid viewing angles, aiming to cover all the imaginable areas of the aluminum profile while minimizing the number of observation angles and the camera switching frequency. For this purpose, the system constructs an objective function, performs a weighted sum of the effective imaging areas of each angle, and multiplies the number of angles by a penalty coefficient for control, taking into account both image integrity and shooting efficiency. This optimization process can be carried out using heuristic search, simulated annealing, or genetic algorithms, and finally obtains a set of optimal viewing angle combinations, that is, the multi-view configuration scheme. Finally, for each selected observation angle, the system calculates the precise coordinate position of the camera in three-dimensional space and its tilt angles such as pitch, yaw, and roll according to the position and shape of the aluminum profile in space and in combination with the imaging requirements. The calculation results of the camera spatial pose will be organized into a standardized configuration table for use by the camera control unit or the robot execution system, ensuring that each imaging can be completed at the optimized position and angle, providing guarantee for finally generating a complete surface image with unified space and no blind spots. This embodiment significantly improves the effectiveness of image acquisition and the accuracy of defect recognition through the joint optimization of the coverage rate and shadow evaluation of the observation angles. The shadow area analysis enables the system to avoid detection blind spots caused by occlusion on complex structure surfaces, thereby improving the integrity of the surface image.Meanwhile, through the optimized configuration of spatial parameters, the shooting efficiency is effectively improved, and the data redundancy and system resource consumption caused by multiple imaging are reduced. Compared with the fixed-angle or evenly distributed shooting schemes, this method achieves a better balance between imaging coverage rate and computational load, enhancing the practicality and intelligent level of the system.

[0025] Obtaining a unified and complete surface image in space according to the cross-section geometric feature vector further includes obtaining the image acquisition parameter settings at different candidate observation angles through the optimal multi-view configuration scheme, detecting the overlapping area detection results between adjacent views. If there is an overlapping area, a spatial mapping relationship between views is established to obtain the registration reference points and multi-view fusion weights of multi-view images.

[0026] In this embodiment, the system first obtains the corresponding image acquisition parameters for each determined viewing angle according to the determined optimal multi-view configuration scheme. These parameters mainly include exposure time, light intensity, camera focal length, and image resolution. The system automatically calculates the appropriate exposure time according to the reflectivity of the aluminum profile surface, lighting conditions, and the desired image brightness. Specifically, the exposure time is directly proportional to the desired image brightness and inversely proportional to the surface reflectivity and light intensity. To ensure that clear images can be obtained for cross-sections with different structural complexities, the system sets an empirical coefficient, generally ranging from 0.8 to 1.2, to correct the impact of environmental changes on exposure. Subsequently, the system performs overlapping region detection between two adjacent viewpoints. This process extracts local image feature points from the two images respectively, and then calculates the Euclidean distance between the two sets of feature points to determine whether there is a repeated region. If the system detects more than 60 valid matching points in the two images (this threshold can be set according to the image resolution and the complexity of the profile texture, and is generally recommended to be set between 30 and 100), it is considered that there is a valid overlapping region between this pair of viewpoints. After confirming the existence of the overlapping region, the system will use these matching points to construct the spatial mapping relationship between the viewpoints. This mapping relationship is modeled by affine transformation, that is, a certain point in image A is mapped to the corresponding point in image B according to the transformation rules of rotation, scaling, and translation. To ensure the accuracy of the mapping, the system adopts the minimum error criterion to solve the set of spatial transformation parameters that best fit all matching point pairs. After completing the image geometric alignment, the system also needs to perform fusion processing on the pixel values in the overlapping region. The image quality of each viewpoint in the overlapping region will be used as the basis for its contribution degree to the fused image. The system will first calculate the gradient intensity of the image (i.e., the image sharpness index, often implemented through edge detection such as the Sobel operator) and the local image quality index (such as signal-to-noise ratio or structural similarity), and then multiply these two indexes to obtain a fusion weight. The fusion weights of all viewpoints will be normalized so that the sum of the weights of all viewpoints is 1, and then multiplied by the pixel values of their corresponding images, and finally weighted and summed to obtain the pixel values of the overlapping region of the fused image. To ensure the accuracy of registration, the system also sets a maximum error tolerance threshold, usually set within 2 pixels. If the average residual of all matching points after transformation exceeds this error threshold after registration, the system will consider the registration to fail and automatically re-execute the feature point matching and mapping process until the accuracy requirement is met. Through the above method, on the basis of realizing multi-view image acquisition, it can effectively solve the problems of image breakage or overlapping blurring caused by different positions, angles, and shooting parameters between adjacent images. Establishing the spatial mapping relationship between viewpoints and introducing fusion weights enables the multi-angle imaging data to maintain consistency and image quality stability when combined, thereby improving the accuracy and robustness of overall defect detection. At the same time, this method supports high-precision image stitching and is particularly suitable for the detection requirements of aluminum profile cross-sections with complex geometric changes or curved surface structures.

[0027] Obtaining a spatially unified complete surface image based on the cross-sectional geometric feature vector further includes analyzing the time interval for the product to pass through the detection area using a dynamic time series calculation module according to the aluminum profile product specifications and the current production line speed. If the production rhythm changes, the perspective switching frequency, the camera trigger frequency, and the exposure time parameters are adjusted to determine the synchronous trigger timing table and the image acquisition time window.

[0028] In this embodiment, the system realizes precise timing control of aluminum profile products during the operation of the production line by introducing a dynamic timing calculation module. This module first obtains the running speed information of the current production line, usually in meters per second, and simultaneously reads the length information of the aluminum profile product to be detected (in meters). The system divides the length of the product by the running speed of the production line to calculate the time required for the product to enter and completely leave the detection area. This result is called the total time to pass through the detection area. For example, if an aluminum profile with a length of 6 meters is conveyed on a production line with a speed of 1 meter per second, the time required for it to pass through the detection area is 6 seconds. Next, the system divides this total time into several time periods for distributing the image acquisition tasks of different cameras or different viewing angles. The division is based on the known total number of viewing angles to be photographed and the minimum stable time required for imaging in each viewing angle. For example, if the entire detection system includes 3 different viewing angles and at least 0.8 seconds is required for image acquisition in each viewing angle, the system needs to reserve a collection window of not less than 0.8 seconds for each viewing angle and reasonably distribute it within the 6-second total duration. During operation, if the system samples the real-time speed data and finds that the current speed has changed significantly compared with the previous cycle, for example, increased or decreased by more than 5% of the original speed, it is determined that the production rhythm has changed. This 5% threshold can be determined through historical process analysis and test data experience as a system sensitivity adjustment parameter. At this time, the system will automatically recalculate the new detection time for the product to update the time windows corresponding to each acquisition task. In addition to adjusting the time window, the system will also synchronously update the following parameters: one is the viewing angle switching frequency of the camera, that is, the time interval required for the camera or observation device to switch between different shooting angles. The system needs to ensure that the camera can stably operate at the new angle for at least the specified time after switching; the second is the trigger frequency of the camera, that is, the number of frames imaged per unit time, and this frequency is inversely calculated based on the new available time window; the third is the exposure time of the camera, and its value needs to be automatically adjusted according to the acquisition interval to ensure stable imaging brightness during each shooting. For example, when the rhythm speeds up, the exposure time needs to be appropriately shortened to avoid blurred images. After all parameter calculations are completed, the system will uniformly generate a synchronous trigger timing table, which details the trigger moments, exposure durations, corresponding viewing angle numbers, and imaging durations of each camera or imaging unit. The timing table is also associated with the image acquisition time window to ensure that all imaging tasks can be accurately and efficiently executed within the effective time period when the product actually enters the detection area, thus supporting the subsequent multi-view image registration, fusion, and defect detection work without interruption.

[0029] By introducing a dynamic timing adjustment mechanism, this embodiment enhances the system's adaptability to the rhythm changes of the actual production line, avoiding the impact on image acquisition quality caused by speed fluctuations. Compared with the traditional fixed acquisition cycle scheme, the present invention has stronger time sensitivity and adaptive control capabilities, and is particularly suitable for high-speed, variable-speed or multi-beat mixed-line production environments. Through precise trigger timing and exposure time control, not only the image quality is guaranteed, but also the detection accuracy and stability of the entire system are improved, which helps to achieve the goal of high-reliability industrial automation defect recognition.

[0030] Obtaining a spatially unified complete surface image according to the cross-sectional geometric feature vector further includes controlling the coordinated work of multiple cameras through a synchronous trigger timing table, acquiring an image sequence of the same product cross-section at different candidate observation angles, and if a product position offset is detected within the image acquisition time window, starting a position compensation mechanism to obtain a time-synchronized multi-view image data set.

[0031] In this embodiment, the system controls the coordinated operation of multiple cameras in the detection device through the aforementioned generated synchronous trigger timing table to ensure that the image acquisition of the same product section is completed within the respective specified time windows. In the timing table, a trigger start time and an exposure duration are assigned to each camera. For example, for the first camera, its image acquisition start time can be the 3rd second, and the exposure time is 0.5 seconds, then its acquisition end time is the 3.5th second. In a similar manner, the acquisition process of multiple cameras is arranged in order within the total time that the entire product passes through the detection area. The system uses a unified master clock or hardware trigger signal to synchronize and control all cameras within microsecond accuracy. Each camera will be triggered at a preset time to capture the image of the current section to ensure that the images acquired from different perspectives are based on the product status of the same time section. In addition, in each image acquisition time window, the system will monitor the position of the aluminum profile product in real time. The monitoring method includes laser ranging, visual positioning or encoder, and the actual position data collected is compared with the theoretical position data. The theoretical position is the expected position calculated based on the production line running speed multiplied by time. By comparing the difference between the actual position and the theoretical position, the offset at the current moment is obtained. If the offset is greater than a preset threshold, such as more than 2 mm, the system determines that the position offset has reached the level that needs to be compensated. The setting of this threshold is determined based on the camera resolution and the minimum identifiable defect size, and is usually set between 2 and 5 mm. At this time, the system will immediately start the position compensation mechanism. The compensation mechanism mainly includes two methods. The first is forward compensation, that is, for cameras that have not yet triggered the shooting, the system will calculate the new trigger time based on the current offset value and the production line speed. For example, if the offset is 20 mm and the production line speed is 100 mm per second, the new trigger time should be 0.2 seconds earlier than the original plan. The second is backward compensation, that is, the image that has been collected is corrected by coordinate transformation through the image processing algorithm to realign the image coordinates to the standard reference position. The correction method includes affine transformation or perspective transformation to ensure that the spatial position of the target area in the image is restored to the theoretical position. In order to ensure the temporal and spatial consistency of the overall multi-view image data, the system will add accurate timestamp records and spatial posture parameters to each image. The timestamp accuracy is usually required to be less than 1 millisecond, and the attitude parameters include the position coordinates of the camera in three-dimensional space, as well as the angular information of its shooting direction, such as pitch angle, yaw angle, and roll angle. Ultimately, the image data set generated by the system is not only strictly synchronized in time, but also accurately and consistently located in space, and can be used as high-quality input data for subsequent multi-view image fusion, three-dimensional reconstruction, or defect detection. By adopting time synchronization control and position compensation mechanisms, the present invention significantly improves the consistency and time matching of image data under multi-camera collaboration.Even under high-speed movement or environmental disturbances, the system can still adjust the imaging plan in real time to ensure that each frame of the image is from the product cross-section at the same moment, thus avoiding image misalignment and recognition errors caused by position errors or time drift. This technology improves the robustness and data quality of the multi-view imaging system and is especially suitable for applications in the inspection scenarios of aluminum profiles with complex structures and fast production rhythms.

[0032] Obtaining a spatially unified complete surface image according to the cross-section geometric feature vector further includes using image registration technology to spatially align images at different angles based on the time-synchronized multi-view image dataset and multi-view fusion weights. If the registration accuracy is lower than the registration accuracy threshold, the registration reference points are recalculated to obtain a spatially unified complete surface image.

[0033] In this embodiment, after the system obtains multi-view image data with a unified timestamp, it will set the fusion weights according to the image quality of each image in the overlapping area. The fusion weight of each view image is determined by two key indicators: one is the edge sharpness of the image in the overlapping area, that is, the gradient intensity, which represents the sharpness of the image edge texture; the other is the signal-to-noise ratio of the image, which reflects the overall quality of the image. The system multiplies the gradient intensity value of the image by its signal-to-noise ratio to obtain the weighted value of each image. After summing the weighted values of all views, the weighted value of each image is normalized, and the result is used as the fusion weight to ensure that the total weight of all images is 1. This weight reflects the contribution degree of each view image in the final fused image. In the registration stage, the system uses a registration method based on image feature points to spatially align the images from different viewing angles. First, multiple feature points are extracted from each image, such as high-stability regions like corners and edge intersections, and are matched with the corresponding feature points in other images to form a set of one-to-one corresponding point pairs. The system constructs a transformation relationship based on these point pairs, and this transformation relationship can be an affine transformation (including rotation, scaling, and translation) or a more complex perspective transformation. To determine the optimal transformation parameters, the system sums the squared spatial errors of all matching points before and after the transformation, and selects the transformation scheme that minimizes this error sum as the final mapping model. After registration, to evaluate the accuracy of image alignment, the system calculates the position deviation of all matching points after the transformation, and takes the square root of the average of the squared deviations to obtain the average residual value, that is, the root mean square error. The system compares this error value with a preset accuracy threshold. This threshold is usually set between 1 and 2 pixels, and the specific value needs to refer to the camera resolution and the minimum recognition unit of defect detection. For example, for a camera system with a resolution of 1024 by 1024 pixels, if the minimum recognition scale of the target defect is 0.5 mm, it is recommended that the error threshold is not greater than 2 pixels to ensure recognition accuracy. If the root mean square error of the registration result exceeds the set threshold, the system will determine that the current registration fails, and then initiate a re-registration process. This process includes re-extracting image feature points, clearing mis-matched pairs, introducing new stable regions as registration reference points, and re-calculating the transformation relationship between images until the error value meets the threshold requirements. After all images are successfully aligned, the system will perform a weighted average on the image pixels in the overlapping area according to the fusion weights calculated above. That is, for multiple image pixels at the same position, their corresponding weights are multiplied by the pixel gray values, and the sum of all weighted values is used as the pixel value of the final image. Finally, the output image is not only highly spatially aligned and seamlessly connected in structure, but also has a visual effect of balanced brightness and uniform sharpness, and can provide a stable and high-quality input basis for subsequent defect recognition. The registration accuracy threshold is an important criterion for judging whether the spatial alignment quality of the image meets the standard, and its setting is mainly determined based on the image resolution, the minimum recognition scale of defect detection, and the feature quality of the image overlapping area.Specifically, this threshold is usually in pixels and measures the average spatial offset of corresponding feature points in the overlapping area of the registered image. Taking a camera with a resolution of 1024×1024 pixels as an example, if the minimum defect size to be recognized by the detection system is 0.5 mm and the actual length corresponding to each pixel is about 0.1 mm, it is recommended to set the registration error threshold to 1 to 2 pixels to ensure that the image error does not interfere with the accurate positioning of the defect boundary. If the registration error exceeds this threshold, the system will automatically trigger the process of recalculating the registration reference point. This threshold can also be dynamically adjusted according to specific application scenarios. For example, on a production line with weak feature textures, low image contrast, or slight displacement jitter, the threshold can be set within 3 pixels based on the previous test data, and appropriate tolerance control can be carried out in combination with image enhancement or geometric compensation strategies, so as to ensure that the registration effect is both reliable and has a certain robustness. This implementation mode ensures the stability and consistency of the multi-view image fusion process by introducing a fusion weight and a registration accuracy determination mechanism, and significantly improves the overall spatial alignment quality of the image. The system can dynamically adjust the registration strategy and reference point settings according to the real-time registration effect, improve the image stitching efficiency while reducing the stitching error, thus effectively supporting the image input quality of the high-precision defect detection system and enhancing its adaptability and practical value in the complex application environment of the industrial site.

[0034] The three-dimensional scanning device is a laser three-dimensional contour scanner or a structured light scanning system, which is used to improve the geometric data acquisition accuracy of complex cross-section structures.

[0035] In this embodiment, the 3D scanning device used by the system is a laser 3D contour scanner or a structured light scanning system, both of which have high-precision surface contour reconstruction capabilities and are particularly suitable for scanning the geometric structure of the aluminum profile cross-section with grooves, abrupt boundaries or curved surfaces on the surface. The laser 3D contour scanner emits single-line or multi-line lasers to the object to be measured, and uses a receiver to receive the reflected signals. Based on the principle of triangulation, the spatial coordinate information of each scanning point is calculated, and then a complete point cloud model of the cross-section is constructed. The structured light scanning system projects a specific pattern of fringe light onto the surface of the aluminum profile and combines binocular or multi-camera to decode the fringe deformation, quickly restoring high-density 3D geometric data. Compared with traditional contact measurement methods or low-resolution imaging methods, the above two non-contact optical scanning technologies can achieve accurate modeling of the profile cross-section with complex curved surfaces and deep groove structures without affecting the production rhythm. After the system acquires the complete 3D point cloud data, cross-section geometric feature vectors are generated through algorithms such as curvature analysis, normal calculation and principal axis extraction, and further assist in the establishment of subsequent multi-view image acquisition strategies and occlusion area prediction. The high-precision geometric information also makes the image acquisition angle configuration more reasonable, avoiding image missing and misjudgment phenomena, and laying a foundation for the comprehensiveness and reliability of surface defect detection. By adopting a laser 3D contour scanner or a structured light scanning system, this embodiment significantly improves the 3D reconstruction accuracy of complex geometric cross-section structures, providing high-quality basic data for the entire image recognition and defect detection process. Compared with general imaging devices, this method has higher spatial resolution and measurement sensitivity, and is particularly suitable for industrial aluminum profile scenarios with high-frequency microstructural changes. Its fast, high-density, non-contact measurement characteristics also improve the automation ability and environmental adaptability of the detection system, meeting the industrial application requirements of high-speed and continuous production lines.

[0036] The geometric feature parameters include the curvature change rate, the normal direction distribution, and the groove depth index. In this embodiment, to accurately characterize the structural morphology of the aluminum profile cross-section, the system extracts multiple geometric feature parameters from the three-dimensional point cloud data, including the curvature change rate, the normal direction distribution, and the groove depth index. The curvature change rate is used to describe the geometric mutation degree of the surface curve. The system fits the surface within the local neighborhood of each point, calculates the principal curvature or Gaussian curvature, and analyzes its first-order derivative in space to obtain the change trend representing geometric complexity, thereby identifying the sharply changing structural edges or corners. The normal direction distribution evaluates the overall folding or convex-concave state of the cross-section surface by statistically analyzing the distribution density of all point normal vectors on the unit sphere. If the normal distribution exhibits highly concentrated or multi-polar characteristics, it indicates that there are a large number of sharp turns, overlaps, or nested structures in this area, and perspective optimization processing is required. In addition, based on the contour information of the aluminum profile cross-section on different projection planes, the system calculates the maximum depth of each potential groove area relative to the reference surface and defines the groove depth index. This index is calculated from the distance between the cross-section edge points and the fitted main plane (or envelope surface), is usually expressed in millimeters, and is used together with the groove width and the contour enclosed area to judge the occlusion tendency. The above geometric feature parameters form the cross-section geometric feature vector, which not only provides an accurate basis for subsequent shadow area identification and image acquisition angle planning, but also quantitatively describes the structural complexity, helping the system to automatically adjust the multi-perspective detection strategy. By introducing three geometric feature parameters, namely the curvature change rate, the normal direction distribution, and the groove depth index, the present invention can more comprehensively and accurately depict the aluminum profile cross-section structure, and is particularly suitable for the detection tasks of components with complex surfaces, depressions, and variable cross-sections. This geometric parameter system not only improves the recognition ability of potential occlusion areas and key defect sensitive areas, but also provides strong structural support for image acquisition optimization, adaptive scheduling, and defect classification recognition of the system. Compared with the traditional scheme that only uses rough geometric data, this method significantly improves the detection coverage and accuracy.

[0037] The coordinate set of the shadow area is automatically generated by calculating the included angle between the local perspective occlusion degree and the surface normal direction. In this embodiment, the system calculates the local occlusion degree of each three-dimensional point and the included angle between its normal direction and the camera perspective direction to identify possible image occlusion or imaging dead zones of the aluminum profile cross-section at different observation angles, thereby generating the coordinate set of the shadow area. Specifically, the system first extracts the normal vector of each point from the three-dimensional point cloud data and performs a dot product operation with the light incident direction of the current candidate perspective to obtain the cosine value of the included angle between the two. This cosine value reflects the consistency between the surface normal orientation and the camera line of sight. If this value is closer to zero, it indicates that the surface tends to be perpendicular to the camera direction, and it is very likely that the imaging quality will decline due to depression or occlusion. At the same time, in each local area, by combining the point cloud density, curvature, and groove depth analysis, the visibility of the area from this perspective is evaluated to obtain the perspective occlusion factor of the area. This factor is usually determined by integrating two sub-indices: one is the curvature gradient, that is, how fast the curvature of the area changes, which is used to judge whether it is a concave-convex mutation area; the other is the range of change of the local normal direction, which reflects whether the surface is continuously and violently folded. Finally, when the cosine value of the included angle of a certain three-dimensional point is lower than the set occlusion threshold (such as 0.3), and the occlusion factor of the area where it is located exceeds the preset standard (such as 0.6), then this point will be marked as a potential shadow point by the system. The coordinates of all points that meet this condition are aggregated into the coordinate set of the shadow area, which is used to guide the multi-perspective optimization configuration and the image reconstruction process.

[0038] This embodiment realizes the automatic identification and spatial calibration of the shadow area by combining three-dimensional spatial geometric information and imaging perspective parameters. Compared with the traditional blind area estimation method that relies on experience settings, this method can accurately label the easily occluded areas under different combinations of cross-section shapes and observation angles, providing quantifiable data support for perspective optimization, lighting compensation, and image reconstruction, thereby effectively improving the integrity of defect identification and the robustness of the system. It is especially suitable for aluminum profile cross-sections with multiple grooves and curved surface mutation structures.

[0039] In this patent, to accurately extract geometric features such as the cross-section shape information, groove position, and curvature change of the aluminum profile, the present invention adopts the following surface reconstruction processing flow: Three-dimensional point cloud data acquisition and preprocessing: High-density three-dimensional point cloud data of the aluminum profile cross-section is obtained using a laser profile scanner or a structured light scanning system. The data is processed by statistical filtering and voxel grid sampling to remove outliers, reduce noise, and improve the uniformity of the point cloud density; Attitude normalization processing: The principal component analysis (PCA) algorithm is used to perform attitude normalization processing on the point cloud data, calculate the main direction vector of the point cloud, and rotate the point cloud to a unified reference coordinate system for subsequent surface feature analysis; Normal direction calculation and curvature analysis: For each point cloud data point, its neighborhood point set is selected (such as using k-nearest neighbor or fixed-radius search), a local plane is fitted, and the normal direction is calculated; Further, a local surface is fitted, and the Gaussian curvature, mean curvature, and their change rates are calculated to identify regions with sudden curvature changes and preliminarily determine the geometric boundaries and concave-convex regions of the cross-section; Groove structure recognition and depth feature extraction: By performing clustering analysis on the regions with rapid changes in the normal direction, the groove boundaries are identified; Taking the reference plane fitted by the main direction as the benchmark, the maximum distance from the local points to the reference plane is measured as the groove depth index, and the depression characteristics are further confirmed in combination with the groove length and opening angle; Execution of the surface reconstruction algorithm: The Poisson surface reconstruction algorithm is used to perform overall surface modeling on the preprocessed point cloud. This algorithm forms a continuous and smooth three-dimensional surface by solving the implicit function field (i.e., reconstructing based on the gradient field of points and normals), and is suitable for the cross-section structure of aluminum profiles with complex contours and significant detail changes; Generation of cross-section geometric feature vectors: The above-extracted curvature change rate, normal direction distribution density, and groove depth index are vectorized and encoded to form cross-section geometric feature vectors for subsequent view optimization analysis and shadow region recognition. Through the above steps, not only high-precision surface reconstruction is achieved, but also the quantitative extraction of cross-section structure features is completed, ensuring that the subsequent defect recognition algorithm can perform accurate detection on the complete surface image, thereby eliminating the missed detection problems caused by image blind spots and structural occlusions.

[0040] Identify the shadow regions that may be formed due to structural occlusion. The specific methods and steps are as follows: Input data preparation: First, based on the cross-sectional three-dimensional point cloud data obtained by a laser profile scanner or a structured light device, the normal vector and local curvature features of each point are obtained through a surface fitting algorithm. The point cloud data should be the cross-sectional geometric model after attitude normalization; Define the candidate observation view set. According to the industrial production line camera arrangement restrictions and the cross-sectional feature shape, multiple observation directions are predefined (for example, a view set containing 0° to 180° is constructed at intervals of 15°), and each view corresponds to a line-of-sight vector; Calculate the local occlusion factor. For each point, first calculate the cosine value of the angle between the normal direction of the point and the current view direction; if this cosine value is less than a set threshold (for example, zero point three), then it is considered that the point is in a non-facing state relative to this view, that is, there is an occlusion tendency. At the same time, count the curvature in the neighborhood around this point (for example, within five millimeters) and calculate the maximum curvature value in this neighborhood; if this value exceeds the set curvature threshold (for example, zero point one), then determine that this area is a structural mutation area. If both of the above two conditions are met, then mark this point as a potential shadow point; Shadow area clustering and coordinate extraction: Cluster all potential shadow points in space. After removing discrete points, extract the minimum bounding box coordinate range of each cluster to form the shadow area coordinate set of this cross-section under this view; Multi-view fusion evaluation: Repeat the steps of calculating the local occlusion factor and shadow area clustering and coordinate extraction to evaluate all candidate views, and count the occlusion frequency of each point under each view. If a point is marked as a potential shadow point in more than half of the views, then mark it as a "high occlusion risk area" and give priority to its imaging compensation in the subsequent multi-view configuration; Output result: Finally, output the shadow area coordinate set and the global high occlusion point coordinate set under each candidate view, providing a basis for predicting the occlusion area for image acquisition path planning, illumination compensation adjustment, and image stitching processing. This step method has clear input conditions, logical judgment processes, and output structures, can effectively predict the visual blind area caused by the complex structure of the aluminum profile cross-section, and provides support for optimizing the image acquisition configuration. This technical solution takes into account the relationship between the point cloud normal direction, curvature information, and observation direction, and has general adaptability and good engineering feasibility.

[0041] In the present invention, the processing process of defect boundary extraction and image segmentation includes the following detailed steps: Image acquisition and preprocessing. First, multiple line-array cameras are used to obtain the original images of the aluminum profile surface. Geometric correction and illumination normalization are performed on the multi-view images. Gray-level equalization and Gaussian filtering are used to preprocess the images to reduce surface texture interference and enhance the contrast of defect areas; Defect candidate region generation. A deep learning feature extraction module is used to perform feature encoding on the multi-view images. A detection algorithm based on the improved YOLOv5 network is used to perform object detection on the suspicious defects in the images to generate initial candidate boxes as suspected defect regions. In this process, multi-scale feature maps are extracted through convolutional layers, and an attention mechanism module is combined to improve the recognition ability of low-contrast defects; Region enhancement and segmentation preparation. For the detected defect candidate regions, the edge sharpness is enhanced by the adaptive gradient enhancement method, and at the same time, local normalization processing is performed on the images within the candidate regions. The image pyramid method is used to perform multi-resolution processing on the defect regions to provide redundant feature support for subsequent boundary extraction; Accurate boundary extraction. In the enhanced defect image region, first, the Canny edge detection algorithm is used to locate the edge lines with sudden gray-level changes in the image, and then morphological operations (including erosion, dilation, and edge closing) are combined to remove false edges. Subsequently, the contour tracking algorithm is used to reconstruct the edge curves to form closed contours and obtain the defect boundary lines; Image segmentation and label generation. Based on the closed contour region, a corresponding binary mask image is generated and image segmentation processing is performed. For each defect region, the system performs pixel-level superposition segmentation with the original image to extract a clear defect region image, and at the same time generates corresponding label information, including defect number, area, position coordinates, etc.; Post-processing and abnormal rejection. For each segmented defect region, the system calculates indicators such as its area, aspect ratio, boundary complexity, and gray-level gradient intensity. If the feature values of the defect region do not meet the set thresholds (such as too small area, insufficient contrast), it is rejected to reduce false detections and improve the overall detection accuracy; Through the above steps, the system can accurately locate the defect regions, extract the boundaries, and complete pixel-level image segmentation from the original images, effectively supporting subsequent defect classification and grade evaluation, and ensuring the accuracy and robustness of defect recognition.

[0042] To achieve complete imaging of the entire aluminum profile surface, the present invention proposes a method for stitching and registration of multi-view images, which specifically includes the following implementation steps: Multi-view image acquisition. The moving aluminum profile is synchronously acquired by line-array cameras installed at multiple different angles. Each camera acquires a continuous sequence of image frames through an encoder trigger signal to ensure the consistency of the images on the time axis and the space axis, and to avoid data overlap or frame loss; Image preprocessing and distortion correction. For each image path, camera internal and external parameters are calibrated. The Zhang Zhengyou calibration method is used to obtain lens distortion parameters, and the image is geometrically corrected to eliminate the image bending caused by lens distortion. Further, the gray value of the image is normalized to reduce the impact of uneven illumination on the stitching quality; Image feature point extraction. The edge overlapping area of each group of adjacent images is selected, and key points are extracted through the Scale-Invariant Feature Transform (SIFT) algorithm. Combining with fast corner detection (such as FAST) enhances the feature density in the edge texture area and improves the matching accuracy; Image registration and parameter solution. The RANSAC algorithm is used to eliminate outliers from the matched feature point pairs, and the affine transformation matrix or perspective projection matrix is solved to achieve spatial alignment between images. The transformation matrix is used to map images from multiple perspectives to a common reference coordinate system; Image fusion and stitching processing. After completing the geometric alignment of the images, the multi-exposure weighted fusion method is adopted to perform gray level equalization and edge smoothing on the overlapping area of the images to prevent sudden brightness changes at the seams. Finally, through image weighted superposition, images from multiple perspectives are stitched to generate a continuous image band covering the entire surface of the aluminum profile; Complete image generation and post-processing. The stitched images are uniformly cropped to the standard size, and black edges or invalid pixel areas are removed. Finally, a high-resolution, seamless complete surface image is output, providing high-quality image input for subsequent defect detection algorithms; Through the above steps, the system can efficiently and stably complete the registration and fusion processing of multi-perspective images, solving the problems of image fracture, ghosting, or misalignment caused by stitching errors or image distortion in traditional methods, and ensuring the accuracy and continuity of the complete image.

[0043] In the present invention, to achieve automatic identification of surface defects of aluminum profiles, the system uses an improved YOLOv5 object detection model based on deep learning for defect identification. The detailed implementation process is as follows: Training data construction. Surface images of aluminum profiles containing various typical defects (such as scratches, dents, cracks, bubbles, corrosion spots, etc.) are collected, and each defect is annotated with a bounding box using an artificial annotation tool to generate a training dataset in YOLO format; the annotation content includes class labels, location information (center point coordinates, width, and height), etc.; Model structure design. The selected model is based on the YOLOv5 framework. The backbone network uses CSPDarknet as the feature extractor (Backbone), and the cross-stage partial connection mechanism is used to enhance the deep semantic extraction ability; in the feature pyramid structure, FPN and PAN path boosters are introduced to enhance the detection ability for small-size defects; in the detection head part, feature maps of different scales are output to cover various defect targets with obvious size differences; Module optimization and improvement. To enhance the ability to identify subtle defects with low contrast, an attention mechanism module (such as the CBAM or SE module) is introduced into the model to enhance the feature response in the spatial and channel dimensions. In addition, the CIoU loss function is introduced in the loss function part to optimize the bounding box regression effect and reduce the detection box offset. Training process and parameter configuration. The model is trained using the transfer learning strategy, and the pre-trained weights of the COCO dataset are initially loaded for fine-tuning. During the training process, the Adam optimizer is used, the initial learning rate is set to 0.001, the batch size is set to 16, and the number of training epochs is 300. Random data augmentation (such as random cropping, rotation, flipping, light perturbation, etc.) is used during the training process to improve the generalization ability of the model. Inference and detection process. In the actual detection stage, the surface image of the aluminum profile after complete stitching is input into the model, and the model outputs the predicted category, position coordinates, and confidence score of each defect. Subsequently, the effective detection results are screened according to the set confidence threshold (such as 0.3), and the defect contour extraction and label generation are further completed in combination with the image segmentation module. Evaluation and output. The average precision (mAP) of the defect recognition model on the validation set reaches more than 90%, which can stably identify various types of surface defects and provide clear position, area, shape, and classification labels for each defect target, meeting the industrial-level detection accuracy requirements. In summary, the present invention clearly adopts the YOLOv5 deep neural network as the core defect recognition model, and combines the attention enhancement mechanism, CIoU regression optimization, transfer learning, etc. to achieve the automatic detection ability of high robustness and high precision for the surface defects of aluminum profiles, meeting the requirements of modern intelligent manufacturing for the feasibility and practicality of detection algorithms.

[0044] In the present invention, the defect severity scoring module is used to quantitatively classify the detected surface defects of aluminum profiles. The scoring basis mainly includes indicators such as the area, shape characteristics, gray contrast, edge sharpness, and occurrence position of the defects. The specific scoring process is as follows: Feature extraction. For each detected defect area, the system automatically extracts the following feature indicators: Defect area: The number of pixels is counted and converted into physical dimensions; Defect shape: Geometric features such as aspect ratio, roundness, and edge complexity are calculated; Gray contrast: The average gray difference between the defect area and its surrounding background area; Edge sharpness: The average gradient intensity of the edge is calculated using the gradient operator; Defect position: Mark whether it is in the critical functional area or the edge crack-prone area. Index normalization processing. All eigenvalues are standardized and converted into scores between 0 and 1. Taking the defect area as an example, the minimum acceptable defect area is set as the threshold, and the excess part is normalized and scored proportionally; the gray contrast is linearly converted based on the maximum gray difference of 100; Weighted scoring model construction. The following weighted scoring model is used to calculate the severity of defects: Severity score = A × Area score + B × Contrast score + C × Edge sharpness score + D × Shape score + E × Location score, where the weights A - E are determined according to actual process experience or expert system evaluation. The typical settings are as follows: the area weight is 0.3, the contrast is 0.25, the edge sharpness is 0.2, the shape is 0.15, and the location is 0.1; Score classification and grading criteria. According to the final score value, the defects are divided into three categories: Minor defects: score between 0.00 - 0.39; Medium defects: score between 0.40 - 0.69; Severe defects: score between 0.70 - 1.00; Result output and annotation. Each defect is correspondingly annotated with its category, severity level, and specific score in the image, and is output to the result form for subsequent quality analysis and sorting system calls; Through the above scoring process, the system can comprehensively quantify the influence degree of each defect based on various image parameters, thereby realizing scientific and objective defect level determination, and effectively supporting quality control and grading processing in the industrial field.

[0045] In the present invention, to evaluate the performance of the defect boundary segmentation module, the intersection over union (IoU) of image semantic segmentation is used as the core index, supplemented by accuracy, recall rate, and F1 value for comprehensive evaluation. The specific implementation process is as follows: Construction of an artificially annotated reference dataset. Representative defect images of various types are selected from actual production image samples, and professional annotators use image annotation tools to accurately outline the defect boundaries, generating an artificially annotated true mask as the standard reference; Extraction of the model output mask. The defect detection and segmentation module processes the same image and outputs the model prediction mask image, which has a one-to-one correspondence with the true mask at the pixel level; Calculation method of intersection over union (IoU). For each pair of predicted masks and true masks, calculate the area of their intersection region and the area of their union region. IoU is defined as the ratio of the two: IoU = Intersection area of the predicted region and the true region / Union area. When IoU is higher than a preset threshold (e.g., 0.5), the prediction is determined to be a valid and correct segmentation; Statistical evaluation index extraction, accuracy rate: among the regions predicted as defects by all models, the proportion of actual defects; recall rate: among all actual defect regions, the proportion correctly identified by the model; F1 value: the harmonic mean of the accuracy rate and the recall rate, used to comprehensively evaluate the model segmentation performance; average IoU: taking the average of IoU for multiple images, reflecting the overall segmentation accuracy; Segmentation evaluation output, the system calculates the average IoU value and F1 value in the entire test set as the performance indicators of the defect boundary segmentation module. For example: in the test set, the system of the present invention can achieve an average IoU of 0.86 for scratch-type defects and 0.82 for pit-type defects, and the F1 value is generally above 0.88, indicating that the model boundary extraction accuracy is relatively high; Threshold adjustment and model iteration, if the IoU of some types of defects is low, the system can automatically analyze and adjust the edge sensitivity parameters or image enhancement strategies according to the error heat map, and further iteratively optimize the model structure and parameter configuration; Through the above segmentation accuracy evaluation mechanism, it is ensured that the defect boundary extraction process has a quantitative standard and comparable performance, thereby improving the stability and credibility of the overall detection system and meeting the accuracy requirements of industrial quality control.

[0046] To solve the problems of multiple occlusion regions and single-view imaging blind spots in complex-section aluminum profiles, the system introduces a multi-view dynamic optimization model based on an occlusion rate evaluation function to achieve automatic optimization and scheduling of camera view configurations. Its specific algorithm model and implementation process are as follows: Input data preparation, the system first completes the three-dimensional point cloud reconstruction of the target aluminum profile section, calculates the normal vector, local curvature and spatial distribution characteristics of each surface point, and at the same time defines a set of candidate camera views (such as constructing multiple observation direction vectors from 0 to 180 degrees at an angular interval); Visibility analysis model, for each candidate view, the system traverses all surface points and calculates the cosine of the angle between the normal direction of the point and the view direction; when this value is lower than a set threshold (such as 0.3), the point is regarded as invisible. The system further records the proportion of all invisible points in this view, which is defined as the "occlusion rate" of this view; Optimization objective function construction, define the objective function as the minimum overall occlusion rate under the view combination, and at the same time consider the overlap degree and shooting redundancy between images of each view. The optimization model objectives are as follows: minimize the global occlusion rate (the cumulative frequency of all points being occluded); limit the overlap area between adjacent view images to be no less than 30% to ensure the continuity of image stitching; control the number of views to reduce system complexity and imaging time; Multi-view combination solution strategy. The system adopts a joint optimization strategy based on heuristic search and genetic algorithm. First, a feasible initial solution is quickly generated through the greedy algorithm (such as taking a view every 60°), and then the view combination is iteratively evolved through the genetic algorithm for multiple rounds. Each generation of individuals represents a set of views. The fitness function is based on the weighted score of the objective function, and finally converges to the optimal view configuration; Output the optimal view set. The output results include the selected minimum necessary number of views, the layout angles and numbers of each camera. At the same time, the occlusion point distribution map under this configuration is output for occlusion hot zone verification; Dynamic adjustment mechanism. During the detection operation, if the system identifies a decrease in the defect recognition rate in a local area, it can re-evaluate the occlusion risk of this area under the current view, trigger a local view rescheduling, and ensure the overall detection continuity and the minimization of occlusion blind areas; Through the above optimization algorithm model, the system can realize the automatic camera view layout for any cross-section structure, effectively improve the integrity of image acquisition and the defect coverage rate, enhance the multi-view image fusion accuracy, and meet the high-precision defect detection requirements in complex industrial scenarios.

[0047] To achieve the three-dimensional layout accuracy control of multi-view cameras, the system realizes the reverse solution of the precise coordinate position (x, y, z) and its attitude angle parameters (pitch angle, yaw angle, roll angle) of each camera in the three-dimensional space through three-dimensional inverse calibration technology. The specific steps of this process are as follows: Calibration board layout and data acquisition. A standard checkerboard calibration board is laid on the working platform of the image acquisition system. The plane attitude of the calibration board is known and has an accurate three-dimensional coordinate system. Each camera takes static pictures of the calibration board to obtain a sequence of calibration images containing multiple corner images; Image corner extraction. For each calibration image, a sub-pixel level corner detection algorithm is used to extract the image coordinates of the checkerboard corners. Using the "findChessboardCorners" and "cornerSubPix" functions in OpenCV, the accurate image point coordinates and their corresponding relationships in the calibration board coordinate system can be obtained; Internal parameter calibration. Each camera is calibrated for its internal parameters to solve the parameters of focal length, principal point, and distortion coefficient, and form the camera internal parameter matrix. This step ensures the accuracy basis for subsequent pose inverse solution; Pose inverse solution. Using the PnP (Perspective-n-Point) algorithm, the three-dimensional points of the calibration board are corresponded to the image plane points, and the pose transformation matrix of the camera relative to the calibration board coordinate system is solved through the least squares method or the RANSAC-PnP algorithm. This transformation includes: the position coordinates (x, y, z) of the camera in the three-dimensional space; the rotation angles represented in Euler angles, including the roll angle around the x-axis, the pitch angle around the y-axis, and the yaw angle around the z-axis; Coordinate system transformation and unification, transform the pose matrix of each camera from the calibration board coordinate system to the system unified reference coordinate system (such as the reference edge of the aluminum profile), ensuring the consistency of the spatial postures of each camera; perform the conversion from the rotation matrix to Euler angles when necessary to clarify the meaning of each angle in the physical space; Error evaluation and calibration optimization, conduct reprojection error analysis on the calibration results of all cameras. If the reprojection error is greater than the set threshold (such as 0.5 pixels), the system will automatically prompt to re-acquire images or finely adjust the camera position to ensure the accuracy requirements; Finally, the pose information of each camera in space will be saved in the form of a six-dimensional parameter vector (three-dimensional position + three-dimensional attitude) for the system to use for image registration, view planning, and occlusion evaluation; Through the above reverse calibration steps, the system can achieve high-precision spatial layout reconstruction of the multi-camera imaging system, providing an accurate geometric basis for image stitching, defect location, and path compensation.

[0048] As Figure 2 shown, there is also provided an automatic aluminum profile surface defect detection system based on image recognition for implementing the steps of the automatic aluminum profile surface defect detection method based on image recognition. The system includes: Data acquisition and preprocessing module, used to obtain the three-dimensional geometric data of the aluminum profile cross-section through a three-dimensional scanning device, extract the geometric feature parameters required for calculating the candidate observation angles and coverage range, and mark the spatial coordinate range corresponding to the area of the shadow region if the cross-section shape contains grooves or curved surface structures, obtaining the cross-section geometric feature vector and the shadow region coordinate set; Image construction and defect recognition module, used to obtain a complete surface image unified in space according to the cross-section geometric feature vector, and through the complete surface image, adopt a defect detection algorithm to extract surface abnormal features and defect boundary segmentation results. If defect features are detected, conduct defect type label classification and severity level assessment to obtain a detection report including defect position coordinates, defect type labels, and severity levels; Intelligent regulation module, used to adjust the camera illumination intensity parameters according to the defect position coordinates and defect type labels in the detection report. If the defect boundary segmentation accuracy rate of the area is lower than the preset threshold, update the candidate observation angles and view switching frequencies to obtain an optimized multi-view configuration scheme and trigger timing table.

[0049] The overall design of the system follows a modular architecture to ensure efficient collaboration among data acquisition, image analysis, and system self-regulation processes. First, the data acquisition and preprocessing module obtains high-precision three-dimensional point cloud data through a laser profilometer or structured light scanning device. The system calculates the normal direction, curvature, and depth difference of each point through point cloud analysis methods, thereby extracting key geometric parameters such as the curvature change rate, normal direction distribution, and groove depth. Combining perspective occlusion simulation, the system automatically identifies shadow areas that may have imaging blind spots and outputs their spatial coordinates as a shadow area coordinate set. Based on the above features, the module also uses a coverage rate evaluation method to generate an initial candidate observation angle set for subsequent image planning.

[0050] Subsequently, the image construction and defect recognition module automatically selects imaging angles and camera parameter configurations according to the cross-section geometric feature vector. Through multi-angle image acquisition and registration, a complete surface image with unified space and continuous structure is constructed. On this basis, the module calls a convolutional neural network model to identify features such as brightness changes, texture interruptions, or geometric mutations in the image, automatically labels the defect types (such as scratches, bubbles, indentations, etc.), and combines quantitative indicators such as the area, length, and contrast of the defects to conduct severity level classification. The final output detection report includes the precise spatial coordinates of the defects, defect type labels, and their grade evaluation results.

[0051] The intelligent regulation module dynamically adjusts the imaging system strategy according to the detection report results. If the defect recognition accuracy rate in a certain area is lower than the threshold (such as 85%), the system will analyze the image quality of this area, estimate the light compensation coefficient using the brightness deviation and structural boundary blur degree, and automatically adjust the intensity and direction of the LED or laser light source. At the same time, based on the image redundancy rate and detection blind area evaluation, this module recalculates the optimal observation angle combination and switching frequency, and updates the camera trigger timing table to achieve higher-quality imaging in the same time window for the next round of detection.

[0052] The system constructed in this embodiment integrates three-dimensional acquisition, defect detection, and strategy optimization into a closed-loop control process through a data-driven method, significantly improving the self-adaptability and intelligence level of the aluminum profile defect detection system. Compared with the traditional fixed-viewpoint and manual analysis solutions, this system not only improves the detection coverage rate and recognition accuracy rate, but also has efficient data management capabilities and imaging task scheduling capabilities, and is especially suitable for production environments with a wide variety of products and frequent complex cross-section changes.

[0053] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. An automatic detection method for surface defects of aluminum profiles based on image recognition, characterized in that, The method includes: Obtaining three-dimensional geometric data of the aluminum profile cross-section through a three-dimensional scanning device, extracting geometric feature parameters required for calculating candidate observation angles and coverage ranges, and if the cross-section shape includes grooves or curved surface structures, marking the spatial coordinate range corresponding to the shaded area, to obtain a cross-section geometric feature vector and a shaded area coordinate set; Based on the cross-section geometric feature vector, obtaining a unified complete surface image in space, and through the complete surface image, using a defect detection algorithm to extract surface anomaly features and defect boundary segmentation results. If defect features are detected, perform defect type label classification and severity level assessment to obtain a detection report including defect position coordinates, defect type labels, and severity levels; Based on the defect position coordinates and defect type labels in the detection report, adjusting the camera illumination intensity parameters through the illumination compensation coefficient. If the defect boundary segmentation accuracy rate of the area is lower than a preset threshold, update the candidate observation angles and view switching frequencies to obtain an optimized multi-view configuration scheme and a trigger timing table.

2. The automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The obtaining of a unified complete surface image in space based on the cross-section geometric feature vector includes: Based on the cross-section geometric feature vector, using a view optimization algorithm to calculate the coverage range of candidate observation angles. If the shaded area under a certain observation angle exceeds a preset threshold, adjust the camera position parameters and angle adjustment strategy to determine the optimal multi-view configuration scheme and the corresponding camera three-dimensional space coordinate position and tilt angle parameters.

3. The automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 2, characterized in that: The obtaining of a unified complete surface image in space based on the cross-section geometric feature vector further includes: Through the optimal multi-view configuration scheme, obtaining the image acquisition parameter settings under different candidate observation angles, detecting the overlapping area detection results between adjacent views. If there is an overlapping area, establish a spatial mapping relationship between views to obtain the registration reference points and multi-view fusion weights of the multi-view images.

4. The automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 3, characterized in that: The obtaining of a unified complete surface image in space based on the cross-section geometric feature vector further includes: Based on the aluminum profile product specifications and the current production line speed, using a dynamic timing calculation module to analyze the time interval for the product to pass through the detection area. If the production beat changes, adjust the view switching frequency, camera trigger frequency, and exposure time parameters to determine the synchronous trigger timing table and the image acquisition time window.

5. The automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 4, characterized in that: The obtaining of a unified complete surface image in space based on the cross-section geometric feature vector further includes: Controlling the coordinated work of multiple cameras through the synchronous trigger timing table to obtain an image sequence of the same product cross-section under different candidate observation angles. If product position deviation is detected within the image acquisition time window, start the position compensation mechanism to obtain a time-synchronized multi-view image data set.

6. The automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 5, characterized in that: The obtaining of a unified complete surface image in space based on the cross-section geometric feature vector further includes: Based on the time-synchronized multi-view image data set and the multi-view fusion weights, using image registration technology to perform spatial alignment on images at different angles. If the registration accuracy is lower than the registration accuracy threshold, recalculate the registration reference points to obtain a unified complete surface image in space.

7. An automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The three-dimensional scanning device is a laser three-dimensional contour scanner or a structured light scanning system, which is used to improve the geometric data acquisition accuracy of complex cross-section structures.

8. The automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The geometric feature parameters include the curvature change rate, the normal direction distribution, and the groove depth index.

9. The automatic detection method for surface defects of aluminum profiles based on image recognition according to claim 1, characterized in that: The set of shadow area coordinates is automatically generated by calculating the angle between the local perspective occlusion degree and the surface normal direction.

10. An automatic detection system for surface defects of aluminum profiles based on image recognition, which is used to implement the steps of the automatic detection method for surface defects of aluminum profiles based on image recognition according to any one of claims 1-9, characterized in that, The system includes: A data acquisition and preprocessing module, which is used to obtain the three-dimensional geometric data of the aluminum profile cross-section through a three-dimensional scanning device, extract the geometric feature parameters required for calculating the candidate observation angles and coverage range, and mark the spatial coordinate range corresponding to the shadow area if the cross-section shape contains a groove or a curved surface structure, so as to obtain the cross-section geometric feature vector and the set of shadow area coordinates; An image construction and defect recognition module, which is used to obtain a complete surface image unified in space according to the cross-section geometric feature vector, and extract the surface abnormal features and defect boundary segmentation results through the complete surface image. If defect features are detected, defect type label classification and severity level evaluation are performed to obtain a detection report including defect position coordinates, defect type labels, and severity levels; An intelligent regulation module, which is used to adjust the camera illumination intensity parameters according to the defect position coordinates and defect type labels in the detection report through the illumination compensation coefficient. If the defect boundary segmentation accuracy rate of the area is lower than the preset threshold, update the candidate observation angles and the view switching frequency to obtain an optimized multi-view configuration scheme and a trigger timing table.

Citation Information

Patent Citations

  • Multi-camera image acquisition method and device

    CN113888408A

  • Cable head defect intelligent detection system

    CN117455843A

  • Die-casting alloy workpiece defect detection method and system based on visual identification

    CN118130477A

  • Internet intelligent manufacturing service platform

    CN118261439A

  • Multi-scale inspection and intelligent diagnosis system and method for tunnel structural defects

    US20210396842A1

Cited By

  • High-power visual surface light source design method based on COB (Chip On Board) technology

    CN120580518A

  • Defect detection method for reticle mask

    CN120722650A

  • Wafer edge defect detection method and system based on image recognition and storage medium

    CN120894328A

  • Alloy resistor surface defect real-time detection method and system based on image processing

    CN120894367A

  • Real-time detection method and system for surface defects of alloy resistance based on image processing

    CN120894367B