Method and system for synchronous detection of harness assembly defects based on high-speed machine vision

By employing a synchronous detection method for wire harness assembly defects based on high-speed machine vision, and utilizing image acquisition, processing, and deep learning technologies, the problems of low efficiency and unstable accuracy in wire harness assembly defect detection are solved, achieving efficient and accurate defect detection.

CN121805277BActive Publication Date: 2026-07-07DINGLI AUTOMATIC TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DINGLI AUTOMATIC TECH CO LTD
Filing Date
2026-03-06
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing technologies for detecting defects in wire harness assembly suffer from low detection efficiency, high false negative rate, and poor adaptability. In particular, the detection accuracy is unstable under high-speed production cycles and complex backgrounds, failing to meet the real-time requirements of wire harness production lines and the synchronous identification of assembly defect types.

Method used

A synchronous detection method for wire harness assembly defects based on high-speed machine vision is adopted. By receiving defect detection instructions, the wire harness image acquisition unit, image processing unit, and defect detection unit are used, combined with deep learning methods to extract and analyze features of the wire harness image, so as to achieve accurate detection of wire harness assembly defects.

Benefits of technology

It enables efficient and accurate detection of wire harness assembly defects, improves the accuracy and adaptability of detection, and ensures wire harness quality and production efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121805277B_ABST
    Figure CN121805277B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of defect detection, and relates to a wire harness assembly defect synchronous detection method and system based on high-speed machine vision.The method comprises the following steps: receiving a defect detection instruction, confirming a defect detection environment based on the defect detection instruction; receiving an image acquisition instruction from a wire harness image acquisition unit, performing image acquisition on the wire harness based on the image acquisition instruction, and obtaining an initial wire harness image set; receiving an image processing instruction from a wire harness image processing unit, performing pretreatment on the initial wire harness image set based on the image processing instruction, and obtaining a target wire harness image set; receiving a defect analysis instruction from a wire harness defect detection unit, performing feature extraction on the target wire harness image set based on the defect analysis instruction, and obtaining an image feature set group; analyzing the image feature set group by using a deep learning method, and obtaining a wire harness detection result set; and realizing synchronous detection of wire harness assembly defects based on the wire harness detection result set.The application can realize accurate detection of wire harness assembly defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of defect detection technology, and in particular to a method and system for synchronous detection of defects in wire harness assembly based on high-speed machine vision. Background Technology

[0002] With the rapid development of modern manufacturing, wire harnesses, as key connection components in electrical equipment, are widely used in the automotive, electronics, and aerospace industries. The accuracy and reliability of wire harness assembly directly affect the overall performance and safety of the wire harness. Conversely, efficiently and accurately detecting various defects during the wire harness assembly process is crucial for ensuring wire harness quality and production efficiency.

[0003] Currently, assembly defect detection in wire harnesses mainly relies on manual visual inspection or traditional image processing methods. While these methods can identify some defects to a certain extent, they suffer from low detection efficiency, high false negative rates, and poor adaptability when faced with high-speed production cycles, complex backgrounds, and multiple defect types. Furthermore, they do not fully consider the real-time requirements of wire harness production lines and the need for simultaneous identification of assembly defect types, leading to unstable detection accuracy and limited production efficiency. Therefore, achieving high-speed, high-precision simultaneous detection of assembly defects in wire harnesses has become an urgent problem to be solved. Summary of the Invention

[0004] This invention provides a method for synchronous detection of wire harness assembly defects based on high-speed machine vision and a computer-readable storage medium, the main purpose of which is to achieve accurate detection of wire harness assembly defects.

[0005] To achieve the above objectives, the present invention provides a method for synchronous detection of wire harness assembly defects based on high-speed machine vision, comprising:

[0006] Receive a defect detection command, and confirm the defect detection environment based on the defect detection command. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit.

[0007] Receive an image acquisition command from the wire harness image acquisition unit, and acquire images of the wire harness based on the image acquisition command to obtain an initial wire harness image set;

[0008] Receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set;

[0009] Receive a defect analysis instruction from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instruction to obtain an image feature set group;

[0010] The image feature set is analyzed using a pre-built deep learning method to obtain a wire bundle detection result set. The wire bundle detection result set includes multiple wire bundle detection results, each of which corresponds one-to-one with the target wire bundle image. The wire bundle detection result indicates whether there is a defect or no defect.

[0011] Synchronous detection of wire harness assembly defects is achieved based on the wire harness inspection result set.

[0012] Optionally, the step of acquiring images of the wire harness based on the image acquisition command to obtain an initial wire harness image set includes:

[0013] The wire harness production line is obtained. A planar coordinate system is established in the wire harness production line with the preset acquisition position as the origin. The wire harness is monitored using a pre-built position sensor and the planar coordinate system to obtain the position of the wire harness.

[0014] The distance difference is obtained based on the acquisition position and the wire harness position. When the distance difference is equal to the preset distance threshold, the high-speed industrial camera is identified based on the image acquisition command. When the distance difference is 0, the wire harness position corresponding to the distance difference is taken as the target wire harness position.

[0015] The lighting device is obtained based on the target harness position;

[0016] Acquire multiple acquisition angles, and perform the following operation for each of the multiple acquisition angles:

[0017] The integrity of the wire harness is obtained based on the acquisition angle and the high-speed industrial camera.

[0018] The data is compiled and sorted in descending order of harness integrity to obtain the harness integrity sequence;

[0019] Extract a preset number of wire harness integrity values ​​from the wire harness integrity value sequence to obtain a target wire harness integrity value set; take the acquisition angle corresponding to each target wire harness integrity value in the target wire harness integrity value set as the target acquisition angle to obtain a target acquisition angle set;

[0020] The high-speed industrial camera is optimized using the target acquisition angle set to obtain an optimized high-speed industrial camera group;

[0021] Perform the following operations on each optimized high-speed industrial camera in the optimized high-speed industrial camera group:

[0022] Obtain the set of lighting intensities from the lighting device, and perform the following operation on each lighting intensity in the set:

[0023] By using an optimized high-speed industrial camera and lighting intensity, images of the wire harness at the target wire harness location are acquired to obtain a pre-confirmed wire harness image;

[0024] Obtain the maximum and minimum grayscale values ​​in the pre-confirmed wire harness image, and obtain the target contrast based on the maximum and minimum grayscale values. The formula for obtaining the target contrast is as follows:

[0025]

[0026] Where D represents the target contrast. Indicates the maximum grayscale value. Indicates the minimum grayscale value;

[0027] By summing up the target contrast ratios, a target contrast ratio set is obtained;

[0028] The pre-confirmed harness image corresponding to the target with the largest contrast in the target contrast set is used as the initial harness image;

[0029] The initial harness images are summarized to obtain the initial harness image set.

[0030] Optionally, the step of preprocessing the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set includes:

[0031] For each initial harness image in the initial harness image set, perform the following operation:

[0032] Based on the image processing instructions, the initial wire harness image is transformed to grayscale to obtain a grayscale wire harness image;

[0033] Obtain the pixels in the grayscale line bundle image to obtain the pixel set;

[0034] The target grayscale value set is obtained based on the grayscale line bundle image and the pixel set, wherein each pixel corresponds to a target grayscale value.

[0035] A noise reduction wire harness image is obtained based on the grayscale wire harness image and the target grayscale value set;

[0036] An enhanced wire harness image is obtained based on the denoised wire harness image, and a target wire harness image is obtained based on the enhanced wire harness image;

[0037] The target wire harness images are compiled to obtain a target wire harness image set.

[0038] Optionally, obtaining the denoised wire harness image based on the grayscale wire harness image and the target grayscale value set includes:

[0039] The grayscale line bundle image is scanned using a pre-constructed odd-numbered window to obtain a scanned image set;

[0040] For each scanned image in the scanned image set, perform the following operation:

[0041] Obtain a window grayscale value set based on the scanned image and the target grayscale value set;

[0042] The window gray values ​​in the set of window gray values ​​are sorted in ascending order to obtain a window gray value sequence, and the window gray median is obtained based on the window gray value sequence.

[0043] Obtain the center gray value in the scanned image;

[0044] The updated center gray value is obtained by using the median gray value of the window as the center gray value.

[0045] Based on the updated center gray value, obtain the updated window gray value set, and use the updated window gray value set as the window gray value set to obtain the updated scan image;

[0046] By summing the updated scan images, an updated scan image set is obtained;

[0047] Using the updated scan image set as the scan image set, a noise-reduced wire harness image is obtained.

[0048] Optionally, obtaining the enhanced wire harness image based on the denoised wire harness image includes:

[0049] The denoised wire harness image is divided using a pre-constructed partitioning window to obtain a partitioned image set;

[0050] For each partitioned image in the partitioned image set, perform the following operation:

[0051] Obtain the set of dividing pixels of the image, and obtain the set of dividing gray values ​​based on the set of dividing pixels, wherein the dividing pixels and the dividing gray values ​​correspond one-to-one.

[0052] A partitioning histogram is obtained based on the partitioned pixel set and the partitioned gray value set, wherein the horizontal axis of the partitioning histogram is the partitioned gray value, and the vertical axis is the number of partitioned pixels corresponding to the partitioned gray value in the partitioned image.

[0053] Based on the partitioning histogram, the number of partitioning pixels corresponding to each partitioning gray value is obtained to obtain a gray value set. Based on the gray value set and a preset cropping threshold, an updated partitioning histogram is obtained.

[0054] By summarizing the updated partition histograms, an updated partition histogram set is obtained;

[0055] An updated partitioned image set is obtained based on the updated partitioned histogram set, and an enhanced wire harness image is obtained based on the updated partitioned image set.

[0056] Optionally, obtaining the updated partition histogram based on the grayscale pixel value set and a preset cropping threshold includes:

[0057] For each grayscale pixel value in the grayscale pixel value set, perform the following operation:

[0058] The grayscale pixel value is compared with the cropping threshold. If the grayscale pixel value is less than or equal to the cropping threshold, the grayscale value corresponding to the grayscale pixel value is used as the preprocessed grayscale value. If the grayscale pixel value is greater than the cropping threshold, the difference between the grayscale pixel value and the cropping threshold is calculated to obtain the excess pixel value. The first updated grayscale pixel value is obtained by using the cropping threshold as the grayscale pixel value.

[0059] The preprocessed grayscale values ​​and the first updated grayscale pixel values ​​are summarized respectively to obtain the preprocessed grayscale value set and the first updated grayscale pixel value set;

[0060] Sum the values ​​of the excess pixels to obtain the total target pixel value;

[0061] Preprocessed gray values ​​are sequentially extracted from the preprocessed gray value set, and the following operations are performed on the extracted preprocessed gray values:

[0062] Pixel allocation values ​​are obtained based on the extracted preprocessed grayscale values, cropping threshold, and target total pixel values. Second updated grayscale pixel values ​​are obtained based on the grayscale pixel values ​​corresponding to the extracted preprocessed grayscale values ​​and the pixel allocation values.

[0063] The second updated grayscale pixel values ​​are summarized to obtain the second updated grayscale pixel value set, wherein all the second updated grayscale pixel values ​​in the second updated grayscale pixel value set are less than or equal to the cropping threshold.

[0064] An updated partitioning histogram is obtained based on the first updated grayscale pixel value set and the second updated grayscale pixel value set. The method for obtaining the number of partitioning pixels corresponding to the partitioning grayscale values ​​in the updated partitioning histogram is as follows:

[0065]

[0066] in, This indicates updating the grayscale values ​​in the partition histogram. The corresponding number of pixels to be divided, Indicates the clipping threshold. Indicates the division of grayscale values grayscale pixel values, This represents the pixel allocation value.

[0067] Optionally, obtaining the target wire harness image based on the enhanced wire harness image includes:

[0068] The enhanced harness image is divided using a segmentation window to obtain multiple segmented enhanced images;

[0069] Sequentially extract segmentation enhancement images from the plurality of segmentation enhancement images, and perform the following operations on the extracted segmentation enhancement images:

[0070] A first grayscale threshold is obtained based on the extracted segmented enhanced image, wherein the first grayscale threshold is the average of the largest segmented grayscale value and the smallest segmented grayscale value in the segmented enhanced image.

[0071] Pixels are extracted sequentially from the extracted segmented and enhanced image to obtain enhanced pixels, and the following operations are performed on the enhanced pixels:

[0072] Compare the grayscale value corresponding to the enhanced pixel with the first grayscale threshold;

[0073] If the grayscale value corresponding to the enhanced pixel is greater than or equal to the first grayscale threshold, then the grayscale value corresponding to the enhanced pixel is identified as the first grayscale value.

[0074] If the gray value corresponding to the extracted enhanced pixel is less than the first gray value threshold, then the gray value corresponding to the enhanced pixel is identified as the second gray value.

[0075] The first grayscale value and the second grayscale value are summarized respectively to obtain the first grayscale value set and the second grayscale value set;

[0076] The first gray value mean and the second gray value mean are obtained based on the first gray value set and the second gray value set;

[0077] The second grayscale threshold is obtained by using the first grayscale mean and the second grayscale mean as the maximum and minimum dividing grayscale values, respectively.

[0078] Calculate the absolute difference between the first grayscale threshold and the second grayscale threshold to obtain the grayscale difference.

[0079] The grayscale difference is compared with a preset grayscale threshold. If the grayscale difference is greater than the grayscale threshold, a second grayscale threshold is used as the first grayscale threshold, and the process returns to the step of sequentially extracting pixels from the extracted segmented enhanced image until the grayscale difference is less than or equal to the grayscale threshold. Then, enhanced pixels are sequentially extracted from the extracted segmented enhanced image, and the following operations are performed on the extracted enhanced pixels:

[0080] Compare the segmentation gray value corresponding to the extracted enhanced pixel with the target gray threshold, where the target gray threshold is the average of the first gray threshold and the second gray threshold;

[0081] If the grayscale value corresponding to the enhanced pixel is less than the target grayscale threshold, then the grayscale value corresponding to the enhanced pixel is assigned to 0.

[0082] Otherwise, assign the grayscale value corresponding to the enhanced pixel to 255;

[0083] The updated segmentation enhancement image is obtained based on the assigned segmentation grayscale values, and the target wire harness image is obtained based on the updated segmentation enhancement image.

[0084] Optionally, the step of extracting features from the target harness image set based on the defect analysis command to obtain an image feature set group includes:

[0085] For each target harness image in the target harness image set, perform the following operation:

[0086] Based on the defect analysis instructions, the OpenCV software tool was identified.

[0087] The target wire harness image was analyzed using the OpenCV software tool to obtain a white outline;

[0088] Find the smallest bounding rectangle of the white outline;

[0089] The number of pixels with a grayscale value of 255 in the target wire bundle image is counted to obtain the white pixel value;

[0090] The image feature set is defined by the white outline, the minimum bounding rectangle, and the white pixel values.

[0091] The image feature sets are summarized to obtain the image feature set group.

[0092] Optionally, the step of simultaneously detecting wire harness assembly defects based on the wire harness inspection result set includes:

[0093] If the wire harness inspection result set contains one or more wire harness inspection results indicating defects, then the wire harness is considered a defective wire harness, and a pre-built robotic arm is used to remove the defective wire harness from the wire harness production line to obtain a defect-free wire harness production line.

[0094] If all the wire harness test results in the wire harness test result set are defect-free, then the wire harness is considered a qualified wire harness, and the qualified wire harness is transported using the wire harness production line to obtain the tested qualified wire harness.

[0095] Based on the aforementioned defect-free wire harness production line and the already inspected and qualified wire harnesses, synchronous detection of wire harness assembly defects is achieved.

[0096] To achieve the above objectives, the present invention also provides a synchronous detection system for wire harness assembly defects based on high-speed machine vision, comprising:

[0097] The detection environment confirmation module is used to receive defect detection instructions and confirm the defect detection environment based on the defect detection instructions. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit.

[0098] The wire harness image acquisition module is used to receive image acquisition instructions from the wire harness image acquisition unit, and to acquire images of the wire harness based on the image acquisition instructions to obtain an initial wire harness image set.

[0099] The wire harness image processing module is used to receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set.

[0100] The wire harness defect analysis module is used to receive defect analysis instructions from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instructions to obtain an image feature set group.

[0101] The image feature set is analyzed using a pre-built deep learning method to obtain a wire bundle detection result set. The wire bundle detection result set includes multiple wire bundle detection results, each of which corresponds one-to-one with the target wire bundle image. The wire bundle detection result indicates whether there is a defect or no defect.

[0102] Synchronous detection of wire harness assembly defects is achieved based on the wire harness inspection result set.

[0103] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:

[0104] A memory that stores at least one instruction; and a processor that executes the instructions stored in the memory to implement the above-described synchronous detection method for wire harness assembly defects based on high-speed machine vision.

[0105] To address the aforementioned issues, the present invention also provides a computer-readable storage medium storing at least one instruction, which is executed by a processor in an electronic device to implement the above-described method for synchronous detection of wire harness assembly defects based on high-speed machine vision.

[0106] To address the problems described in the background art, this invention receives a defect detection command and, based on the command, identifies a defect detection environment. This environment includes a defect detection system and the wire harness to be inspected. The defect detection system comprises a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit. Therefore, before performing assembly defect detection on the wire harness, this invention considers the defect detection conditions under different environments. Thus, before performing assembly defect detection, the defect detection environment and the defect detection system for assembly defect detection are identified. Next, an image acquisition command is received from the wire harness image acquisition unit, and images of the wire harness are acquired based on this command to obtain an initial wire harness image set. This invention also considers the possibility of different detection results when performing defect detection on the wire harness at different angles. Therefore, by acquiring images of the wire harness at different acquisition angles, the obtained initial wire harness image set is more comprehensive, laying the foundation for subsequent assembly defect detection. Finally, an image processing command is received from the wire harness image processing unit, and based on the image processing... The instructions preprocess the initial wire harness image set to obtain the target wire harness image set. It is evident that this invention also considers that noise in the acquired initial wire harness image set may affect the defect detection results. Therefore, noise reduction, enhancement, and segmentation operations are performed on the initial wire harness images to improve the accuracy of assembly defect detection. The invention receives defect analysis instructions from the wire harness defect detection unit and extracts features from the target wire harness image set based on these instructions, obtaining an image feature set. Thus, when performing defect detection on the wire harness, this invention extracts the image feature set of the wire harness image through feature extraction, and then analyzes the image feature set using a pre-constructed deep learning method to obtain a wire harness detection result set. The wire harness detection result set includes multiple wire harness detection results, each corresponding one-to-one with the target wire harness image, and the detection result indicates the presence or absence of defects. This invention also considers the need for efficient and accurate defect detection of the wire harness. Therefore, deep learning is used for defect detection, making defect detection faster and more accurate. Thus, synchronous detection of wire harness assembly defects is achieved based on the wire harness detection result set. Therefore, the present invention can achieve accurate detection of defects in wire harness assembly. Attached Figure Description

[0107] Figure 1 This is a flowchart illustrating a method for synchronous detection of wire harness assembly defects based on high-speed machine vision, according to an embodiment of the present invention.

[0108] Figure 2 A functional block diagram of a wire harness assembly defect synchronous detection system based on high-speed machine vision provided in an embodiment of the present invention;

[0109] Figure 3This is a schematic diagram of the structure of an electronic device that implements the synchronous detection method for wire harness assembly defects based on high-speed machine vision, according to an embodiment of the present invention.

[0110] Explanation of reference numerals in the attached figures:

[0111] 10. Electronic device; 11. Processor; 12. Memory; 13. Bus.

[0112] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0113] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0114] This application provides a method for synchronous detection of wire harness assembly defects based on high-speed machine vision. The executing entity of this method includes, but is not limited to, at least one electronic device that can be configured to execute the method provided in this application, such as a server or a terminal. In other words, the method can be executed by software or hardware installed on a terminal device or a server device, and the software may be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster.

[0115] Reference Figure 1 The diagram shown is a flowchart illustrating a method for synchronous detection of wire harness assembly defects based on high-speed machine vision, according to an embodiment of the present invention. In this embodiment, the method for synchronous detection of wire harness assembly defects based on high-speed machine vision includes:

[0116] S1. Receive a defect detection command and confirm the defect detection environment based on the defect detection command. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit.

[0117] It should be explained that the defect detection command is an instruction issued by personnel who want to perform assembly defect detection on the wire harness. The defect detection environment refers to the necessary environment for performing assembly defect detection on the wire harness. The defect detection system refers to the software or application used to perform assembly defect detection on the wire harness, and it can control the units or mechanisms. The wire harness to be inspected refers to the wire harness whose assembly defects need to be detected by the defect detection system. Assembly defects in the wire harness include terminal misalignment, insulation deformation, connector breakage, etc. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit. For the specific application of these units, please refer to the following embodiments. The main purpose of this invention is to improve the accuracy of defect detection on wire harnesses.

[0118] For example, Xiao Zhang, as the safety personnel responsible for wire harness defect detection, in order to perform defect detection on the wire harness and avoid quality problems in the wire harnesses that are not detected during the assembly process, so that they leave the factory with defects, Xiao Zhang issues the defect detection command and confirms the defect detection environment.

[0119] S2. Receive an image acquisition command from the wire harness image acquisition unit, and acquire images of the wire harness based on the image acquisition command to obtain an initial wire harness image set.

[0120] It is clear that the wire harness image acquisition unit is a functional module in the defect detection system used to acquire images of the wire harness. Optionally, a high-speed industrial camera can be used as the wire harness image acquisition unit.

[0121] Furthermore, the step of acquiring images of the wire harness based on the image acquisition command to obtain an initial wire harness image set includes:

[0122] The wire harness production line is obtained. A planar coordinate system is established in the wire harness production line with the preset acquisition position as the origin. The wire harness is monitored using a pre-built position sensor and the planar coordinate system to obtain the position of the wire harness.

[0123] The distance difference is obtained based on the acquisition position and the wire harness position. When the distance difference is equal to the preset distance threshold, the high-speed industrial camera is identified based on the image acquisition command. When the distance difference is 0, the wire harness position corresponding to the distance difference is taken as the target wire harness position.

[0124] The lighting device is obtained based on the target harness position;

[0125] Acquire multiple acquisition angles, and perform the following operation for each of the multiple acquisition angles:

[0126] The integrity of the wire harness is obtained based on the acquisition angle and the high-speed industrial camera.

[0127] The data is compiled and sorted in descending order of harness integrity to obtain the harness integrity sequence;

[0128] Extract a predetermined number of wire harness integrity scores from the wire harness integrity sequence to obtain the target wire harness integrity set;

[0129] The target acquisition angle set is obtained by taking the acquisition angle corresponding to each target wire harness integrity in the target wire harness integrity set as the target acquisition angle;

[0130] The high-speed industrial camera is optimized using the target acquisition angle set to obtain an optimized high-speed industrial camera group;

[0131] Perform the following operations on each optimized high-speed industrial camera in the optimized high-speed industrial camera group:

[0132] Obtain the set of lighting intensities from the lighting device, and perform the following operation on each lighting intensity in the set:

[0133] By using an optimized high-speed industrial camera and lighting intensity, images of the wire harness at the target wire harness location are acquired to obtain a pre-confirmed wire harness image;

[0134] Obtain the maximum and minimum grayscale values ​​in the pre-confirmed wire harness image, and obtain the target contrast based on the maximum and minimum grayscale values. The formula for obtaining the target contrast is as follows:

[0135]

[0136] Where D represents the target contrast. Indicates the maximum grayscale value. Indicates the minimum grayscale value;

[0137] By summing up the target contrast ratios, a target contrast ratio set is obtained;

[0138] The pre-confirmed harness image corresponding to the target with the largest contrast in the target contrast set is used as the initial harness image;

[0139] The initial harness images are summarized to obtain the initial harness image set.

[0140] It should be explained that a wire harness production line refers to a production line that assembles, transports, and inspects wire harnesses for defects. "Identifying a wire harness production line" means using the wire harness to pinpoint its location on the production line and initiating defect inspection. Optionally, a laser rangefinder sensor can be used as a position sensor to monitor the wire harness; the wire harness position refers to its location on the wire harness production line.

[0141] Understandably, the distance difference refers to the distance from the wire harness to the acquisition position. For example, in a planar coordinate system, if the wire harness position is (-20, 0) and the acquisition position is (0, 0), then the distance difference is 20. When the distance difference equals a preset distance threshold, the high-speed industrial camera is activated based on the image acquisition command. This means that when the wire harness reaches the designated position, the high-speed industrial camera is activated via the image acquisition command. Since activating the high-speed industrial camera takes time, it is activated when the distance difference equals the distance threshold. For example, when the distance threshold is 5 and the distance difference is 5 (i.e., the wire harness position is (-5, 0)), the high-speed industrial camera is activated. When the distance difference is 0, it indicates that the wire harness has reached the acquisition position, and the activated high-speed industrial camera is used to acquire an image of the wire harness at the target position. After assembly, the wire harness is transported through the wire harness production line. When the position sensor detects that the wire harness has reached the acquisition position, the target wire harness position is obtained, and the wire harness is illuminated. The target wire harness position refers to the position in the wire harness production line where the image of the wire harness is acquired. The illumination device based on the target harness position refers to activating the illumination device and illuminating the harness when it is located at the target harness position. Optionally, a directional LED light can be used as the illumination device.

[0142] It is clear that acquiring multiple acquisition angles refers to identifying multiple acquisition angles around the wire harness. The acquisition angle refers to the angle between the high-speed industrial camera and the plane containing the wire harness. For example, the high-speed industrial camera acquires images at a 90° angle perpendicular to the wire harness. Obtaining the wire harness integrity based on these acquisition angles and the high-speed industrial camera involves acquiring images of the wire harness at the aforementioned acquisition angles and calculating the percentage of the wire harness area in the image compared to the actual area of ​​the wire harness at that acquisition angle. For example, if the area of ​​the wire harness in the image is 80, and the actual area of ​​the wire harness at that acquisition angle is 100, then the wire harness integrity is 80%. The harness integrity sequence refers to a sequence obtained by sorting the harness integrity in descending order. For example, the harness integrity sequence is {100%, 100%, 98%, 97%, 96%, 80%}. Extracting a preset number of harness integrity values ​​from the harness integrity sequence means extracting the top N harness integrity values ​​from the sequence, where N equals the preset number. For example, if the preset number is 3, then the target integrity set is {100%, 100%, 98%}. The target acquisition angle refers to the acquisition angle that can capture a relatively complete image of the harness. Optimizing the high-speed industrial camera using the target acquisition angle set means setting one high-speed industrial camera at each of the multiple target acquisition angles. Optionally, the same effect can be achieved by moving the high-speed industrial camera to the target acquisition angle. Optimizing the high-speed industrial camera refers to using a high-speed industrial camera that acquires images at a specified target acquisition angle. An optimized high-speed industrial camera group refers to a collection of multiple high-speed industrial cameras with different acquisition angles.

[0143] Understandably, acquiring the illumination intensity set of a lighting device refers to setting different illumination intensities within the lighting device. A pre-confirmed wiring harness image refers to an image obtained by capturing the wiring harness using an optimized high-speed industrial camera at a set illumination intensity. The maximum grayscale value refers to the highest grayscale value in the pre-confirmed wiring harness image, and the minimum grayscale value refers to the lowest grayscale value in the pre-confirmed wiring harness image. Target contrast is an indicator used to evaluate the overall sharpness of the wiring harness's outline in the image; the higher the target contrast, the sharper the overall outline of the wiring harness in the image, and vice versa.

[0144] It should be explained that the purpose of identifying the target acquisition angle set is to determine multiple target acquisition angles that can capture a relatively complete view of the wire harness during image acquisition, ensuring that the acquired image contains the main information of the wire harness, such as terminals, connectors, and data cables. The purpose of obtaining the pre-confirmed wire harness image corresponding to the maximum target contrast is to determine the optimal lighting intensity when illuminating the wire harness, preventing overly bright or dark conditions during acquisition that would result in a blurry or unclear image.

[0145] It is clear that the initial wire harness image refers to the image obtained by acquiring images of the wire harness using an optimized high-speed industrial camera. The initial wire harness image set refers to the collection of images obtained by acquiring images of the wire harness from different acquisition angles.

[0146] S3. Receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set.

[0147] It is clear that the wire harness image processing unit is a functional module in the defect detection system that performs preprocessing operations on the initial wire harness image. The preprocessing operations include noise reduction, enhancement, and image segmentation of the initial wire harness image.

[0148] Furthermore, the step of preprocessing the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set includes:

[0149] For each initial harness image in the initial harness image set, perform the following operation:

[0150] Based on the image processing instructions, the initial wire harness image is transformed to grayscale to obtain a grayscale wire harness image;

[0151] Obtain the pixels in the grayscale line bundle image to obtain the pixel set;

[0152] The target grayscale value set is obtained based on the grayscale line bundle image and the pixel set, wherein each pixel corresponds to a target grayscale value.

[0153] A noise reduction wire harness image is obtained based on the grayscale wire harness image and the target grayscale value set;

[0154] An enhanced wire harness image is obtained based on the denoised wire harness image, and a target wire harness image is obtained based on the enhanced wire harness image;

[0155] The target wire harness images are compiled to obtain a target wire harness image set.

[0156] Understandably, the image processing instruction refers to the operation instruction issued by the harness image processing unit to begin preprocessing the initial harness image. Grayscale transformation refers to the operation of converting a color image to a grayscale image; here, it is the step of converting the initial harness image to a grayscale harness image. Grayscale transformation is existing technology and will not be elaborated further. Obtaining the pixels of the grayscale harness image refers to the process of analyzing the grayscale harness image using machine vision software to obtain the pixels. For example, OpenCV can be used as the machine vision software, and other machine vision software can also be used to obtain the pixels of grayscale images. Obtaining the target grayscale value set based on the grayscale line harness image and pixel set refers to extracting the grayscale value of each pixel from the grayscale line harness image. For example, the grayscale value of pixel I (100, 50) in the 100th row and 50th column of the grayscale line harness image is 200, and the grayscale value of pixel I (80, 40) in the 80th row and 40th column is 40. Here, I represents a pixel, and (100, 50) represents the position of the pixel. In subsequent embodiments, a pixel is represented by I plus the coordinate position.

[0157] Furthermore, the step of obtaining the denoised wire harness image based on the grayscale wire harness image and the target grayscale value set includes:

[0158] The grayscale line bundle image is scanned using a pre-constructed odd-numbered window to obtain a scanned image set;

[0159] For each scanned image in the scanned image set, perform the following operation:

[0160] Obtain a window grayscale value set based on the scanned image and the target grayscale value set;

[0161] The window gray values ​​in the set of window gray values ​​are sorted in ascending order to obtain a window gray value sequence, and the window gray median is obtained based on the window gray value sequence.

[0162] Obtain the center gray value in the scanned image;

[0163] The updated center gray value is obtained by using the median gray value of the window as the center gray value.

[0164] Based on the updated center gray value, obtain the updated window gray value set, and use the updated window gray value set as the window gray value set to obtain the updated scan image;

[0165] By summing the updated scan images, an updated scan image set is obtained;

[0166] Using the updated scan image set as the scan image set, a noise-reduced wire harness image is obtained.

[0167] It should be explained that an odd-numbered window refers to a window with equal and odd-numbered length and width, where both length and width are odd numbers greater than 1, such as a 3x3 window and a 5x5 window. Scanning a grayscale line harness image using a pre-constructed odd-numbered window involves placing the top-left vertex of the odd-numbered window at the pixel position in the first row and first column of the grayscale line harness image to begin scanning, obtaining a scanned image set. This process is repeated, placing the top-left vertex of the odd-numbered window at each pixel position in the grayscale line harness image, and then scanning again to obtain a set of scanned images. The scanned images in this set have overlapping portions; for example, the pixels in the first row of the grayscale line harness image are S1, S2, S3, S4, and the pixels in the second row are S5, S6, S7, S8, S9, S10, S11, S12, S13, S14, S15, S16, S17, S18, S19, S10 ... 8. Place the top left corner of the odd-numbered window at S1 to obtain scanned image M1, and place the top left corner of the odd-numbered window at S2 to obtain scanned image M2. The overlapping parts of M1 and M2 are S2, S3, S6, and S7. After all the pixels in the first row have been placed in the scanned window, continue scanning from the first pixel in the second row. For example, place the top left corner of the odd-numbered window at S4 to obtain scanned image M4. Continue this process until the top left corner of the scanned window is placed at all the pixels in the grayscale line bundle image. The scanned image set is then obtained.

[0168] It is understood that obtaining the window grayscale value set based on the scanned image and the target grayscale value set refers to extracting the grayscale value corresponding to each pixel in the scanned image from the target grayscale value set. For example, if the pixels in the 3*3 scanned image are I(1,2), I(1,3), I(1,4), I(2,2), I(2,3), I(2,4), I(3,2), I(3,3), I(3,4), and the target grayscale values ​​corresponding to the pixels I(1,2), I(1,3), I(1,4), I(2,2), I(2,3), I(2,4), I(3,2), I(3,3), I(3,4) in the target grayscale value set are 50, 51, 52, 60, 41, 62, 58, 57, 72, then the window grayscale value set is {50, 51, 52, 60, 41, 62, 58, 57, 72}. A window grayscale value sequence refers to a sequence obtained by sorting the window grayscale values ​​in the window grayscale value set from smallest to largest. For example, the window grayscale value sequence is {41, 50, 51, 52, 57, 58, 60, 62, 72}. The window grayscale median is the median of the window grayscale values ​​in the window grayscale value sequence. For example, the window grayscale median is 57. The center grayscale value is the window grayscale value corresponding to the pixel at the center of the scanned image. For example, in a 3x3 scanned image, the center pixel is I(2,3), and the center grayscale value is 41.

[0169] It's clear that updating the center grayscale value means replacing the center grayscale value with the new center grayscale value obtained from the window's median grayscale value. For example, if the window's median grayscale value is 57 and the center grayscale value is 41, then the updated center grayscale value is 57. Updating the window grayscale value set means replacing the center grayscale value with the updated window grayscale value set. For example, if the window grayscale value set is {50, 51, 52, 60, 41, 62, 58, 57, 72}, and the updated center grayscale value is 57, then the updated window grayscale value set is {50, 51, 52, 60, 57, 62, 58, 57, 72}. Updating the scanned image means replacing the window grayscale value set with the updated window grayscale value set to obtain the scanned image.

[0170] It should be explained that a denoised wire harness image refers to a grayscale wire harness image after denoising. By scanning the grayscale wire harness image through an odd number of windows and replacing the center grayscale value of the scanned image with the median grayscale value of the window, isolated noise points in the grayscale wire harness image can be effectively removed, resulting in a denoised wire harness image.

[0171] Furthermore, the step of obtaining the enhanced wire harness image based on the denoised wire harness image includes:

[0172] The denoised wire harness image is divided using a pre-constructed partitioning window to obtain a partitioned image set;

[0173] For each partitioned image in the partitioned image set, perform the following operation:

[0174] Obtain the set of dividing pixels of the image, and obtain the set of dividing gray values ​​based on the set of dividing pixels, wherein the dividing pixels and the dividing gray values ​​correspond one-to-one.

[0175] A partitioning histogram is obtained based on the partitioned pixel set and the partitioned gray value set, wherein the horizontal axis of the partitioning histogram is the partitioned gray value, and the vertical axis is the number of partitioned pixels corresponding to the partitioned gray value in the partitioned image.

[0176] Based on the partitioning histogram, the number of partitioning pixels corresponding to each partitioning gray value is obtained to obtain a gray value set. Based on the gray value set and a preset cropping threshold, an updated partitioning histogram is obtained.

[0177] By summarizing the updated partition histograms, an updated partition histogram set is obtained;

[0178] An updated partitioned image set is obtained based on the updated partitioned histogram set, and an enhanced wire harness image is obtained based on the updated partitioned image set.

[0179] It should be explained that obtaining an enhanced wire harness image based on the denoised wire harness image means dividing the denoised wire harness image and enhancing each divided image to achieve image enhancement of the denoised wire harness image.

[0180] It should be explained that dividing the denoised wire harness image using a pre-constructed partitioning window means dividing the denoised wire harness image into non-overlapping rectangular windows, and the resulting partitioned images are of the same size. For example, if the denoised wire harness image is a 25*25 rectangular image, then a 5*5 rectangular window is used to divide the denoised wire harness image into non-overlapping partitions, resulting in five 5*5 partitioned images.

[0181] It is clear that obtaining the set of pixel points for the segmented image refers to identifying each pixel in the segmented image from the denoised wireframe image based on the size and position of the segmentation window. A segmented pixel refers to a pixel in the segmented image. The segmented grayscale value refers to the grayscale value corresponding to the segmented pixel. This is determined by identifying the pixel value of the segmented pixel in the denoised wireframe image. For example, if the segmented pixel is I(4,5), and the pixel value corresponding to I(4,5) in the denoised wireframe image is 55, then the segmented grayscale value is 55.

[0182] It should be explained that obtaining the partition histogram based on the partitioned pixel set and partitioned gray value set means counting the number of partitioned pixels corresponding to each partitioned gray value in the partitioned image. The partition histogram is constructed with the partitioned gray value on the horizontal axis and the number of partitioned pixels corresponding to each partitioned gray value on the vertical axis. For example, if it is found that there are 50 partitioned pixels with a partitioned gray value of 55 and 60 partitioned pixels with a partitioned gray value of 60, then they are represented as (55, 50) and (60, 60) respectively in the partition histogram.

[0183] It should be explained that grayscale pixel value refers to the number of pixels that divide a grayscale value. For example, the grayscale pixel value of a grayscale value of 55 is 50.

[0184] Furthermore, the step of obtaining and updating the partitioning histogram based on the grayscale pixel value set and a preset cropping threshold includes:

[0185] For each grayscale pixel value in the grayscale pixel value set, perform the following operation:

[0186] The grayscale pixel value is compared with the cropping threshold. If the grayscale pixel value is less than or equal to the cropping threshold, the grayscale value corresponding to the grayscale pixel value is used as the preprocessed grayscale value. If the grayscale pixel value is greater than the cropping threshold, the difference between the grayscale pixel value and the cropping threshold is calculated to obtain the excess pixel value. The first updated grayscale pixel value is obtained by using the cropping threshold as the grayscale pixel value.

[0187] The preprocessed grayscale values ​​and the first updated grayscale pixel values ​​are summarized respectively to obtain the preprocessed grayscale value set and the first updated grayscale pixel value set;

[0188] Sum the values ​​of the excess pixels to obtain the total target pixel value;

[0189] Preprocessed gray values ​​are sequentially extracted from the preprocessed gray value set, and the following operations are performed on the extracted preprocessed gray values:

[0190] Pixel allocation values ​​are obtained based on the extracted preprocessed grayscale values, cropping threshold, and target total pixel values. Second updated grayscale pixel values ​​are obtained based on the grayscale pixel values ​​corresponding to the extracted preprocessed grayscale values ​​and the pixel allocation values.

[0191] The second updated grayscale pixel values ​​are summarized to obtain the second updated grayscale pixel value set, wherein all the second updated grayscale pixel values ​​in the second updated grayscale pixel value set are less than or equal to the cropping threshold.

[0192] An updated partitioning histogram is obtained based on the first updated grayscale pixel value set and the second updated grayscale pixel value set. The method for obtaining the number of partitioning pixels corresponding to the partitioning grayscale values ​​in the updated partitioning histogram is as follows:

[0193]

[0194] in, This indicates updating the grayscale values ​​in the partition histogram. The corresponding number of pixels to be divided, Indicates the clipping threshold. Indicates the division of grayscale values grayscale pixel values, This represents the pixel allocation value.

[0195] It needs to be explained that the cropping threshold is the value used to determine whether grayscale pixel values ​​need to be cropped. Cropping pixels corresponding to grayscale values ​​exceeding the cropping threshold and redistributing them to preprocessed grayscale values ​​is an image enhancement method that aims to achieve a more even distribution of pixels across different grayscale values, thus achieving histogram equalization. When a grayscale pixel value is less than or equal to the cropping threshold, it indicates that the grayscale pixel value does not need to be cropped, and the number of pixels corresponding to that grayscale value is relatively small; therefore, that grayscale value is marked as a preprocessed grayscale value. When a grayscale pixel value is greater than the cropping threshold, it indicates that the number of pixels corresponding to that grayscale value is too large, exceeding the set threshold. Therefore, the grayscale pixel value is cropped, reducing the number of pixels exceeding the cropping threshold to equal the grayscale pixel value. The number of cropped pixels is considered excess and is redistributed to preprocessed grayscale values, increasing the number of pixels corresponding to the preprocessed grayscale values ​​but not exceeding the cropping threshold. For example, a grayscale pixel with a grayscale value of 55... With a value of 50, the grayscale pixel value of grayscale value 45 is 15, and the cropping threshold is 25. Therefore, grayscale value 45 is the preprocessed pixel value. The cropping threshold makes the grayscale pixel value of grayscale value 55 25. Even if the number of pixels corresponding to grayscale value 55 becomes 25, the excess pixel value is 25. The excess pixel value is allocated to grayscale value 45, making the grayscale pixel value of the grayscale value 45 25. The remaining excess pixel value is randomly allocated to other preprocessed pixel values ​​according to the above allocation method.

[0196] It's clear that the first updated grayscale pixel value refers to the value obtained when the grayscale pixel value is greater than the cropping threshold. The first updated grayscale pixel value is obtained using the cropping threshold as the grayscale pixel value. For example, if the grayscale pixel value for a grayscale value of 55 is 50, and the cropping threshold is 25, then the first updated grayscale pixel value for a grayscale value of 55 is 25. Preprocessed grayscale values ​​refer to grayscale values ​​for which the number of subdivided pixels needs to be increased. The target total pixel value refers to the sum of the number of subdivided pixels that were cropped from the grayscale pixel value set.

[0197] Understandably, obtaining the pixel allocation value based on the extracted preprocessed grayscale value, cropping threshold, and target total pixel value means calculating the difference between the cropping threshold and the grayscale pixel value corresponding to the preprocessed grayscale value to obtain the target difference. If the target total pixel value is greater than the target difference, the target difference is used as the pixel allocation value; if the target total pixel value is less than the target difference, the target total pixel value is used as the pixel allocation value. For example, if the grayscale pixel value corresponding to the preprocessed grayscale value 45 is 15, and the cropping threshold is 25, then the target difference is 10, and the target total pixel value is 100, then the pixel allocation value is 10. If the target total pixel value is 7, then the pixel allocation value is 7.

[0198] It is clear that obtaining the second updated grayscale pixel value based on the extracted preprocessed grayscale value and the pixel allocation value means mapping the grayscale values ​​of the partitioned pixel points corresponding to the pixel allocation value to the preprocessed grayscale value through a histogram equalization method. Therefore, the grayscale pixel value corresponding to the preprocessed grayscale value increases. The histogram equalization method is existing technology and will not be described in detail here. For example, if the grayscale pixel value corresponding to the preprocessed grayscale value 45 is 15, and the partitioned grayscale value of the 10 partitioned pixel points corresponding to the pixel allocation value 10 is 55, then the partitioned grayscale value 55 of the 10 partitioned pixel points is mapped to the preprocessed grayscale value 45 through histogram equalization, and the second updated grayscale pixel value is 25. The second updated grayscale pixel value refers to the new grayscale pixel value obtained by adding the pixel allocation value to the grayscale pixel value corresponding to the extracted preprocessed grayscale value, and the sum of the first updated grayscale pixel value set and the second updated grayscale pixel value set is equal to the sum of the grayscale pixel values ​​in the grayscale pixel value set.

[0199] It should be explained that the updated partitioning histogram refers to a partitioning histogram whose grayscale pixel values ​​are either the first updated grayscale pixel values ​​or the second updated grayscale pixel values. Obtaining an updated partitioning image set based on the updated partitioning histogram set means identifying the updated partitioning images according to the grayscale pixel values ​​corresponding to the updated partitioning histogram and the partitioning grayscale values, and then summarizing them to obtain the updated partitioning image set. Obtaining an enhanced wire harness image based on the updated partitioning image set means placing each updated partitioning image in the updated partitioning image set at its corresponding partitioning window position to identify the enhanced wire harness image.

[0200] Furthermore, the step of obtaining the target wire harness image based on the enhanced wire harness image includes:

[0201] The enhanced harness image is divided using a segmentation window to obtain multiple segmented enhanced images;

[0202] Sequentially extract segmentation enhancement images from the plurality of segmentation enhancement images, and perform the following operations on the extracted segmentation enhancement images:

[0203] A first grayscale threshold is obtained based on the extracted segmented enhanced image, wherein the first grayscale threshold is the average of the largest segmented grayscale value and the smallest segmented grayscale value in the segmented enhanced image.

[0204] Pixels are extracted sequentially from the extracted segmented and enhanced image to obtain enhanced pixels, and the following operations are performed on the enhanced pixels:

[0205] Compare the grayscale value corresponding to the enhanced pixel with the first grayscale threshold;

[0206] If the grayscale value corresponding to the enhanced pixel is greater than or equal to the first grayscale threshold, then the grayscale value corresponding to the enhanced pixel is identified as the first grayscale value.

[0207] If the gray value corresponding to the extracted enhanced pixel is less than the first gray value threshold, then the gray value corresponding to the enhanced pixel is identified as the second gray value.

[0208] The first grayscale value and the second grayscale value are summarized respectively to obtain the first grayscale value set and the second grayscale value set;

[0209] The first gray value mean and the second gray value mean are obtained based on the first gray value set and the second gray value set;

[0210] The second grayscale threshold is obtained by using the first grayscale mean and the second grayscale mean as the maximum and minimum dividing grayscale values, respectively.

[0211] Calculate the absolute difference between the first grayscale threshold and the second grayscale threshold to obtain the grayscale difference.

[0212] The grayscale difference is compared with a preset grayscale threshold. If the grayscale difference is greater than the grayscale threshold, a second grayscale threshold is used as the first grayscale threshold, and the process returns to the step of sequentially extracting pixels from the extracted segmented enhanced image until the grayscale difference is less than or equal to the grayscale threshold. Then, enhanced pixels are sequentially extracted from the extracted segmented enhanced image, and the following operations are performed on the extracted enhanced pixels:

[0213] Compare the segmentation gray value corresponding to the extracted enhanced pixel with the target gray threshold, where the target gray threshold is the average of the first gray threshold and the second gray threshold;

[0214] If the grayscale value corresponding to the enhanced pixel is less than the target grayscale threshold, then the grayscale value corresponding to the enhanced pixel is assigned to 0.

[0215] Otherwise, assign the grayscale value corresponding to the enhanced pixel to 255;

[0216] The updated segmentation enhancement image is obtained based on the assigned segmentation grayscale values, and the target wire harness image is obtained based on the updated segmentation enhancement image.

[0217] It should be explained that the method of segmenting the enhanced wire harness image using a segmentation window is the same as the method of segmenting the denoised wire harness image using a pre-constructed segmentation window, and will not be repeated here. The purpose of segmenting the enhanced wire harness image is to perform specific analysis based on the segmented image of the enhanced wire harness image within the region, thereby improving the accuracy of the segmented enhanced image processing.

[0218] Understandably, the segmented enhanced image includes multiple enhanced pixels, and each enhanced pixel corresponds to a segmented grayscale value. Labeling the segmented grayscale value corresponding to the enhanced pixel as the first grayscale value means that when the segmented grayscale value corresponding to the enhanced pixel is greater than or equal to the first grayscale threshold, the position of the enhanced pixel in the segmented enhanced image is recorded, and the segmented grayscale value corresponding to the enhanced pixel is marked as the first grayscale value. When subsequently summarizing to obtain the first grayscale value set, the enhanced pixel is identified in the segmented enhanced image, and its corresponding first grayscale value is summarized into the first grayscale value set. For example, if the segmented grayscale value corresponding to the enhanced pixel is 200, which is greater than the first grayscale threshold of 122, then the position of the enhanced pixel in the segmented enhanced image is recorded as I(5, 6), and the grayscale value 200 corresponding to the enhanced pixel is marked as the first grayscale value. The method for labeling the second grayscale value is the same as the method for labeling the first grayscale value, and will not be repeated here.

[0219] It is clear that the first grayscale mean is the average of N first grayscale values ​​in the first grayscale value set, and the second grayscale mean is the average of M second grayscale values ​​in the second grayscale value set, where N is the total number of first grayscale values ​​in the first grayscale value set, and M is the total number of second grayscale values ​​in the second grayscale value set. The second grayscale threshold is the average of the first grayscale mean and the second grayscale mean. For example, if the first grayscale mean is 50 and the second grayscale mean is 200, then the second grayscale threshold is 125.

[0220] It should be explained that when the grayscale difference is less than the grayscale threshold, the background part and the line bundle part in the enhanced image can be considered to be separated. Therefore, when the grayscale value corresponding to the enhanced pixel is greater than or equal to the target grayscale threshold, the enhanced pixel can be identified as a point that divides the line bundle part in the enhanced image, and the grayscale value at this point is assigned to 255. When the grayscale value corresponding to the enhanced pixel is less than the target grayscale threshold, the enhanced pixel can be identified as a point that divides the background part in the enhanced image, and the grayscale value at this point is assigned to 0.

[0221] Understandably, obtaining an updated segmentation enhancement image based on the assigned segmentation grayscale values ​​means reassigning the segmentation grayscale values ​​corresponding to the enhanced pixels in the segmentation enhancement image to obtain the updated segmentation enhancement image. Obtaining a target line bundle image based on the updated segmentation enhancement image means using the updated segmentation enhancement image as the segmentation enhancement image to obtain the target line bundle image. The target line bundle image is a black and white image where the grayscale value corresponding to each pixel is 0 or 255.

[0222] S4. Receive a defect analysis instruction from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instruction to obtain an image feature set group.

[0223] It is clear that the wire harness defect detection unit is a functional module in the wire harness detection system that performs defect detection on the target wire harness image. Optionally, a convolutional neural network in deep learning can be used as the wire harness defect detection unit.

[0224] Furthermore, the step of extracting features from the target harness image set based on the defect analysis command to obtain an image feature set group includes:

[0225] For each target harness image in the target harness image set, perform the following operation:

[0226] Based on the defect analysis instructions, the OpenCV software tool was identified.

[0227] The target wire harness image was analyzed using the OpenCV software tool to obtain a white outline;

[0228] Find the smallest bounding rectangle of the white outline;

[0229] The number of pixels with a grayscale value of 255 in the target wire bundle image is counted to obtain the white pixel value;

[0230] The image feature set is defined by the white outline, the minimum bounding rectangle, and the white pixel values.

[0231] The image feature sets are summarized to obtain the image feature set group.

[0232] It should be explained that the defect analysis command refers to the operation command issued by the defect detection unit to extract features from the target wire harness image. The confirmation of the OpenCV software tool based on the defect analysis command means that the OpenCV software tool is activated and begins to analyze the target wire harness image using the OpenCV software tool after the defect detection unit issues the defect analysis command.

[0233] Understandably, the white outline refers to the outline of the wire harness portion in the target wire harness image. Obtaining the minimum bounding rectangle of the white outline means finding the smallest rectangle that can completely enclose the white outline. In defect detection, comparing the area of ​​the minimum bounding rectangle can determine whether the terminals in the wire harness are misaligned or improperly inserted. For example, the area of ​​the minimum bounding rectangle corresponding to a defect-free wire harness is smaller than the area of ​​the minimum bounding rectangle corresponding to a wire harness with misaligned terminals.

[0234] It's clear that the white pixel value refers to the number of pixels with a grayscale value of 255 in the target wiring harness image. For example, if there are 100 pixels with a grayscale value of 255 in the target wiring harness image, then the white pixel value is 100. By comparing the magnitude of the white pixel values, it can be determined whether there are any missing terminals in the wiring harness. For example, the white pixel value of a wiring harness without missing terminals is 240, which is greater than the white pixel value of a wiring harness with missing terminals is 210.

[0235] It should be explained that an image feature set refers to a set containing the white outline, minimum bounding rectangle, and white pixel values ​​in a target wire harness image, while an image feature set group refers to a set of image feature sets corresponding to multiple target wire harness images in a target wire harness image set.

[0236] S5. Analyze the image feature set using a pre-built deep learning method to obtain a wire harness detection result set. The wire harness detection result set includes multiple wire harness detection results, each of which corresponds one-to-one with the target wire harness image. The wire harness detection results indicate whether there is a defect or no defect.

[0237] Furthermore, the analysis of the image feature set using a pre-constructed deep learning method to obtain the wire bundle detection result set includes:

[0238] Obtain multiple reference wire harnesses, including multiple defect-free wire harnesses and multiple defective wire harnesses;

[0239] The wire harness image acquisition unit is used to acquire images of multiple reference wire harnesses to obtain a reference wire harness image set.

[0240] The reference wire harness image set is preprocessed using the wire harness image processing unit to obtain the target reference image set;

[0241] The wire harness defect detection unit is used to extract features from the target reference image set to obtain the reference image feature set group;

[0242] A model is constructed by training the multiple reference wire harnesses and reference image feature sets using deep learning methods to obtain a wire harness defect detection model;

[0243] The wire harness defect detection result set is obtained based on the aforementioned wire harness defect detection model and image feature set.

[0244] It should be explained that acquiring multiple reference wire harnesses refers to manually selecting multiple defect-free wire harnesses and multiple defective wire harnesses in the wire harness production line. A defect-free wire harness is one without defects, and a defective wire harness is one with defects. The method for acquiring images of multiple reference wire harnesses using the wire harness image acquisition unit is the same as the method for acquiring images of wire harnesses based on the image acquisition command, and will not be repeated here. The method for preprocessing the reference wire harness image set using the wire harness image processing unit to obtain the target reference image set is the same as the method for preprocessing the initial wire harness image set based on the image processing command to obtain the target wire harness image set, and will not be repeated here. The method for extracting features from the target reference image set using the wire harness defect detection unit to obtain the reference image feature set group is the same as the method for extracting features from the target wire harness image set based on the defect analysis command to obtain the image feature set group, and will not be repeated here. Furthermore, the method for training and building a model using deep learning methods on the multiple reference wire harnesses and the reference image feature set group to obtain the wire harness defect detection model is existing technology and will not be repeated here.

[0245] It should be explained that the reference wire harness image set refers to the set of images acquired from the reference wire harness using an optimized high-speed industrial camera group. The target reference image set refers to the set of target reference images obtained after preprocessing the reference wire harness image set. The reference image feature set refers to the set of reference image features obtained by extracting features from the target reference image set. The wire harness defect detection model refers to a deep learning model obtained by training and constructing a model using deep learning methods on multiple reference wire harnesses and reference image feature sets.

[0246] S6. Based on the wire harness detection result set, realize synchronous detection of wire harness assembly defects.

[0247] Furthermore, the synchronous detection of wire harness assembly defects based on the wire harness inspection result set includes:

[0248] If the wire harness inspection result set contains one or more wire harness inspection results indicating defects, then the wire harness is considered a defective wire harness, and a pre-built robotic arm is used to remove the defective wire harness from the wire harness production line to obtain a defect-free wire harness production line.

[0249] If all the wire harness test results in the wire harness test result set are defect-free, then the wire harness is considered a qualified wire harness, and the qualified wire harness is transported using the wire harness production line to obtain the tested qualified wire harness.

[0250] Based on the aforementioned defect-free wire harness production line and the already inspected and qualified wire harnesses, synchronous detection of wire harness assembly defects is achieved.

[0251] It is clear that if the wire harness inspection result set contains one or more wire harness inspection results indicating defects, then the wire harness is considered a defective wire harness if, in the target wire harness image set obtained from different acquisition angles, at least one target wire harness image shows a defect. Optionally, an articulated robotic arm can be used as a pre-built robotic arm. Removing the defective wire harness from the wire harness production line means removing the defective wire harness from the wire harness production line so that it is not transported to the next outgoing inspection stage.

[0252] Understandably, if all the wire harness inspection results in the set are defect-free, it indicates that the wire harness is a qualified wire harness, meaning a wire harness without defects. Transporting qualified wire harnesses using the wire harness production line refers to transporting suitable wire harnesses to the next outgoing inspection stage, such as the quality inspection stage.

[0253] It is clear that achieving synchronous detection of assembly defects of wire harness based on the aforementioned defect-free wire harness production line and the tested and qualified wire harnesses refers to acquiring and preprocessing images of the wire harnesses, obtaining defect detection results through deep learning methods, and performing corresponding processing operations on the wire harnesses based on the defect detection results, thereby achieving synchronous detection of assembly defects of wire harnesses.

[0254] To address the problems described in the background art, this invention receives a defect detection command and, based on the command, identifies a defect detection environment. This environment includes a defect detection system and the wire harness to be inspected. The defect detection system comprises a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit. Therefore, before performing assembly defect detection on the wire harness, this invention considers the defect detection conditions under different environments. Thus, before performing assembly defect detection, the defect detection environment and the defect detection system for assembly defect detection are identified. Next, an image acquisition command is received from the wire harness image acquisition unit, and images of the wire harness are acquired based on this command to obtain an initial wire harness image set. This invention also considers the possibility of different detection results when performing defect detection on the wire harness at different angles. Therefore, by acquiring images of the wire harness at different acquisition angles, the obtained initial wire harness image set is more comprehensive, laying the foundation for subsequent assembly defect detection. Finally, an image processing command is received from the wire harness image processing unit, and based on the image processing... The instructions preprocess the initial wire harness image set to obtain the target wire harness image set. It is evident that this invention also considers that noise in the acquired initial wire harness image set may affect the defect detection results. Therefore, noise reduction, enhancement, and segmentation operations are performed on the initial wire harness images to improve the accuracy of assembly defect detection. The invention receives defect analysis instructions from the wire harness defect detection unit and extracts features from the target wire harness image set based on these instructions, obtaining an image feature set. Thus, when performing defect detection on the wire harness, this invention extracts the image feature set of the wire harness image through feature extraction, and then analyzes the image feature set using a pre-constructed deep learning method to obtain a wire harness detection result set. The wire harness detection result set includes multiple wire harness detection results, each corresponding one-to-one with the target wire harness image, and the detection result indicates the presence or absence of defects. This invention also considers the need for efficient and accurate defect detection of the wire harness. Therefore, deep learning is used for defect detection, making defect detection faster and more accurate. Thus, synchronous detection of wire harness assembly defects is achieved based on the wire harness detection result set. Therefore, the present invention can achieve accurate detection of defects in wire harness assembly.

[0255] like Figure 2 The diagram shown is a functional block diagram of a wire harness assembly defect synchronous detection system based on high-speed machine vision provided in an embodiment of the present invention.

[0256] The high-speed machine vision-based synchronous detection system 100 for wire harness assembly defects described in this invention can be installed in an electronic device. Depending on the functions implemented, the high-speed machine vision-based synchronous detection system 100 may include a detection environment verification module 101, a wire harness image acquisition module 102, a wire harness image processing module 103, and a wire harness defect analysis module 104. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, stored in the memory of the electronic device.

[0257] The detection environment confirmation module 101 is used to receive a defect detection command and confirm the defect detection environment based on the defect detection command. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit.

[0258] The wire harness image acquisition module 102 is used to receive an image acquisition instruction from the wire harness image acquisition unit, and perform image acquisition on the wire harness based on the image acquisition instruction to obtain an initial wire harness image set.

[0259] The wire harness image processing module 103 is used to receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set.

[0260] The wire harness defect analysis module 104 is used to receive defect analysis instructions from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instructions to obtain an image feature set group.

[0261] The image feature set is analyzed using a pre-built deep learning method to obtain a wire bundle detection result set. The wire bundle detection result set includes multiple wire bundle detection results, each of which corresponds one-to-one with the target wire bundle image. The wire bundle detection result indicates whether there is a defect or no defect.

[0262] Synchronous detection of wire harness assembly defects is achieved based on the wire harness inspection result set.

[0263] In detail, the modules in the high-speed machine vision-based synchronous detection system for wire harness assembly defects described in this embodiment of the invention employ the same methods as described above during use. Figure 1 The method used here is the same as the synchronous detection method for wire harness assembly defects based on high-speed machine vision, and can produce the same technical effect. It will not be repeated here.

[0264] like Figure 3The diagram shown is a structural schematic of an electronic device that implements a synchronous detection method for wire harness assembly defects based on high-speed machine vision, according to an embodiment of the present invention.

[0265] The electronic device 1 may include a processor 10, a memory 11 and a bus 12, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a method program for synchronous detection of wire harness assembly defects based on high-speed machine vision.

[0266] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as the portable hard drive of the electronic device 1. In other embodiments, the memory 11 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device 1. Furthermore, the memory 11 includes both internal storage units and external storage devices of the electronic device 1. The memory 11 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of a method for synchronous detection of wire harness assembly defects based on high-speed machine vision, but also to temporarily store data that has been output or will be output.

[0267] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., a synchronous detection method for wire harness assembly defects based on high-speed machine vision) and calls data stored in the memory 11 to perform various functions of the electronic device 1 and process data.

[0268] The bus 12 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 12 can be divided into an address bus, a data bus, a control bus, etc. The bus 12 is configured to realize the connection and communication between the memory 11 and at least one processor 10, etc.

[0269] Figure 3 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 3 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0270] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0271] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device 1 and other electronic devices.

[0272] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.

[0273] The program for synchronous detection of wire harness assembly defects based on high-speed machine vision, stored in the memory 11 of the electronic device 1, is a combination of multiple instructions. When run in the processor 10, it can achieve the following:

[0274] Receive a defect detection command, and confirm the defect detection environment based on the defect detection command. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit.

[0275] Receive an image acquisition command from the wire harness image acquisition unit, and acquire images of the wire harness based on the image acquisition command to obtain an initial wire harness image set;

[0276] Receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set;

[0277] Receive a defect analysis instruction from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instruction to obtain an image feature set group;

[0278] The image feature set is analyzed using a pre-built deep learning method to obtain a wire bundle detection result set. The wire bundle detection result set includes multiple wire bundle detection results, each of which corresponds one-to-one with the target wire bundle image. The wire bundle detection result indicates whether there is a defect or no defect.

[0279] Synchronous detection of wire harness assembly defects is achieved based on the wire harness inspection result set.

[0280] Specifically, the processor 10's implementation method for the above instructions can be found in [reference needed]. Figures 1 to 3 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.

[0281] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0282] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:

[0283] Receive a defect detection command, and confirm the defect detection environment based on the defect detection command. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit.

[0284] Receive an image acquisition command from the wire harness image acquisition unit, and acquire images of the wire harness based on the image acquisition command to obtain an initial wire harness image set;

[0285] Receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set;

[0286] Receive a defect analysis instruction from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instruction to obtain an image feature set group;

[0287] The image feature set is analyzed using a pre-built deep learning method to obtain a wire bundle detection result set. The wire bundle detection result set includes multiple wire bundle detection results, each of which corresponds one-to-one with the target wire bundle image. The wire bundle detection result indicates whether there is a defect or no defect.

[0288] Synchronous detection of wire harness assembly defects is achieved based on the wire harness inspection result set.

[0289] In the embodiments provided by this invention, it should be understood that the disclosed devices, systems, and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative, and actual implementations may have other classification methods.

[0290] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0291] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0292] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0293] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for synchronous detection of wire harness assembly defects based on high-speed machine vision, characterized in that, The method includes: Receive a defect detection command, and confirm the defect detection environment based on the defect detection command. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit. Receive an image acquisition command from the wire harness image acquisition unit, and acquire images of the wire harness based on the image acquisition command to obtain an initial wire harness image set; The step of acquiring images of the wire harness based on the image acquisition command to obtain an initial wire harness image set includes: The wire harness production line is obtained. A planar coordinate system is established in the wire harness production line with the preset acquisition position as the origin. The wire harness is monitored using a pre-built position sensor and the planar coordinate system to obtain the position of the wire harness. The distance difference is obtained based on the acquisition position and the wire harness position. When the distance difference is equal to the preset distance threshold, the high-speed industrial camera is identified based on the image acquisition command. When the distance difference is 0, the wire harness position corresponding to the distance difference is taken as the target wire harness position. The lighting device is obtained based on the target harness position; Multiple acquisition angles are acquired, and the following operations are performed on each of these acquisition angles. Acquiring multiple acquisition angles means identifying multiple acquisition angles around the wire harness. The acquisition angle refers to the angle between the high-speed industrial camera and the plane containing the wire harness. The integrity of the wire harness is obtained based on the acquisition angle and the high-speed industrial camera. The acquisition of the wire harness integrity based on the acquisition angle and the high-speed industrial camera means that the wire harness is image acquired at the acquisition angle, and the percentage of the area of ​​the wire harness in the image to the area of ​​the wire harness in the actual acquisition angle is calculated. The data is summarized and sorted in descending order of harness integrity to obtain a harness integrity sequence. The harness integrity sequence refers to the sequence obtained by sorting the harness integrity in descending order. Extract a preset number of wire harness integrity values ​​from the wire harness integrity value sequence to obtain the target wire harness integrity value set. Here, extracting a preset number of wire harness integrity values ​​from the wire harness integrity value sequence means extracting the first N wire harness integrity values ​​from the wire harness integrity value sequence, where N is equal to the preset number. The target acquisition angle is obtained by taking the acquisition angle corresponding to each target wire bundle integrity in the target wire bundle integrity set as the target acquisition angle. The target acquisition angle refers to the acquisition angle that can acquire the wire bundle image relatively completely. The high-speed industrial camera is optimized using the target acquisition angle set to obtain an optimized high-speed industrial camera group, wherein the optimized high-speed industrial camera group refers to a collection of multiple high-speed industrial cameras with different acquisition angles. Perform the following operations on each optimized high-speed industrial camera in the optimized high-speed industrial camera group: Obtain the set of lighting intensities from the lighting device, and perform the following operation on each lighting intensity in the set: By using an optimized high-speed industrial camera and lighting intensity, images of the wire harness at the target wire harness location are acquired to obtain a pre-confirmed wire harness image; Obtain the maximum and minimum grayscale values ​​in the pre-confirmed wire harness image, and obtain the target contrast based on the maximum and minimum grayscale values. The formula for obtaining the target contrast is as follows: Where D represents the target contrast. Indicates the maximum grayscale value. Indicates the minimum grayscale value; By summing up the target contrast ratios, a target contrast ratio set is obtained; The pre-confirmed harness image corresponding to the target with the largest contrast in the target contrast set is used as the initial harness image; By summarizing the initial wire harness images, an initial wire harness image set is obtained; Receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set; Receive a defect analysis instruction from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instruction to obtain an image feature set group; The image feature set is analyzed using a pre-built deep learning method to obtain a wire bundle detection result set. The wire bundle detection result set includes multiple wire bundle detection results, each of which corresponds one-to-one with the target wire bundle image. The wire bundle detection result indicates whether there is a defect or no defect. Synchronous detection of wire harness assembly defects is achieved based on the wire harness inspection result set.

2. The method for synchronous detection of wire harness assembly defects based on high-speed machine vision as described in claim 1, characterized in that, The step of preprocessing the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set includes: For each initial harness image in the initial harness image set, perform the following operation: Based on the image processing instructions, the initial wire harness image is transformed to grayscale to obtain a grayscale wire harness image; Obtain the pixels in the grayscale line bundle image to obtain the pixel set; The target grayscale value set is obtained based on the grayscale line bundle image and the pixel set, wherein each pixel corresponds to a target grayscale value. A noise reduction wire harness image is obtained based on the grayscale wire harness image and the target grayscale value set; An enhanced wire harness image is obtained based on the denoised wire harness image, and a target wire harness image is obtained based on the enhanced wire harness image; The target wire harness images are compiled to obtain a target wire harness image set.

3. The method for synchronous detection of wire harness assembly defects based on high-speed machine vision as described in claim 2, characterized in that, The step of obtaining the denoised wire harness image based on the grayscale wire harness image and the target grayscale value set includes: The grayscale line bundle image is scanned using a pre-constructed odd-numbered window to obtain a scanned image set; For each scanned image in the scanned image set, perform the following operation: Obtain a window grayscale value set based on the scanned image and the target grayscale value set; The window gray values ​​in the set of window gray values ​​are sorted in ascending order to obtain a window gray value sequence, and the window gray median is obtained based on the window gray value sequence. Obtain the center gray value in the scanned image; The updated center gray value is obtained by using the median gray value of the window as the center gray value. Based on the updated center gray value, obtain the updated window gray value set, and use the updated window gray value set as the window gray value set to obtain the updated scan image; By summing the updated scan images, an updated scan image set is obtained; Using the updated scan image set as the scan image set, a noise-reduced wire harness image is obtained.

4. The method for synchronous detection of wire harness assembly defects based on high-speed machine vision as described in claim 3, characterized in that, The step of obtaining the enhanced wire harness image based on the denoised wire harness image includes: The denoised wire harness image is divided using a pre-constructed partitioning window to obtain a partitioned image set; For each partitioned image in the partitioned image set, perform the following operation: Obtain the set of dividing pixels of the image, and obtain the set of dividing gray values ​​based on the set of dividing pixels, wherein the dividing pixels and the dividing gray values ​​correspond one-to-one. A partitioning histogram is obtained based on the partitioned pixel set and the partitioned gray value set, wherein the horizontal axis of the partitioning histogram is the partitioned gray value, and the vertical axis is the number of partitioned pixels corresponding to the partitioned gray value in the partitioned image. Based on the partitioning histogram, the number of partitioning pixels corresponding to each partitioning gray value is obtained to obtain a gray value set. Based on the gray value set and a preset cropping threshold, an updated partitioning histogram is obtained. By summarizing the updated partition histograms, an updated partition histogram set is obtained; An updated partitioned image set is obtained based on the updated partitioned histogram set, and an enhanced wire harness image is obtained based on the updated partitioned image set.

5. The method for synchronous detection of wire harness assembly defects based on high-speed machine vision as described in claim 4, characterized in that, The step of obtaining and updating the partitioning histogram based on the grayscale pixel value set and a preset cropping threshold includes: For each grayscale pixel value in the grayscale pixel value set, perform the following operation: The grayscale pixel value is compared with the cropping threshold. If the grayscale pixel value is less than or equal to the cropping threshold, the grayscale value corresponding to the grayscale pixel value is used as the preprocessed grayscale value. If the grayscale pixel value is greater than the cropping threshold, the difference between the grayscale pixel value and the cropping threshold is calculated to obtain the excess pixel value. The first updated grayscale pixel value is obtained by using the cropping threshold as the grayscale pixel value. The preprocessed grayscale values ​​and the first updated grayscale pixel values ​​are summarized respectively to obtain the preprocessed grayscale value set and the first updated grayscale pixel value set; Sum the values ​​of the excess pixels to obtain the total target pixel value; Preprocessed gray values ​​are sequentially extracted from the preprocessed gray value set, and the following operations are performed on the extracted preprocessed gray values: Pixel allocation values ​​are obtained based on the extracted preprocessed grayscale values, cropping threshold, and target total pixel values. Second updated grayscale pixel values ​​are obtained based on the grayscale pixel values ​​corresponding to the extracted preprocessed grayscale values ​​and the pixel allocation values. The second updated grayscale pixel values ​​are summarized to obtain the second updated grayscale pixel value set, wherein all the second updated grayscale pixel values ​​in the second updated grayscale pixel value set are less than or equal to the cropping threshold. An updated partitioning histogram is obtained based on the first updated grayscale pixel value set and the second updated grayscale pixel value set. The method for obtaining the number of partitioning pixels corresponding to the partitioning grayscale values ​​in the updated partitioning histogram is as follows: in, This indicates updating the grayscale values ​​in the partition histogram. The corresponding number of pixels to be divided, Indicates the clipping threshold. Indicates the division of grayscale values grayscale pixel values, This represents the pixel allocation value.

6. The method for synchronous detection of wire harness assembly defects based on high-speed machine vision as described in claim 5, characterized in that, The step of obtaining the target wire harness image based on the enhanced wire harness image includes: The enhanced harness image is divided using a segmentation window to obtain multiple segmented enhanced images; Sequentially extract segmentation enhancement images from the plurality of segmentation enhancement images, and perform the following operations on the extracted segmentation enhancement images: A first grayscale threshold is obtained based on the extracted segmented enhanced image, wherein the first grayscale threshold is the average of the largest segmented grayscale value and the smallest segmented grayscale value in the segmented enhanced image. Pixels are extracted sequentially from the extracted segmented and enhanced image to obtain enhanced pixels, and the following operations are performed on the enhanced pixels: Compare the grayscale value corresponding to the enhanced pixel with the first grayscale threshold; If the grayscale value corresponding to the enhanced pixel is greater than or equal to the first grayscale threshold, then the grayscale value corresponding to the enhanced pixel is identified as the first grayscale value. If the gray value corresponding to the extracted enhanced pixel is less than the first gray value threshold, then the gray value corresponding to the enhanced pixel is identified as the second gray value. The first grayscale value and the second grayscale value are summarized respectively to obtain the first grayscale value set and the second grayscale value set; The first gray value mean and the second gray value mean are obtained based on the first gray value set and the second gray value set; The second grayscale threshold is obtained by using the first grayscale mean and the second grayscale mean as the maximum and minimum dividing grayscale values, respectively. Calculate the absolute difference between the first grayscale threshold and the second grayscale threshold to obtain the grayscale difference. The grayscale difference is compared with a preset grayscale threshold. If the grayscale difference is greater than the grayscale threshold, a second grayscale threshold is used as the first grayscale threshold, and the process returns to the step of sequentially extracting pixels from the extracted segmented enhanced image until the grayscale difference is less than or equal to the grayscale threshold. Then, enhanced pixels are sequentially extracted from the extracted segmented enhanced image, and the following operations are performed on the extracted enhanced pixels: Compare the segmentation gray value corresponding to the extracted enhanced pixel with the target gray threshold, where the target gray threshold is the average of the first gray threshold and the second gray threshold; If the grayscale value corresponding to the enhanced pixel is less than the target grayscale threshold, then the grayscale value corresponding to the enhanced pixel is assigned to 0. Otherwise, assign the grayscale value corresponding to the enhanced pixel to 255; The updated segmentation enhancement image is obtained based on the assigned segmentation grayscale values, and the target wire harness image is obtained based on the updated segmentation enhancement image.

7. The method for synchronous detection of wire harness assembly defects based on high-speed machine vision as described in claim 6, characterized in that, The feature extraction of the target wire harness image set based on the defect analysis command yields an image feature set group, including: For each target harness image in the target harness image set, perform the following operation: Based on the defect analysis instructions, the OpenCV software tool was identified. The target wire harness image was analyzed using the OpenCV software tool to obtain a white outline; Find the smallest bounding rectangle of the white outline; The number of pixels with a grayscale value of 255 in the target wire bundle image is counted to obtain the white pixel value; The image feature set is defined by the white outline, the minimum bounding rectangle, and the white pixel values. The image feature sets are summarized to obtain the image feature set group.

8. The method for synchronous detection of wire harness assembly defects based on high-speed machine vision as described in claim 7, characterized in that, The synchronous detection of wire harness assembly defects based on the wire harness inspection result set includes: If the wire harness inspection result set contains one or more wire harness inspection results indicating defects, then the wire harness is considered a defective wire harness, and a pre-built robotic arm is used to remove the defective wire harness from the wire harness production line to obtain a defect-free wire harness production line. If all the wire harness test results in the wire harness test result set are defect-free, then the wire harness is considered a qualified wire harness, and the qualified wire harness is transported using the wire harness production line to obtain the tested qualified wire harness. Based on the aforementioned defect-free wire harness production line and the already inspected and qualified wire harnesses, synchronous detection of wire harness assembly defects is achieved.

9. A synchronous detection system for wire harness assembly defects based on high-speed machine vision, characterized in that, The system includes: The detection environment confirmation module is used to receive defect detection instructions and confirm the defect detection environment based on the defect detection instructions. The defect detection environment includes a defect detection system and a wire harness to be detected. The defect detection system includes a wire harness image acquisition unit, a wire harness image processing unit, and a wire harness defect detection unit. The wire harness image acquisition module is used to receive image acquisition instructions from the wire harness image acquisition unit, and to acquire images of the wire harness based on the image acquisition instructions to obtain an initial wire harness image set. The step of acquiring images of the wire harness based on the image acquisition command to obtain an initial wire harness image set includes: The wire harness production line is obtained. A planar coordinate system is established in the wire harness production line with the preset acquisition position as the origin. The wire harness is monitored using a pre-built position sensor and the planar coordinate system to obtain the position of the wire harness. The distance difference is obtained based on the acquisition position and the wire harness position. When the distance difference is equal to the preset distance threshold, the high-speed industrial camera is identified based on the image acquisition command. When the distance difference is 0, the wire harness position corresponding to the distance difference is taken as the target wire harness position. The lighting device is obtained based on the target harness position; Multiple acquisition angles are acquired, and the following operations are performed on each of these acquisition angles. Acquiring multiple acquisition angles means identifying multiple acquisition angles around the wire harness. The acquisition angle refers to the angle between the high-speed industrial camera and the plane containing the wire harness. The integrity of the wire harness is obtained based on the acquisition angle and the high-speed industrial camera. The acquisition of the wire harness integrity based on the acquisition angle and the high-speed industrial camera means that the wire harness is image acquired at the acquisition angle, and the percentage of the area of ​​the wire harness in the image to the area of ​​the wire harness in the actual acquisition angle is calculated. The data is summarized and sorted in descending order of harness integrity to obtain a harness integrity sequence. The harness integrity sequence refers to the sequence obtained by sorting the harness integrity in descending order. Extract a preset number of wire harness integrity values ​​from the wire harness integrity value sequence to obtain the target wire harness integrity value set. Here, extracting a preset number of wire harness integrity values ​​from the wire harness integrity value sequence means extracting the first N wire harness integrity values ​​from the wire harness integrity value sequence, where N is equal to the preset number. The target acquisition angle is obtained by taking the acquisition angle corresponding to each target wire bundle integrity in the target wire bundle integrity set as the target acquisition angle. The target acquisition angle refers to the acquisition angle that can acquire the wire bundle image relatively completely. The high-speed industrial camera is optimized using the target acquisition angle set to obtain an optimized high-speed industrial camera group, wherein the optimized high-speed industrial camera group refers to a collection of multiple high-speed industrial cameras with different acquisition angles. Perform the following operations on each optimized high-speed industrial camera in the optimized high-speed industrial camera group: Obtain the set of lighting intensities from the lighting device, and perform the following operation on each lighting intensity in the set: By using an optimized high-speed industrial camera and lighting intensity, images of the wire harness at the target wire harness location are acquired to obtain a pre-confirmed wire harness image; Obtain the maximum and minimum grayscale values ​​in the pre-confirmed wire harness image, and obtain the target contrast based on the maximum and minimum grayscale values. The formula for obtaining the target contrast is as follows: Where D represents the target contrast. Indicates the maximum grayscale value. Indicates the minimum grayscale value; By summing up the target contrast ratios, a target contrast ratio set is obtained; The pre-confirmed harness image corresponding to the target with the largest contrast in the target contrast set is used as the initial harness image; By summarizing the initial wire harness images, an initial wire harness image set is obtained; The wire harness image processing module is used to receive image processing instructions from the wire harness image processing unit, and preprocess the initial wire harness image set based on the image processing instructions to obtain the target wire harness image set. The wire harness defect analysis module is used to receive defect analysis instructions from the wire harness defect detection unit, and extract features from the target wire harness image set based on the defect analysis instructions to obtain an image feature set group. The image feature set is analyzed using a pre-built deep learning method to obtain a wire bundle detection result set. The wire bundle detection result set includes multiple wire bundle detection results, each of which corresponds one-to-one with the target wire bundle image. The wire bundle detection result indicates whether there is a defect or no defect. Synchronous detection of wire harness assembly defects is achieved based on the wire harness inspection result set.

Citation Information

Patent Citations

  • A wire harness connector wire arrangement quality detection method based on depth learning YOLO algorithm

    CN109003271A

  • High-precision wire harness defect intelligent detection system

    CN119023677A

  • Wire harness installation path real-time adjustment system and method based on machine vision

    CN120219298A