A machine vision-based spacer forging surface defect recognition system

CN122775554APending Publication Date: 2026-09-18XIAN CHUANGYUAN ELECTRIC POWER HARDWARE FITTINGS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611257204.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-19
Publication Date
2026-09-18

AI Technical Summary

Technical Problem

[0003]本发明的目的在于提供一种基于机器视觉的间隔棒锻造表面缺陷识别系统,解决传统检测中表面氧化皮动态干扰与精密滚花周期纹理混叠导致的特定尺寸域缺陷难以稳定分离的问题,并建立结合异常复核与空间自适应展开的闭环判定机制,以提升复杂工况下缺陷检测的准确性和可追溯性

Benefits of technology

1、本发明通过相位解算将相移图像数据转换为绝对相位图和深度图,并结合对绝对相位图的频域带阻滤波处理,能够靶向抑制滚花空间频率干扰,避免传统空间域平滑方式对真实缺陷边缘的模糊影响,使裂纹、折叠等微观深度突变特征从周期纹理混叠背景中有效分离出来,提高了复杂纹理表面下真实缺陷的提取能力;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122775554A_ABST
    Figure CN122775554A_ABST
Patent Text Reader

Abstract

The present application relates to machine vision detection and forging piece surface quality detection technical field, specifically to a kind of interval bar forging surface defect identification system based on machine vision, including rotary table, clamping mechanism, projection light source, industrial camera, temperature sensor, optical power sensor, clamping state sensor, angle encoder and control host computer;Control host computer is based on clamping state and rotation angle signal to complete three preset circumferential sampling angle phase shift image acquisition, phase solution and depth map conversion, and to absolute phase diagram is frequency domain filtering, phase gradient calculation and temperature threshold correction, extract defect candidate connected domain, after defect evaluation and abnormal review output final defect determination and abnormal prompt information;The present application realizes reliable identification of full surface microdefects under high beat.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision inspection and forging surface quality inspection technology, specifically a machine vision-based system for identifying surface defects in spacer bar forgings. Background Technology

[0002] Current methods for detecting surface defects in spacer bar forgings primarily employ conventional machine vision techniques, relying mainly on two-dimensional grayscale images, fixed exposure parameters, or a single threshold strategy for defect extraction. However, these methods suffer from the following significant shortcomings in practical applications: Feature separation is difficult; the surface of spacer bar forgings is usually accompanied by knurled texture, curved surface structure and high-temperature oxide scale residue. Under the combined effects of workpiece temperature fluctuation, light energy change and circumferential structure shading, the background texture and real defect features are mixed, making it difficult to separate feature-level defects such as cracks and folds from the interference information; the existing technology lacks a verification method that combines re-shooting and recalculation, stability assessment and spatial visualization, resulting in misjudgment and omission, and additional verification steps need to be introduced; Therefore, in order to address the shortcomings of existing technologies in effectively extracting real defects under complex surface morphology and lacking a reliable verification mechanism, and thus improve the accuracy and traceability of surface defect detection of forgings under complex working conditions, this paper proposes a method to address these shortcomings. Summary of the Invention

[0003] The purpose of this invention is to provide a machine vision-based surface defect recognition system for spacer bar forging, which solves the problem of difficult stable separation of defects in specific size domains caused by the dynamic interference of surface oxide scale and the overlapping of precision knurling periodic texture in traditional detection. It also establishes a closed-loop judgment mechanism that combines anomaly verification and spatial adaptive expansion to improve the accuracy and traceability of defect detection under complex working conditions.

[0004] This invention is achieved using the following technical solution: a machine vision-based system for identifying surface defects in spacer bar forgings, applied to spacer bar forgings to be inspected, comprising a turntable, a clamping mechanism, a projection light source, an industrial camera, a temperature sensor, an optical power sensor, a clamping status sensor, an angle encoder, and a control host. The control host includes: The data acquisition module connects to an industrial camera, temperature sensor, optical power sensor, clamping status sensor, and angle encoder to acquire surface temperature, optical power, clamping status, rotation angle signals, and phase-shifted image data at three preset circumferential sampling angles. The collaborative control module connects the turntable, projection light source and industrial camera. Based on the clamping status and rotation angle signal, it generates turntable stepping, light source driving and camera exposure commands, triggering the industrial camera to complete image acquisition at three preset circumferential sampling angles. The phase resolution module performs multi-step phase shift calculations and absolute phase unfolding on the phase-shifted image data to generate an absolute phase map, and converts it into a depth map according to the phase-depth mapping relationship calibrated by the system. The defect identification module performs frequency domain filtering, phase gradient calculation, and threshold correction based on surface temperature on the absolute phase map to extract candidate connected components of defects. The defect assessment module calculates the initial defect assessment score for candidate connected components based on preset scoring rules and grading thresholds, and generates re-shooting and recalculation instructions or assessment results. The closed-loop feedback module receives the judgment result, surface temperature, and optical power. When the judgment result meets the preset abnormal conditions, it executes the abnormal review process and outputs the final defect judgment and abnormal prompt information.

[0005] In one alternative approach: the absolute phase map is subjected to frequency domain band-stop filtering to obtain the filtered absolute phase map; The gradient of the filtered absolute phase map is calculated and the gradient threshold is corrected according to the surface temperature. The local gradient magnitude of the filtered absolute phase map is extracted, and the set of pixels whose local gradient magnitude is greater than or equal to the corrected gradient threshold is binarized and marked according to the preset connected component determination rules to obtain the defect candidate connected components.

[0006] In one alternative: the preset abnormal condition is that the absolute value of the difference between the defect judgment score obtained by re-shooting and recalculating and the defect judgment score of the initial judgment exceeds a preset deviation threshold. After the preset abnormal conditions are met, the closed-loop feedback module extracts the boundary morphology features and depth change features of the current defect candidate connected domain. Retrieve the pre-established table of angle and reshoot parameters based on the rotation angle signal; Based on the re-shot image, the corresponding boundary morphology features and depth change features are re-extracted, and the overlap of connected regions before and after the re-shot and the mean local gradient of depth change features are calculated. Based on the comparison results of the overlap of connected regions before and after the re-shot and the mean local gradient with their respective preset thresholds, the initial judgment result is selected as the final defect judgment for output, or the corresponding area is judged as a false defect and an abnormal prompt message is generated.

[0007] In one alternative: the defect assessment module determines a weighted mapping relationship between the threshold amplitude, the regional continuity parameter and the defect judgment score based on known defect samples. The weighted mapping relationship includes at least the value range of each parameter and its corresponding weight. In the current detection task, the parameter input of the current defect candidate connected domain is received, and the parameter input is weighted and corrected according to the weighted mapping relationship to generate a defect judgment score.

[0008] In one alternative: when the defect assessment module calculates the defect determination score, it comprehensively adopts the first assessment parameter, the second assessment parameter and the third assessment parameter. The third assessment parameter is obtained by matching the phase transition curve of the current defect candidate connected domain with the pre-stored defect template formed by known defect samples. The pre-stored defect template is a phase transition reference curve stored in positional order. The defect determination score is obtained by weighting the first evaluation parameter, the second evaluation parameter, the third evaluation parameter and the corresponding preset weights.

[0009] In one alternative approach: a first score threshold and a second score threshold are preset, and the first score threshold is less than the second score threshold; When the defect judgment score is less than the first score threshold, it is judged as background disturbance; when the defect judgment score is greater than or equal to the first score threshold and less than the second score threshold, it is judged as a suspicious defect, and a reshoot and recalculation instruction to change the exposure parameters is output to obtain multiple verification results. When the defect determination score is greater than or equal to the second score threshold, it is determined to be a valid defect, and the three-dimensional coordinates of the valid defect are output to the display terminal or storage module.

[0010] In one alternative approach: for multiple verification results generated after the execution of the re-shooting and recalculation instruction, the defect assessment module evaluates the stability of repeated detection at the same location, the stability of depth changes, and the continuity of edges for the multiple verification results; The stability score of each verification result is obtained by weighting the various evaluation indicators and their corresponding preset weights. The multiple validation results are sorted according to the total stability score, and the validation result with the highest score is output as the key comparison information.

[0011] In one alternative: when the closed-loop feedback module outputs the final defect determination, it acquires the three-dimensional coordinates and rotation angle data of the valid defect; Obtain the 3D model of the spacer bar forging surface generated from the depth map, and calculate the visibility of the defect area from the current rendering view. A preset visibility threshold is set. When the visibility is lower than the visibility threshold, the rendering marker of the defect area is adjusted, and a circumferential two-dimensional unfolded map of the corresponding viewpoint is generated. When the visibility is greater than or equal to the visibility threshold, output the defect annotation result from the current viewpoint.

[0012] Compared with the prior art, the present invention has the following technical effects: 1. This invention converts phase-shifted image data into absolute phase maps and depth maps through phase calculation, and combines frequency domain bandstop filtering of the absolute phase map to target and suppress knurling spatial frequency interference, avoid the blurring effect of traditional spatial domain smoothing on the edges of real defects, and effectively separate micro-depth abrupt features such as cracks and folds from the background of periodic texture aliasing, thereby improving the ability to extract real defects under complex texture surfaces. 2. This invention uses a gradient threshold dynamic correction mechanism based on surface temperature to adaptively adjust the discrimination benchmark according to the background noise fluctuation caused by the change of oxide scale with temperature. This solves the problem that fixed thresholds are prone to failure under temperature fluctuation and oxide scale dynamic interference conditions, thereby improving the imaging consistency and defect identification accuracy of products in the same batch. 3. This invention introduces a multi-parameter weighted evaluation method that includes over-threshold amplitude, regional continuity parameter, and phase jump matching degree. Combined with the results of graded threshold output background disturbance, suspected defects, and valid defects, it establishes a more refined defect confidence evaluation mechanism. This mechanism can overcome the defects that are easily interfered with by single area, gray level, or fixed threshold judgment, and reduce the risk of false alarms and missed detections. 4. This invention performs repeated shooting and recalculation of suspected defects by changing exposure parameters, and performs comprehensive scoring and ranking of multiple verification results based on repeated detection stability, depth change stability and edge continuity. This enables the screening of key comparative information that highly conforms to the real morphological features from multiple sampling results, thereby increasing the verification stability of the fluctuating areas of the detection results. Attached Figure Description

[0013] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 This is a structural block diagram of a machine vision-based spacer bar forging surface defect recognition system provided in an embodiment of this application. Detailed Implementation

[0014] To make the above and other objects, features and advantages of the present invention more apparent and understandable, preferred embodiments will be described in detail below with reference to the accompanying drawings.

[0015] Please see Figure 1 A machine vision-based surface defect recognition system for spacer bar forgings, applied to the spacer bar forgings to be inspected, includes a turntable, clamping mechanism, projection light source, industrial camera, temperature sensor, optical power sensor, clamping status sensor, angle encoder, and control host. The control host includes: The data acquisition module connects to an industrial camera, temperature sensor, optical power sensor, clamping status sensor, and angle encoder to acquire surface temperature, optical power, clamping status, rotation angle signals, and phase-shifted image data at three preset circumferential sampling angles. The collaborative control module connects the turntable, projection light source and industrial camera. Based on the clamping status and rotation angle signal, it generates turntable stepping, light source driving and camera exposure commands, triggering the industrial camera to complete image acquisition at three preset circumferential sampling angles. The phase resolution module performs multi-step phase shift calculations and absolute phase unfolding on the phase-shifted image data to generate an absolute phase map, and converts it into a depth map according to the phase-depth mapping relationship calibrated by the system. The defect identification module performs frequency domain filtering, phase gradient calculation, and threshold correction based on surface temperature on the absolute phase map to extract candidate connected components of defects. The defect assessment module calculates the initial defect assessment score for candidate connected components based on preset scoring rules and grading thresholds, and generates re-shooting and recalculation instructions or assessment results. The closed-loop feedback module receives the judgment result, surface temperature and optical power. When the judgment result meets the preset abnormal conditions, it executes the abnormal review process and outputs the final defect judgment and abnormal prompt information. The defect identification module is configured to: acquire the absolute phase map and surface temperature; perform frequency domain band-stop filtering on the absolute phase map to obtain the filtered absolute phase map; The gradient of the filtered absolute phase map is calculated, and the gradient threshold is corrected based on the surface temperature. Extract the local gradient magnitude of the filtered absolute phase map, binarize the set of pixels whose local gradient magnitude is greater than or equal to the corrected gradient threshold, and mark the connected components according to the preset connected component determination rules to obtain the defect candidate connected components. The preset abnormal condition is: the absolute value of the difference between the defect judgment score obtained by re-shooting and recalculating and the defect judgment score of the initial judgment exceeds the preset deviation threshold. After the preset abnormal conditions are met, the closed-loop feedback module is configured to: extract the boundary morphology features and depth change features of the current defect candidate connected domain; and retrieve the pre-established angle-retake parameter correspondence table based on the rotation angle signal to perform retake. Based on the re-shot image, the corresponding boundary morphology features and depth change features are re-extracted, and the overlap of connected regions before and after the re-shot and the mean local gradient of depth change features are calculated. Based on the comparison results of the overlap of connected regions before and after the re-shot and the mean local gradient with their respective preset thresholds, the initial judgment result is selected as the final defect judgment for output, or the corresponding area is judged as a false defect and an abnormal prompt message is generated.

[0016] A complete detection chain has been constructed, from physical data acquisition, collaborative control, online calculation to defect identification and closed-loop feedback; The system uses the clamping status obtained by the clamping status sensor as the start trigger condition and the rotation angle signal output by the angle encoder as the unified time base to synchronously acquire workpiece surface temperature, optical power and phase shift image data. The two-dimensional phase-shifted image is converted into an absolute phase map reflecting the depth of the topography through phase calculation. After frequency domain filtering and temperature-based threshold adaptive adjustment, candidate connected components of defects are extracted. Finally, the final defect judgment and anomaly prompt information are output by combining an anomaly verification mechanism. This system solves the technical problem that 2D vision is unable to distinguish between real defects and background noise in the context of oxide scale interference and knurling periodic texture superposition on the surface of forgings, and realizes full-surface micro-defect recognition; The specific working process of the defect identification module is as follows: acquire the absolute phase map and surface temperature, perform a two-dimensional fast Fourier transform on the absolute phase map based on the known knurling pitch, use band-stop filtering to suppress knurling spatial frequency interference, and then perform an inverse transform to generate the filtered absolute phase map. The knurling pitch is obtained in advance through one of the following two methods: First, the knurling pitch is determined by the knurling process of the spacer bar forging to be inspected. The tooth pitch of the roller used in the knurling process rolls on the circumferential surface of the workpiece to form a periodic texture. The knurling pitch is the spatial period of the texture formed by the roller tooth pitch on the workpiece surface, which can be directly read from the knurling process drawing or roller specification parameters. Second, before the start of the inspection task, a standard sample of the same specification is calibrated and measured. A two-dimensional Fourier transform is performed on the absolute phase map obtained by solving the stripe projection image collected on the surface of the standard sample, and the spatial frequency at the peak of the dominant frequency corresponding to the knurling periodic texture in the spectrum is taken. Knurled pitch According to the formula The calculation yielded, where Knurled pitch, in millimeters. The dominant spatial frequency corresponding to the knurled texture, in line pairs per millimeter; the center frequency of the band-stop filter. Set as The bandwidth is set according to the half-width at half-maximum of the main frequency peak in the spectrum.

[0017] Among them, band-stop filtering refers to setting a specific center frequency and bandwidth in the frequency domain. For example, the center frequency is set to the reciprocal of the spatial period corresponding to the knurling pitch of 0.5 to 1.2 mm, and the frequency components generated by the periodic texture are filtered out in a targeted manner. This invention achieves effective separation of the target defect in the frequency domain features under the background of highly mixed two-dimensional textures by using frequency domain band-stop filtering to target and remove the phase oscillation generated by the knurling periodic texture. As an optional implementation, the filtered absolute phase map and surface temperature are obtained, the gradient threshold is dynamically corrected according to the surface temperature, the gradient is calculated on the filtered absolute phase map, and candidate connected components of defects are generated. In practice, the local gradient magnitude of the absolute phase is calculated to characterize the depth variation features of the workpiece surface, so as to extract the phase step features generated by cracks or fold defects. Simultaneously, the corrected gradient threshold is calculated, which is composed of the global mean plus the product of the adaptive temperature compensation coefficient and the standard deviation; wherein, the value of the adaptive temperature compensation coefficient is adaptively adjusted according to the real-time acquired surface temperature, for example, using a base coefficient of 4.5 superimposed with a linear compensation term related to the surface temperature. Set the global mean of the local gradient magnitude of the absolute phase map to be The standard deviation is Corrected gradient threshold The calculation formula is: ;

[0018] Adaptive temperature compensation coefficient The calculation formula is: ; in, The corrected gradient threshold; This represents the global mean of the local gradient magnitudes in the absolute phase map. The standard deviation of the local gradient magnitude in the absolute phase diagram; This is the adaptive temperature compensation coefficient; As a baseline coefficient, dimensionless, taken in the example ; This is the temperature sensitivity coefficient, and its dimension is [temperature]. For example, 1 / ℃ represents the weight of the effect of oxide scale growth rate on background noise; For real-time acquisition of surface temperature; The calibrated ambient reference temperature; When the temperature of the forging increases, the growth of surface oxide scale leads to an increase in roughness and phase background noise. The discrimination criterion is adaptively adjusted by linearly increasing the temperature compensation coefficient. In existing machine vision inspection, the system often directly extracts the contrast features of two-dimensional grayscale images. This processing method, which uses a single fixed feature extraction, is affected by the dynamic drift of spectral reflectance characteristics when dealing with uneven high-temperature oxide scale with a thickness of 0.02 to 0.15 mm on the surface. This embodiment is based on the three-dimensional topography measurement mechanism of fringe projection, which transforms the abrupt changes in depth caused by folds or cracks on the workpiece surface into a phase step response generated by structured light under spatial modulation. By utilizing the essential physical difference between the absolute phase discontinuity caused by the real defect in the depth direction and the phase continuity of the gradual change in oxide thickness, the dimension reduction and separation of defects and background noise are achieved. As an optional implementation method, for the anomaly review mechanism of the closed-loop feedback module, the defect judgment score obtained from the initial judgment and the re-recalculation is obtained, and the absolute value of the difference between the scores is compared according to the preset deviation threshold to determine whether the preset anomaly conditions are met. Among them, the preset abnormal condition refers to the state in which the system's detection results for the same location are seriously inconsistent, such as the absolute value of the score deviation being greater than the preset fluctuation tolerance; when this condition is met, the cause of the abnormality is identified based on the gradient response characteristics, and the boundary morphology features and depth change features that caused the abnormality are extracted. The steps for extracting boundary morphological features that trigger anomalies include: using the Canni edge detection operator to extract edges from the binarized candidate connected components, and calculating the roundness of the edge closure curves. With eccentricity The calculation formulas are as follows: ; ; in, Roundness, dimensionless; The area enclosed by the closed curve at the edge; Let be the perimeter of the closed curve at the edge; Eccentricity, dimensionless, range of values. ; Let be the semi-major axis of the smallest circumscribed ellipse; It is the minor semi-axis of the smallest circumscribed ellipse; Pi; Meanwhile, the specific logic for extracting depth change features is as follows: extract the pixel grayscale value of the connected component on the depth map, calculate the difference between the average depth of the central region and the average depth of the edge region, and use this to characterize the local gradient mean of the depth change features. Since real cracks usually exhibit a localized increase in depth, while oxide scale peeling exhibits a localized decrease in depth, the above feature extraction enables a structured description of the morphological causes. Based on the rotation angle signal, a pre-established angle-retake parameter correspondence table is retrieved for retake. The adjustment rule for the retake parameter correspondence table is: based on the initial camera exposure time. Based on this, apply exposure compensation during reshoots. When the candidate connected component of the defect is located in the high reflectivity angle range, such as when the angle between the normal vector corresponding to the rotation angle and the camera optical axis is less than 15 degrees, let... ; Based on the re-captured image, the corresponding boundary morphology features and depth variation features are re-extracted; the initial binarized connected component pixel set is extracted. With the set of binarized connected pixels of the reshot The degree of overlap is calculated using the intersection-union ratio formula. : ; in, The degree of overlap of connected components before and after the re-shoot is dimensionless and ranges from [value missing]. ; The set of pixels in the initially binarized connected component; For the set of pixels in the binarized connected component of the repeater; A function to calculate the area of ​​a set of pixels; The intersection operation represents two sets; The union operation represents the union of two sets; Furthermore, when the mean local gradient of the depth change feature is lower than the preset gradient threshold, the region is determined to be a dynamically drifting oxide scale pseudo-defect, and a corresponding verification prompt message is generated for the abnormal category. This invention captures the patterns of false defects caused by oxide scale peeling through a comprehensive evaluation of the overlap of repeated shots and the average gradient value, thus achieving effective identification and anomaly alerts for false defects caused by oxide scale peeling. Once the workpiece is clamped in place, the temperature sensor and the optical power sensor collect the surface temperature and optical power respectively. The host control module drives the turntable to step based on the clamping status and rotation angle signal through the collaborative control module, and synchronously triggers the phase-shift projection of the projection light source and the exposure of the industrial camera within the stable pause window, so as to complete the acquisition of phase-shift image data at three preset circumferential sampling angles. The newly acquired image data flows into the main memory of the control host in real time, triggering the phase calculation module to perform calculations and the gradient calculation of the defect identification module; If the detection result meets the abnormal conditions, the closed-loop feedback module will send a back command with compensation steps to the turntable control unit, drive the turntable to return to the absolute position of the angle encoder corresponding to the initial abnormality detection, and after the mechanical ringing decay period, automatically retrieve parameters to execute the abnormality review process, and finally output the final defect judgment and abnormality prompt information to the production line control terminal to complete the detection closed loop. In this embodiment, the defect assessment module is configured to: determine the weighted mapping relationship between the threshold amplitude, the regional continuity parameter and the defect judgment score based on known defect samples, wherein the weighted mapping relationship includes at least the value range and corresponding weight of each parameter; receive the parameter input of the current defect candidate connected region in the current detection task, and perform weighted calculation correction on the parameter input according to the weighted mapping relationship to generate the defect judgment score; When calculating the defect judgment score, the defect assessment module comprehensively uses the first assessment parameter, the second assessment parameter, and the third assessment parameter. The third assessment parameter is obtained by matching the phase transition curve of the current defect candidate connected domain with the pre-stored defect template formed by known defect samples. The pre-stored defect template is a phase transition reference curve stored in positional order. The defect determination score is obtained by weighting the first evaluation parameter, the second evaluation parameter, the third evaluation parameter and the corresponding preset weights. The process by which the defect assessment module generates a reshoot and recalculation instruction or a judgment result based on the score grading results is as follows: a first score threshold and a second score threshold are preset, and the first score threshold is less than the second score threshold; when the defect judgment score is less than the first score threshold, it is judged as background disturbance. When the defect judgment score is greater than or equal to the first score threshold and less than the second score threshold, it is judged as a suspicious defect, and a reshoot and recalculation instruction to change the exposure parameters is output to obtain multiple verification results. When the defect determination score is greater than or equal to the second score threshold, it is determined to be a valid defect, and the three-dimensional coordinates of the valid defect are output to the display terminal or storage module. For the multiple verification results generated after the execution of the re-shooting and recalculation command, the defect evaluation module is configured to: evaluate the stability of repeated detection at the same location, the stability of depth changes, and the continuity of edges of the multiple verification results; and perform weighted calculations based on each evaluation index and its corresponding preset weights to obtain the total stability score of each verification result. The multiple validation results are sorted according to the total stability score, and the validation result with the highest score is output as the key comparison information.

[0019] The embodiments of the present invention further disclose a specific implementation method for the defect assessment module to perform quantitative assessment and hierarchical decision-making on defect candidate connected domains; obtain various feature parameters of the current defect candidate connected domains, and perform in-depth mining and fusion calculation on the input parameters according to a predetermined weighted mapping relationship to generate a defect judgment score; The defect assessment module comprehensively extracts the first assessment parameter, the second assessment parameter, and the third assessment parameter. Among them, the first assessment parameter represents the threshold exceedance magnitude and is used to indicate the parameter that the current local gradient exceeds the dynamic correction threshold. In specific implementation, the first assessment parameter is calculated as follows: calculate the difference between the local gradient magnitude of all pixels in the defect candidate connected region and the dynamic correction threshold, and take the average value of the difference as a quantitative indicator to measure the degree of gradient exceedance. The second evaluation parameter characterizes the continuity of the connected domain, including the aspect ratio feature, which is used to represent the geometric extension law of the defect in spatial distribution. The specific calculation method is as follows: calculate the minimum bounding rectangle of the current defect candidate connected domain, obtain its principal axis length and secondary axis length, and define the ratio of the principal axis length and secondary axis length as the aspect ratio feature to provide a clear numerical metric. The third evaluation parameter characterizes the phase jump matching degree and is used to calculate the similarity between the currently captured phase step curve and the deep abrupt change reference curve of a known real defect. In practice, the third evaluation parameter is obtained by calculating the normalized cross-correlation coefficient between the phase jump curve of the current defect area and the reference curve at the corresponding position in the pre-stored defect template. The closer the cross-correlation coefficient is to 1, the higher the phase jump matching degree. This invention captures latent morphological patterns by matching the phase transition curve of the current defect region with a pre-stored defect template, thereby achieving defect confidence assessment based on multi-dimensional feature cross-validation and overcoming the defect that single features are easily interfered with. As an optional implementation, the first, second, and third evaluation parameters are obtained, and each parameter is linearly mapped according to its preset upper and lower limits to generate standard parameters normalized to the zero-to-one interval. The parameters are then weighted and summed according to preset weights to determine the final defect judgment score. The specific linear mapping normalization process adopts the minimum-maximum standardization method. To ensure the robustness of the data processing system when encountering boundary conditions such as the difference between the upper and lower limits of parameter values ​​being less than a preset threshold, the system considers the current value of the evaluation parameter to be processed. The corresponding preset lower limit and preset upper limit of value Perform denominator validation: when the preset upper limit of values ​​is reached. Compared with the preset lower limit The absolute value of the difference is less than the preset minimum machine precision value, such as At that time, the system directly outputs the standard parameters. The value is assigned to the default value of 0.5 to avoid division by zero exceptions or system overflow; when the difference is normal, the normalized standard parameter... The conversion formula is: ; If the current value If the value exceeds the upper or lower limit range, it will be truncated to the 0 or 1 range through amplitude limiting. After obtaining the normalized standard parameters, the weighted summation is calculated according to the weighted distribution predetermined by the system based on a large number of samples. For example, the weight of the first evaluation parameter is set to 0.4, the weight of the second evaluation parameter is set to 0.3, and the weight of the third evaluation parameter is set to 0.3. Based on this, the system obtains the calculated defect judgment score, and classifies the defect according to the preset first score threshold, such as 0.4, and the second score threshold, such as 0.8; when the score is less than the first score threshold, the system classifies it as background disturbance and filters it directly. When the score is between the first and second score thresholds, the system marks it as a suspicious defect and adaptively adjusts the control strategy, outputting a reshoot and recalculation instruction to change the exposure parameters in order to obtain supplementary data under different exposure conditions; when the score is greater than or equal to the second score threshold, it is determined as a valid defect and its three-dimensional coordinates are directly output. As an optional implementation, for multiple verification results generated after the execution of the re-shooting and recalculation instruction, multiple verification data of the same position are obtained. Based on the stability of repeated detection at the same position, the stability of depth change and edge continuity, the multiple verification results are comprehensively evaluated. After linearly mapping each evaluation index to the zero-to-one interval, the weighted sum is calculated to generate the total stability score of each verification result. The verification results are sorted in descending order based on the total stability score, and the verification result with the highest score is extracted as the key comparison information. This process ensures that the system can dynamically balance the reliability of multiple sampling results under dynamic lighting and parameter changes, and output judgment criteria that conform to the real morphological characteristics.

[0020] In this embodiment, when the closed-loop feedback module outputs the final defect determination, it is configured to: acquire the three-dimensional coordinates and rotation angle data of the valid defect; acquire the three-dimensional model of the spacer bar forging surface generated based on the depth map, and calculate the visibility of the defect area under the current rendering view; preset the visibility threshold, and when the visibility is lower than the visibility threshold, adjust the rendering label of the defect area and generate a circumferential two-dimensional unfolded map of the corresponding view; when the visibility is greater than or equal to the visibility threshold, output the defect annotation result under the current view.

[0021] Embodiments of the present invention disclose a visualization and spatial mapping mechanism for the closed-loop feedback module when outputting the final defect determination result; Obtain the 3D coordinates and rotation angle data of the defects that are determined to be valid. Based on the 3D model of the spacer bar forging surface reconstructed from the depth map, calculate the visibility of the defect area under the current rendering view and determine the visualization output strategy. Visibility refers to the effective pixel ratio of the defect area on the current 3D rendering projection surface. For example, defects at the junction of the inner ring surface or mortise and tenon structure may be occluded from the external viewpoint, resulting in reduced visibility. Obtain the calculated visibility and adaptively adjust the presentation of the defect area based on a preset visibility threshold, such as 30%. When the visibility is below the visibility threshold, the system determines that the defect is in the optical blind spot or occlusion area of ​​the current viewpoint, adjusts the rendering label of the defect area, such as using perspective highlighting or leader line annotation, and forces the generation of a circumferential two-dimensional unfolded diagram of the corresponding viewpoint to display the curved surface defect in a flat manner. In practice, the mapping logic for generating the corresponding circumferential two-dimensional unfolded diagram is as follows: taking the workpiece's central axis as a reference. Establish a cylindrical coordinate system using axes, and assign three-dimensional rectangular coordinates to each vertex in the corresponding defect region on the surface 3D model. , , Convert to cylindrical coordinates , , Where the radius r is the distance from the vertex to the central axis, and the circumferential angle is... coordinates and The arctangent function value of the ratio; The horizontal axis of the two-dimensional unfolding plane is defined as the circumferential arc length; to ensure the continuity of the spatial topology of the defect region during the 3D-to-2D dimensionality reduction unfolding process, and to avoid local radius issues caused by the defect itself. The sudden change causes spatial tearing and physical misalignment of adjacent pixels at the same circumferential angle but different depths in the unfolded image on the horizontal axis. The system extracts the nominal design outer diameter of the corresponding region of the current workpiece or the average reference radius of the periphery of that region as a unified mapping reference radius. The horizontal axis value of the two-dimensional unfolded plane is set as the mapping reference radius. With angle The product, with the vertical axis maintaining the axial coordinate. constant; For situations where spatial occlusion or non-convex topology leads to the same cylindrical coordinates Multiple different radii appear at the location In the region of values, the system pre-executes a ray projection algorithm along the normal of the reference plane, extracting only the spatial coordinate data of the first intersecting vertex to participate in the two-dimensional unfolding projection, so as to eliminate feature aliasing caused by multi-value overlap; By using the established projection mapping rule based on a unified reference cylinder to a plane, defects in spatially occluded areas are unfolded into two-dimensional images with three-dimensional depth and topography information; when the visibility is greater than or equal to the visibility threshold, the three-dimensional defect annotation results under the current viewpoint are directly output. This invention captures the spatial occlusion patterns at the interface of complex circular frames and mortise and tenon structures by using three-dimensional coordinate mapping and visibility calculation. This overcomes the problem of blind spots in visualization caused by complex structures and enables adaptive unfolding and perspective annotation of internal defects.

[0022] For any part not mentioned in this invention, existing technologies can be used or referenced. Of course, the above description is not a limitation of this invention, and this invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of this invention should also be within the protection scope of this invention.

Claims

1. A machine vision-based surface defect recognition system for spacer bar forgings, applied to spacer bar forgings to be inspected, characterized in that, It includes a turntable, clamping mechanism, projection light source, industrial camera, temperature sensor, optical power sensor, clamping status sensor, angle encoder, and control host. The control host includes: The data acquisition module is connected to the industrial camera, the temperature sensor, the optical power sensor, the clamping status sensor and the angle encoder to acquire surface temperature, optical power, clamping status, rotation angle signals and phase shift image data at three preset circumferential sampling angles; The collaborative control module connects the turntable, projection light source and industrial camera. Based on the clamping status and rotation angle signal, it generates turntable stepping, light source driving and camera exposure commands, triggering the industrial camera to complete image acquisition at three preset circumferential sampling angles. The phase resolution module performs multi-step phase shift calculations and absolute phase unfolding on the phase-shifted image data to generate an absolute phase map, and converts it into a depth map according to the phase-depth mapping relationship calibrated by the system. The defect identification module performs frequency domain filtering, phase gradient calculation, and threshold correction based on surface temperature on the absolute phase map to extract candidate connected components of defects. The defect assessment module calculates the initial defect assessment score for candidate connected components based on preset scoring rules and grading thresholds, and generates re-shooting and recalculation instructions or assessment results. The closed-loop feedback module receives the judgment result, surface temperature, and optical power. When the judgment result meets the preset abnormal conditions, it executes the abnormal review process and outputs the final defect judgment and abnormal prompt information.

2. The machine vision-based surface defect identification system for spacer bar forging according to claim 1, characterized in that, The defect identification module is configured as follows: Obtain the absolute phase map and the surface temperature; The absolute phase diagram is subjected to frequency domain band-stop filtering to obtain the filtered absolute phase diagram; The gradient of the filtered absolute phase map is calculated, and the gradient threshold is corrected according to the surface temperature. The local gradient magnitude of the filtered absolute phase map is extracted, and the set of pixels whose local gradient magnitude is greater than or equal to the corrected gradient threshold is binarized and marked according to the preset connected component determination rules to obtain the defect candidate connected component.

3. The machine vision-based surface defect identification system for spacer bar forging according to claim 1, characterized in that, The preset abnormal condition is: the absolute value of the difference between the defect judgment score obtained by re-shooting and recalculating and the defect judgment score of the initial judgment exceeds the preset deviation threshold. The closed-loop feedback module is configured to: after the preset abnormal condition is met. Extract the boundary morphology features and depth variation features of the current defect candidate connected components; Based on the rotation angle signal, a pre-established angle-retake parameter correspondence table is retrieved for retake. Based on the re-shot image, the corresponding boundary morphology features and depth change features are re-extracted, and the overlap of connected components before and after the re-shot and the mean local gradient of the depth change features are calculated. Based on the overlap of the connected components before and after the reshoot and the comparison results of the mean local gradient with their respective preset thresholds, the initial judgment result is selected as the final defect judgment for output, or the corresponding area is judged as a pseudo-defect and an abnormal prompt message is generated.

4. The machine vision-based surface defect identification system for spacer bar forging according to claim 1, characterized in that, The defect assessment module is configured as follows: Based on known defect samples, a weighted mapping relationship is determined between the threshold amplitude, the regional continuity parameter, and the defect judgment score. The weighted mapping relationship includes at least the value range of each parameter and its corresponding weight. In the current detection task, the parameter input of the current defect candidate connected domain is received, and the parameter input is weighted and corrected according to the weighted mapping relationship to generate the defect judgment score.

5. A machine vision-based surface defect identification system for spacer bar forging according to claim 4, characterized in that, When calculating the defect determination score, the defect evaluation module comprehensively uses the first evaluation parameter, the second evaluation parameter, and the third evaluation parameter. The third evaluation parameter is obtained by matching the phase transition curve of the current defect candidate connected domain with a pre-stored defect template formed by known defect samples. The pre-stored defect template is a phase transition reference curve stored in positional order. The defect determination score is obtained by weighting the first evaluation parameter, the second evaluation parameter, the third evaluation parameter and the corresponding preset weight.

6. A machine vision-based surface defect identification system for spacer bar forging according to claim 5, characterized in that, The process by which the defect assessment module generates a reshoot and recalculation instruction or a judgment result based on the score grading results is as follows: A first score threshold and a second score threshold are preset, and the first score threshold is less than the second score threshold; When the defect determination score is less than the first score threshold, it is determined to be a background disturbance; When the defect determination score is greater than or equal to the first score threshold and less than the second score threshold, it is determined to be a suspicious defect, and a reshoot and recalculation instruction to change the exposure parameters is output to obtain multiple verification results; When the defect determination score is greater than or equal to the second score threshold, it is determined to be a valid defect, and the three-dimensional coordinates of the valid defect are output to the display terminal or storage module.

7. A machine vision-based surface defect identification system for spacer bar forging according to claim 6, characterized in that, For the multiple verification results generated after the execution of the re-shooting and recalculation instruction, the defect assessment module is configured as follows: The stability of repeated detection at the same location, the stability of depth variation, and the edge continuity of the multiple verification results are evaluated. The stability score of each verification result is obtained by weighting the various evaluation indicators and their corresponding preset weights. The multiple verification results are sorted according to the total stability score, and the verification result with the highest score is output as key comparison information.

8. A machine vision-based surface defect identification system for spacer bar forging according to claim 6, characterized in that, When the closed-loop feedback module outputs the final defect determination, it is configured as follows: Obtain the three-dimensional coordinates and rotation angle data of the effective defect; Obtain a 3D model of the surface of the spacer bar forging generated based on the depth map, and calculate the visibility of the defect area under the current rendering view. A preset visibility threshold is set. When the visibility is lower than the visibility threshold, the rendering identifier of the defect area is adjusted, and a circumferential two-dimensional unfolded map of the corresponding viewpoint is generated. When the visibility is greater than or equal to the visibility threshold, the defect annotation result under the current viewpoint is output.