Wire harness terminal appearance detection method and system based on industrial vision
By improving the adaptive active contour model and adjusting the time step by combining texture and curvature information, the problem of insufficient detection efficiency and accuracy in traditional methods is solved, and efficient and reliable detection of wire harness terminals is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGGUAN CITY JIEXIN ELECTROMECHANICAL EQUIP CO LTD
- Filing Date
- 2026-02-04
- Publication Date
- 2026-05-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional wire harness terminal detection methods based on active contour models have slow convergence speeds in areas with smooth textures or simple structures, and are prone to missed or false detections in areas with abrupt changes in local curvature or small defects, making it difficult to meet the industrial production requirements for high-precision, high-speed, and continuous detection.
An improved active contour model based on region scalable fitting is adopted. By adaptively adjusting the time step, and combining texture directionality, local curvature change and gradient information as potential energy guiding factors, fine extraction and defect identification of wire harness terminals are achieved. This includes the positive correlation between time step and potential energy guiding factor, and the inverse correlation between curvature jump factor and texture oscillation degree.
It significantly improves the sensitivity and detection accuracy of appearance defects such as minor indentations, wrinkles, burrs and local deformations, while taking into account overall processing efficiency and robustness, and realizes high-speed, stable and reliable automatic inspection of wire harness terminals.
Smart Images

Figure CN122048902A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing technology. More specifically, this invention relates to a method and system for inspecting the appearance of wire harness terminals based on industrial vision. Background Technology
[0002] In modern automotive, electrical equipment, and aerospace industries, wire harness terminals are a crucial component of electrical connection systems, and their appearance quality directly impacts electrical contact performance, signal transmission stability, and system safety. With the development of production automation and intelligent manufacturing, the requirements for wire harness terminal appearance inspection are increasingly stringent. Not only must the inspection results be accurate and reliable, but the inspection process must also be adaptable to the pace of high-speed production lines. Traditional manual inspection methods suffer from drawbacks such as high subjectivity, low efficiency, poor repeatability, and susceptibility to environmental factors, making it difficult to meet the demands of industrial production for high-precision, high-speed, and continuous inspection. Therefore, automated inspection methods based on industrial vision have become a hot research and application area. By deploying high-resolution industrial cameras to acquire surface images of wire harness terminals and combining image preprocessing, contour extraction, and defect recognition technologies, automatic judgment and quality control of terminal appearance defects can be achieved, providing stable and efficient online inspection capabilities for production lines.
[0003] In existing technologies, active contour model algorithms with scalable region fitting are applied in industrial vision scenarios to accurately extract the contours of wire harness terminals. This algorithm iteratively evolves the contour, gradually converging it to the edge position of the target terminal, thereby obtaining fine structural information for defect identification.
[0004] While active contour models offer significant advantages in contour fitting accuracy, traditional methods in real-world industrial inspection environments typically employ a fixed time step for contour evolution. This fixed step size, applied to regions with smooth textures or simple structures, can lead to slow contour convergence, requiring numerous iterations to reach a stable state, thus impacting overall inspection efficiency. Furthermore, in regions with abrupt changes in curvature or minute defects, a fixed step size can cause the contour to cross the true boundary or oscillate, making it difficult to accurately detect small defects such as indentations, wrinkles, or burrs, resulting in missed or false detections. Summary of the Invention
[0005] To address the problems of missed detections or false detections mentioned in the background art, the present invention provides solutions in the following aspects.
[0006] In a first aspect, the present invention provides a method for appearance inspection of wire harness terminals based on industrial vision, comprising: acquiring a surface image of a wire harness terminal to be inspected, and dividing the surface image of the wire harness terminal to be inspected into multiple target images; performing edge detection on the multiple target images using an improved active contour model algorithm based on region scalable fitting to obtain multiple edge contours; and determining that the surface image of the wire harness terminal to be inspected has an appearance defect in response to the morphological parameters of the edge contours not meeting a preset condition; wherein the improved active contour model algorithm based on region scalable fitting includes a time step, the time step being... The potential energy guidance factor of the initial value and the target image is positively correlated; the potential energy guidance factor is positively correlated with the curvature jump factor; the curvature jump factor is positively correlated with the absolute value of the difference between the texture oscillation degree and the mean curvature value of all pixels in the target image, and negatively correlated with the maximum value of the gradient amplitude of all pixels in the target image; the texture oscillation degree is negatively correlated with the mean value of the autocorrelation coefficient of the gray value sequence formed by all pixels in the target image along the stamping direction, and positively correlated with the gradient amplitude of each pixel in the target image along the perpendicular direction of the stamping direction, wherein the target image is any one of the multiple target images.
[0007] The above technical solution divides the surface image of the wire harness terminal into multiple target regions and combines them with an improved adaptive active contour model to achieve fine extraction of local contours. At the same time, through multi-level feature coupling, texture directionality, local curvature changes and gradient intensity are transformed into potential energy guiding factors, and the contour evolution step size is adaptively adjusted so that the contour converges quickly in the stable region and fits finely in the defect or curvature change region. This significantly improves the sensitivity and detection accuracy of appearance defects such as small indentations, wrinkles, burrs and local deformations, while taking into account the overall processing efficiency and robustness, and realizes high-speed, stable and reliable automatic inspection of wire harness terminal appearance.
[0008] Furthermore, the time step for: , As the initial value, For target image Potential energy orientation factor.
[0009] The above technical solution adaptively couples the potential energy guiding feature with the time step of the active contour model, so that the contour adopts a larger step size in areas with stable surfaces and inconspicuous defects to accelerate the convergence speed, while automatically reducing the step size in areas with abrupt curvature changes or obvious defects to ensure evolution stability. This significantly enhances the fitting accuracy and reliability for small defects and complex boundaries while improving the overall processing efficiency.
[0010] Furthermore, the target image Potential energy guiding factor for: , For the natural constant An exponential function with base 0. For target image The curvature jump factor.
[0011] The above technical solution maps curvature jump features into normalized potential energy guidance quantities, so that the surface stable region corresponds to low potential energy and the defect or curvature abrupt region corresponds to high potential energy, thereby achieving sensitive amplification of small defects and local anomalies, while smoothing extreme numerical changes, improving the continuity and distinguishability of defect response, and providing a stable and reliable quantitative basis for subsequent contour evolution or judgment.
[0012] Furthermore, the target image curvature jump factor for: , For target image Texture oscillation, For the natural constant Logarithmic function with base 0. For target image Inner pixel curvature, For target image The average curvature of all pixels within the area. For target image Inner pixel gradient magnitude, For target image The maximum value of the gradient magnitude of all pixels within the range. For target image The total number of pixels within the unit.
[0013] The above technical solution combines texture oscillation features with pixel-level curvature deviation and gradient intensity to quantify local geometric changes on the surface of the target image. This allows curvature anomalies caused by defects such as indentations, wrinkles, collapses, or local deformations to be effectively amplified. At the same time, it takes into account both overall texture stability and local gradient weights, thereby improving the sensitivity and detection reliability of small or local defects while suppressing the influence of noise.
[0014] Furthermore, the target image Texture oscillation for: , For target image The mean value of the autocorrelation coefficient of the grayscale value sequence formed by all pixels along the stamping direction. For target image The total number of pixels in the inner area. For target image Inner pixel Gradient magnitude along the stamping direction, For target image Inner pixel Gradient magnitude along the direction perpendicular to the stamping direction, These are the preset hyperparameters.
[0015] The above technical solution effectively quantifies the directional undulations and local fluctuations of the surface texture of the target image by combining the autocorrelation characteristics of the gray-level sequence of the image along the stamping direction with pixel-level gradient information. This allows the texture disorder caused by processing abnormalities such as indentations, burrs, scratches, or vibration marks to be sensitively captured. At the same time, it highlights the real defect area while suppressing noise and illumination interference, thereby significantly improving the accuracy and reliability of surface defect detection.
[0016] Furthermore, an image of the surface of the terminal of the wire harness to be inspected is acquired using a CCD camera or a CMOS camera.
[0017] Furthermore, it also includes denoising and grayscale processing of the surface image of the terminal of the wire harness to be tested.
[0018] Furthermore, the Canny edge detection algorithm is used to perform edge detection on the multiple target images.
[0019] Furthermore, the morphological parameters include area and aspect ratio.
[0020] In a second aspect, the present invention provides a wire harness terminal appearance inspection system based on industrial vision, including a memory and a processor. The memory stores computer program instructions, which, when executed by the processor, implement the wire harness terminal appearance inspection method based on industrial vision described above.
[0021] The beneficial effects of this invention are as follows: This invention divides the surface image of a wire harness terminal into multiple target images and combines an improved adaptive active contour model with multi-level feature analysis. It integrates texture directionality, local curvature changes, and gradient information into a potential energy guiding factor to adaptively adjust the contour evolution step size. This enables the contour to converge rapidly in stable regions and fit precisely in defective or curvature abrupt regions. Simultaneously, it is supplemented by denoising, grayscale processing, and morphological parameter determination, enabling the system to efficiently and stably identify minor indentations, wrinkles, burrs, and local deformations on the terminal surface. This significantly improves detection accuracy, robustness, and reliability for industrial applications. Attached Figure Description
[0022] Figure 1 This is a flowchart schematically illustrating a wire harness terminal appearance inspection method based on industrial vision according to an embodiment of the present invention; Figure 2 This is a schematic illustration of a grayscale image of a wire harness terminal surface according to an embodiment of the present invention; Figure 3 This is a schematic illustration of a heat map of the potential energy orientation factor according to an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the detection results of a wire harness terminal appearance inspection method based on industrial vision according to an embodiment of the present invention; Figure 5 This is a schematic block diagram illustrating the structure of a wire harness terminal appearance inspection system based on industrial vision according to an embodiment of the present invention. Detailed Implementation
[0023] An example of an industrial vision-based method for inspecting the appearance of wire harness terminals.
[0024] like Figure 1 The flowchart shown is a method for inspecting the appearance of wire harness terminals based on industrial vision according to an embodiment of the present invention, which includes the following steps: S1: Acquire the surface image of the terminal of the wire harness to be tested, and divide the surface image of the terminal of the wire harness to be tested into multiple target images.
[0025] In a preferred embodiment, an industrial camera arranged on an automated inspection station is used to acquire an image of the surface of the wire harness terminal to be inspected. The industrial camera is preferably a high-resolution CCD camera or a CMOS camera.
[0026] Furthermore, after obtaining the original image of the surface of the wire harness terminal to be inspected, the image is denoised. The denoising process can employ one or more combinations of median filtering, Gaussian filtering, or adaptive bilateral filtering. Median filtering effectively suppresses salt-and-pepper noise in the image, Gaussian filtering smooths random noise distribution, while adaptive bilateral filtering suppresses noise while preserving edge details of the wire harness terminal. By introducing an adaptive filtering parameter adjustment mechanism based on local grayscale variation characteristics of the image, the filtering intensity can be dynamically adjusted according to the texture complexity of different regions on the terminal surface, thereby minimizing noise interference while maximizing the preservation of structural information and defect features of the terminal surface.
[0027] After denoising, the surface image of the wire harness terminal to be inspected is further converted to grayscale. This grayscale conversion can be based on a weighted average method, a brightness preservation method, or a perceptual consistency model, mapping the color image to a single-channel grayscale image. By rationally designing the weight coefficients of each color channel, the grayscale image can more realistically reflect the material properties and illumination distribution of the wire harness terminal surface, thereby enhancing the grayscale contrast between different structural regions. Grayscale conversion not only reduces the computational complexity of subsequent image analysis but also reduces the interference of color information redundancy on the defect identification algorithm, which is beneficial to improving the stability and real-time performance of the detection algorithm.
[0028] like Figure 2 The image shown is a grayscale image of the surface of the wire harness terminal in an embodiment of the present invention.
[0029] S2: The improved active contour model algorithm based on region scalable fitting is used to perform edge detection on the multiple target images to obtain multiple edge contours.
[0030] In a preferred embodiment, the improved active contour model algorithm based on region-scalable fitting includes a time step, the time step being... for: , As the initial value, For target image Potential energy orientation factor.
[0031] By introducing a potential energy guidance factor to dynamically adjust the time step, the contour adopts a relatively large advancement step in regions with low potential energy and gentle structural changes, thereby accelerating curve convergence and reducing invalid iterations. Conversely, in regions with high potential energy, abrupt curvature changes, and significant defect features, the time advancement step is automatically reduced, making the contour evolution process smoother and more detailed, avoiding crossing the true boundary or oscillations due to excessively large step sizes. This effectively overcomes the problem of balancing convergence speed and boundary accuracy caused by fixed time steps in traditional active contour models. The model can flexibly adjust its evolution strategy according to the local complexity of the image content, significantly improving the fitting accuracy for small defect boundaries and complex geometric shapes while ensuring numerical stability, thus achieving more reliable and refined target contour extraction results.
[0032] target image Potential energy guiding factor for: , For the natural constant An exponential function with base 0. For target image The curvature jump factor.
[0033] like Figure 3The figure shows a heatmap of the potential energy guidance factor in an embodiment of the present invention.
[0034] By employing a nonlinear compression form similar to a potential energy function, the output automatically converges to the low potential energy range when the surface geometry and texture changes are in a stable state. However, when the curvature changes significantly and the defect characteristics gradually increase, the output value transitions to the high potential energy range in a smooth but rapid manner. This effectively avoids the scale inconsistency and extreme value sensitivity problems caused by directly using the original mutation metric. At the same time, it enhances the separability between different anomaly levels, making weak defects, medium defects, and severe defects exhibit a continuous and monotonic response relationship in a unified potential energy space.
[0035] target image curvature jump factor for: , For target image Texture oscillation, For the natural constant Logarithmic function with base 0. For target image Inner pixel curvature, For target image The average curvature of all pixels within the area. For target image Inner pixel gradient magnitude, For target image The maximum value of the gradient magnitude of all pixels within the range. For target image The total number of pixels within the unit.
[0036] Using texture oscillation as a priori weight, this method couples and models it with non-stationary changes in surface geometry. First, by accumulating statistics on the deviation between pixel-level curvature and the overall average curvature, it characterizes the abrupt changes in local geometry relative to the overall surface in the target image, effectively amplifying the surface discontinuities caused by defects such as indentations, wrinkles, tears, or local collapses. Simultaneously, a gradient-intensity-based normalization weighting mechanism is introduced, allowing curvature deviations to receive higher responses in areas with significant structural changes, while automatically reducing their impact in areas with smooth textures or insufficient information, thus avoiding interference from random noise or weak texture areas. Based on this, a logarithmic mapping is applied to the accumulated results, making the response of curvature anomalies exhibit non-linear growth characteristics with the amplitude of change, suppressing numerical instability caused by extreme values and enhancing the distinguishability of anomalies of moderate amplitude. Finally, this geometric abrupt change metric is fused with the texture oscillation, which can highlight the real processing defects corresponding to local curvature abrupt changes while maintaining sensitivity to the overall surface texture consistency. This significantly improves the detection stability and discrimination reliability of stamping or pressing defects under complex lighting and multi-texture backgrounds.
[0037] target image Texture oscillation for: , For target image The mean value of the autocorrelation coefficient of the grayscale value sequence formed by all pixels along the stamping direction. For target image The total number of pixels in the inner area. For target image Inner pixel Gradient magnitude along the stamping direction, For target image Inner pixel Gradient magnitude along the direction perpendicular to the stamping direction, These are the preset hyperparameters.
[0038] Starting from the physical causes of stamping processes, this paper unifies the modeling of the directional changes in surface texture of wire harness terminals or stamped components with the statistical characteristics of image grayscale. On the one hand, by performing autocorrelation analysis on the grayscale sequence along the stamping direction in the image and taking the average of its overall level, the periodicity and consistency of texture in the main processing direction are macroscopically characterized. When the consistency decreases, it can reflect the texture disorder caused by anomalies such as burrs, scratches, or vibration marks. On the other hand, pixel-level gradient information is introduced to compare and normalize the gradient changes along the stamping direction with the gradient changes in the vertical direction. From a microscopic level, it highlights the regional characteristics of strong texture undulations and insufficient lateral support in the processing direction, and avoids instability caused by extreme gradient ratios through a smoothing term. By fusing the above global correlation constraints with local directional gradient features, the influence of noise and illumination fluctuations can be effectively suppressed while significantly amplifying the texture oscillation features caused by stamping anomalies. This makes it possible to clearly distinguish between normally processed surfaces and surfaces with defects such as indentations, tears, or poor crimping at the numerical level.
[0039] Edge detection was performed on the multiple target images using the Canny edge detection algorithm.
[0040] S3: In response to the fact that the morphological parameters of the edge contour do not meet the preset conditions, it is determined that there is an appearance defect in the surface image of the wire harness terminal to be inspected.
[0041] like Figure 4 The diagram shown illustrates the detection results of the wire harness terminal appearance inspection method based on industrial vision, according to an embodiment of the present invention.
[0042] In a preferred embodiment, the morphological parameters include at least the area parameter and aspect ratio parameter of the contour region. The area parameter characterizes the actual projected size of the key structure of the wire harness terminal in the image plane. By statistically counting the number of pixels in the area enclosed by the edge contour and normalizing it in conjunction with the imaging resolution, it can effectively reflect whether there are problems such as material loss, local collapse, excessive deformation, or foreign matter adhesion during the stamping, pressing, or assembly process of the terminal. When a contour area is detected to be significantly smaller or larger than the standard template or historical normal samples, appearance abnormalities caused by breakage, missing corners, material accumulation, or expansion can be identified in a timely manner, thereby improving the comprehensiveness of defect detection.
[0043] The aspect ratio parameter is used to characterize the proportional relationship of the wire harness terminal's outer contour. It can sensitively reflect the morphological changes of the terminal during processing or assembly, such as stretching, flattening, or bending caused by uneven force, mold wear, or assembly misalignment. By comparing the actual measured aspect ratio with a preset reasonable range, it is possible to effectively distinguish between terminals with normal structure but slight dimensional fluctuations and terminals with obvious deformation defects, thereby avoiding the risk of misjudgment caused by relying on a single dimensional parameter.
[0044] Furthermore, the preset conditions can be adaptively set according to different types of wire harness terminals, different processing techniques, or different application scenarios. For example, the distribution range of area and aspect ratio can be obtained based on historical qualified sample statistics, and a dynamic threshold model can be constructed in conjunction with a safety margin. This ensures that the morphological judgment standard has both engineering robustness and can adapt to the unavoidable minor fluctuations in actual production processes. In this way, the false detection rate caused by normal process fluctuations can be effectively reduced while ensuring detection sensitivity.
[0045] The present invention divides the surface image of the wire harness terminal into multiple target regions and combines an improved adaptive active contour model with multi-level texture, curvature, and gradient features to achieve fine extraction of the terminal contour and sensitive capture of local defects. At the same time, by adaptively adjusting the contour evolution step size through a potential energy guiding factor, it converges rapidly in stable regions and fits finely in defective regions, enabling accurate identification of appearance anomalies such as minor indentations, wrinkles, burrs, and local deformations. Combined with edge detection, denoising grayscale processing, and morphological parameter determination, it not only improves the accuracy and robustness of defect detection but also ensures processing efficiency and stability in industrial applications. Thus, it realizes high-speed, reliable, and automated appearance inspection of wire harness terminals that can be applied in automated production lines.
[0046] Example of an industrial vision-based wire harness terminal appearance inspection system: like Figure 5 As shown in the figure, the structural block diagram of the wire harness terminal appearance inspection system based on industrial vision according to an embodiment of the present invention includes a processor and a memory.
[0047] This invention also provides a wire harness terminal appearance inspection system based on industrial vision. For example... Figure 5 As shown, the system includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement the above-described industrial vision-based wire harness terminal appearance inspection method according to the present invention.
[0048] The industrial vision-based wire harness terminal appearance inspection system also includes other components well known to those skilled in the art, such as communication interfaces. Their settings and functions are known in the art and will not be described in detail here.
[0049] In this invention, the aforementioned memory can be any tangible medium containing or storing a program that can be used or combined with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc., or any other medium that can be used to store desired information and can be accessed by an application, module, or both. Any such computer storage medium can be part of a device or accessible to or connected to a device. Any application or module described in this invention can be implemented using computer-readable / executable instructions stored or otherwise maintained by such a computer-readable medium.
[0050] In the description of this specification, "multiple" or "several" means at least two, such as two, three or more, unless otherwise explicitly specified.
[0051] While this specification has shown and described numerous embodiments of the invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention. It should be understood that various alternatives to the embodiments of the invention described herein may be employed in the practice of this invention.
Claims
1. A method for inspecting the appearance of wire harness terminals based on industrial vision, characterized in that, include: Acquire an image of the surface of the terminal of the wire harness to be inspected, and divide the image of the surface of the terminal of the wire harness to be inspected into multiple target images; An improved active contour model algorithm based on region scalable fitting is used to perform edge detection on the multiple target images to obtain multiple edge contours; in response to the morphological parameters of the edge contours not meeting the preset conditions, it is determined that there are appearance defects in the surface image of the wire harness terminal to be detected. Among them, the improved active contour model algorithm based on region scalable fitting includes a time step, which is positively correlated with the initial value and the potential energy guidance factor of the target image. The potential energy guiding factor is positively correlated with the curvature jump factor; the curvature jump factor is positively correlated with the absolute value of the difference between the texture oscillation degree and the mean curvature value of all pixels in the target image, and negatively correlated with the maximum value of the gradient amplitude of all pixels in the target image; the texture oscillation degree is negatively correlated with the mean value of the autocorrelation coefficient of the gray value sequence formed by all pixels in the target image along the stamping direction, and positively correlated with the gradient amplitude of each pixel in the target image along the perpendicular to the stamping direction, wherein the target image is any one of the multiple target images.
2. The method for inspecting the appearance of wire harness terminals based on industrial vision according to claim 1, characterized in that, The time step for: , As the initial value, For target image Potential energy orientation factor.
3. The method for inspecting the appearance of wire harness terminals based on industrial vision according to claim 1, characterized in that, target image Potential energy guiding factor for: , For the natural constant An exponential function with base 0. For target image The curvature jump factor.
4. The method for inspecting the appearance of wire harness terminals based on industrial vision according to claim 1, characterized in that, target image curvature jump factor for: , For target image Texture oscillation, For the natural constant Logarithmic function with base 0. For target image Inner pixel curvature, For target image The average curvature of all pixels within the area. For target image Inner pixel gradient magnitude, For target image The maximum value of the gradient magnitude of all pixels within the range. For target image The total number of pixels within the unit.
5. The method for inspecting the appearance of wire harness terminals based on industrial vision according to claim 1, characterized in that, target image Texture oscillation for: , For target image The mean value of the autocorrelation coefficient of the grayscale value sequence formed by all pixels along the stamping direction. For target image The total number of pixels in the inner area. For target image Inner pixel Gradient magnitude along the stamping direction, For target image Inner pixel Gradient magnitude along the direction perpendicular to the stamping direction, These are the preset hyperparameters.
6. The method for inspecting the appearance of wire harness terminals based on industrial vision according to claim 1, characterized in that, Use a CCD or CMOS camera to acquire images of the surface of the terminals of the wire harness to be inspected.
7. The method for inspecting the appearance of wire harness terminals based on industrial vision according to claim 1, characterized in that, It also includes denoising and grayscale processing of the surface image of the terminal of the wire harness to be tested.
8. The method for appearance inspection of wire harness terminals based on industrial vision according to claim 1, characterized in that, Edge detection was performed on the multiple target images using the Canny edge detection algorithm.
9. The method for inspecting the appearance of wire harness terminals based on industrial vision according to claim 1, characterized in that, The morphological parameters include area and aspect ratio.
10. A wire harness terminal appearance inspection system based on industrial vision, characterized in that, It includes a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for inspecting the appearance of wire harness terminals based on industrial vision as described in any one of claims 1 to 9 is implemented.