Method, device and storage medium for measuring length of multi-branch complex cable

By employing multi-angle exposure image fusion, SAM model segmentation, and parallel thinning algorithm fitting compensation, the accuracy and automation issues of complex multi-branch cable length measurement were solved, achieving high-precision cable length measurement and intelligent production inspection.

CN119444827BActive Publication Date: 2025-11-25TSINGHUA UNIVERSITY
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411420445.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2024-04-09
Filing Date
2024-10-12
Publication Date
2025-11-25
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately measure the length of complex, multi-branched cables, particularly due to issues such as low measurement accuracy, long measurement time, and insufficient automation.

Method used

Multi-angle exposure image fusion technology is used to enhance cable image details. Interactive segmentation is performed using the SAM model. A parallel thinning algorithm is used to extract skeleton lines and perform fitting compensation. Finally, the cable branch length is calculated using the micro-element method.

Benefits of technology

It improves the accuracy and automation of length measurement for complex multi-branch cables, and realizes intelligent manufacturing and testing processes for complex cables.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444827B_ABST
    Figure CN119444827B_ABST
Patent Text Reader

Abstract

The disclosure provides a kind of multi-branch complex cable length measurement method, comprising: obtaining the multiple images of the multi-branch complex cable to be measured with different exposure properties, inputting the image sequence into the image surface enhancement model to obtain a fused cable image;Using SAM model and prompt information to segment each cable branch in the fused cable image;The contour line of each cable branch segmented is extracted, and the skeleton line of each cable branch is extracted based on parallel thinning method, to obtain the end missing skeleton line corresponding to each cable branch, and each end missing skeleton line is fitted and compensated to obtain the complete skeleton line of each cable branch;The pixel length of the complete skeleton line of each cable branch is calculated, and the actual length of each cable branch is calculated accordingly.The disclosure completes the measurement of the length of multi-branch complex cable based on machine vision, which can improve the measurement accuracy and realize the automation and intelligentization of complex cable manufacturing and detection process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure pertains to the field of machine vision, and specifically relates to a method, apparatus, and storage medium for measuring the length of complex multi-branch cables. Background Technology

[0002] Complex multi-branch cables are mainly used in industrial fields such as automobiles and aerospace, and their structure is as follows: Figure 1 As shown. Taking automobiles as an example, cables are one of the core components connecting and supporting various parts inside the car. They also serve as energy and information transmission channels, ensuring the stable operation of the vehicle. The importance of cables in the modern automotive industry cannot be underestimated. They connect various subsystems within the car, and if cables cannot operate safely and stably, the impact on the car will be catastrophic. In modern automobiles, due to the increasing number of electronic devices, the functions of various subsystems place different demands on the structure and performance of cables, leading to a continuous increase in the complexity of automotive cables and the need for various high-performance cables and connectors. Therefore, automotive cables play a crucial role in vehicle manufacturing and maintenance. As the structures and functions of modern industrial products such as automobiles and spacecraft become increasingly complex, the cable structures used in them also become increasingly complex, often exhibiting multi-branch configurations. Therefore, cable dimensional measurement is an indispensable and important step in the assembly and testing process. The existing technologies for cable measurement mainly include the following:

[0003] 1. Manual measurement method

[0004] Workers must lay the cable flat, manually straighten the flexible cable, measure its key dimensions using a measuring tape, and manually record the data. The complexity of a single cable increases, as does the time required for each measurement. If a single cable is long, the space it occupies after straightening is also large, making measurement difficult. Furthermore, the complex branches of the cable also pose challenges to dimensional measurement. Manually completing the measurement task is difficult and time-consuming, delaying the cable development cycle. The repetitive measurement work also causes visual fatigue for the workers, affecting the accuracy of the dimensional measurements and reducing the reliability of the results.

[0005] 2. Pulse-echo method

[0006] Measuring cable length using the propagation and reflection of electromagnetic waves is dependent on the properties of the cable itself. Patent applications such as CN202210174914.4, CN202311063941.5, and CN202211011797.6 all involve designing steps such as transmitting signals, receiving return signals, and calculations to ultimately achieve non-destructive, high-precision cable length measurement. However, the objects measured are all high-voltage long cables in power systems, which can be considered as measuring the length of a single cable. For complex cables with complex structures and many branches, the pulse reflection method is difficult to achieve high accuracy.

[0007] 3. Visual measurement method

[0008] Visual measurement is a method for obtaining cable length through image acquisition and processing. Among the various publicly disclosed machine vision dimensional measurement technologies, the measurement of complex, curved, multi-branched cables is scarce. For example, patent CN202221266241.7 uses a visual method to measure cable length, and patent CN201910797869.6 uses a visual method to accurately measure the cut length of cables. However, these patents are not applicable to the length measurement of complex cables with curved and multi-branched characteristics. The application objects of other methods differ significantly from the cables in this invention, and the measured object is in motion. The cables targeted in this invention are curved and multi-branched. The machine vision-based dimensional measurement system mainly includes an image acquisition system, image region extraction, and dimensional measurement algorithms. The image acquisition system includes camera selection, deployment, and calibration. Image region extraction should employ image segmentation methods. The dimensional measurement algorithm varies depending on the characteristics of the object being measured. Currently, most vision-based length measurement methods measure the distance between two points, which is not used for complex, multi-branched cables with bending characteristics. Among these, the skeleton line extraction algorithm is of significant reference value for cable dimensional measurement. Because the skeleton line effectively identifies important features of an object, and because of the special shape of cables and the fact that length measurement usually does not need to consider cable width, while the skeleton line typically runs through the entire cable, the measurement of the skeleton line can be used as an important standard for evaluating cable length.

[0009] In summary, both manual measurement and pulse-echo methods are unsuitable for cables due to accuracy limitations caused by their bending and multi-branching characteristics. Machine vision-based dimensional measurement, as a crucial technology in intelligent manufacturing, offers significant advantages in measuring the length of complex, multi-branched cables. However, due to the complexity of cable structures, commonly used skeleton line extraction algorithms suffer from incomplete, discontinuous, and erroneous skeleton lines. Therefore, there is an urgent need to develop a technical solution for length measurement of complex cables with bending and multi-branching characteristics. Summary of the Invention

[0010] This disclosure aims to at least partially address one of the technical problems in the related art.

[0011] To this end, this disclosure proposes a method, device, and storage medium for measuring the length of multi-branch complex cables. The method and device are based on machine vision to measure the length of multi-branch complex cables, thereby improving measurement accuracy and realizing the automation and intelligence of the manufacturing and testing process of complex cables.

[0012] To achieve the above objectives, the present disclosure adopts the following technical solution:

[0013] The first aspect of this disclosure provides a method for measuring the length of a multi-branch complex cable, comprising:

[0014] Multiple images of a complex multi-branch cable under test with different exposure properties are acquired, and these images are used to form an image sequence. The input image sequence is then fused to enhance the surface details of the images, resulting in a fused cable image.

[0015] The SAM model and prompting information are used to segment each cable branch in the fused cable image;

[0016] The outline of each segmented cable branch is extracted, and the skeleton line of each cable branch is extracted based on the parallel thinning method. The skeleton lines missing at the ends of each cable branch are obtained. The missing skeleton lines at the ends are fitted and compensated. The two intersection points of each fitted skeleton line and the outline of the corresponding cable branch are taken as the two ends of the complete skeleton line of the cable branch, thus obtaining the complete skeleton line of each cable branch.

[0017] Calculate the pixel length of the complete skeleton line for each cable branch, and then calculate the actual length of each cable branch based on this pixel length.

[0018] In some embodiments, multiple images of a complex multi-branch cable under test with different exposure properties are acquired by an image acquisition device;

[0019] The image acquisition device includes an imaging unit and an illumination unit. The imaging unit includes an industrial camera. The illumination unit uses a combination of backlighting and frontlighting. The backlighting is provided by an LED light board, which also serves as a working plane for placing the complex multi-branch cable under test. The frontlighting is provided by the flash unit built into the industrial camera.

[0020] In some embodiments, the exposure attributes include exposure angle and exposure intensity.

[0021] In some embodiments, the image surface enhancement model employs a MEF-Net network based on unsupervised learning.

[0022] In some embodiments, a public dataset and multi-angle exposure images of cable components are used together as the training set for the image surface enhancement model.

[0023] In some embodiments, the segmentation of each cable branch in the fused cable image using the SAM model and prompting information specifically includes:

[0024] S21. Set selection point prompts, where positive points are set to select cable branches that need to be split, and negative points are set to areas that do not need to be split;

[0025] S22. Based on the point selection prompts, iterative segmentation results are generated using the SAM model;

[0026] S23. If a complete segment exists in the iterative segmentation results, save the result; if no complete segment exists in the iterative segmentation results, select one of the iterative segmentation results as the basis and provide iterative suggestions, that is, segment by selecting more suggestion points.

[0027] S24. Based on the iteration prompts in step S23, generate more accurate segmentation results;

[0028] S25. If the segmentation result obtained in step S24 does not meet the set accuracy requirements, repeat the iterative process of steps S21 to S24 until the segmentation result meets the set accuracy requirements, and save the final segmentation result.

[0029] In some embodiments, the number or method of setting the selection point prompts should meet the requirement of being able to completely separate a single cable branch.

[0030] In some embodiments, the specific steps for obtaining the complete skeleton wire of each cable branch include:

[0031] S31. Extract the outlines of each segmented individual cable branch to obtain the continuous outline of each individual cable branch.

[0032] S32. The images of each segmented cable branch are binarized and eroded. Then, the skeleton lines of each single cable branch are extracted by a parallel thinning method to obtain the skeleton lines of the missing ends of each cable branch.

[0033] S33. Using a polynomial fitting method, the missing skeleton lines at the ends corresponding to each cable branch obtained in step S32 are fitted to achieve the effect of extension. The fitted lines of the cable skeleton lines and the cable outline lines are drawn in the same figure.

[0034] S34. Traverse and obtain the two intersection points of the cable outline and the fitted line of the skeleton line. Use the intersection points as the two endpoints of the fitted line to obtain a new fitted line. The new fitted line is the complete skeleton line.

[0035] The second aspect of this disclosure provides a measuring device for the length of a multi-branch complex cable, comprising:

[0036] The image acquisition module is used to acquire multiple images of a complex multi-branch cable under test with different exposure properties and to form an image sequence.

[0037] The image fusion module contains an image surface enhancement model, which is used to fuse the input image sequence, enhance the surface details of the image, and obtain a fused cable image.

[0038] The cable branch segmentation module is used to segment each cable branch in the fused cable image using the SAM model and prompt information;

[0039] The skeleton line extraction module is used to extract the contour lines of each segmented cable branch, and extract the skeleton lines of each cable branch based on the parallel thinning method to obtain the skeleton lines missing at the ends of each cable branch. The missing skeleton lines at the ends are fitted and compensated, and the two intersection points of each fitted skeleton line and the contour line of the corresponding cable branch are taken as the two ends of the complete skeleton line of the cable branch, thus obtaining the complete skeleton line of each cable branch.

[0040] The cable branch length calculation module is used to calculate the pixel length of the complete skeleton line of each cable branch, and calculate the actual length of each cable branch based on the pixel length.

[0041] A computer-readable storage medium is provided in the third aspect of this disclosure, the computer-readable storage medium storing computer instructions for causing the computer to perform a method for measuring the length of a multi-branch complex cable according to any embodiment of the first aspect of this disclosure.

[0042] This disclosure has the following characteristics and beneficial effects:

[0043] This disclosure utilizes multi-angle exposure image fusion to enhance the surface details of complex multi-branched cables, which is beneficial for subsequent image segmentation processing. It adopts an interactive image segmentation method for single branches of complex multi-branched cables to segment single cable images, solving the measurement strategy problem of complex multi-branched cables. For single branches, a parallel thinning algorithm is used to extract skeleton lines and perform fitting compensation. Finally, the length is calculated using the infinitesimal method, thereby improving the accuracy of single branch length measurement.

[0044] In summary, this disclosure utilizes machine vision to measure the length of complex multi-branch cables, which can improve measurement accuracy and automate and intelligentize the manufacturing and testing processes of complex cables. Attached Figure Description

[0045] Figure 1 This is a schematic diagram of a complex multi-branch cable.

[0046] Figure 2 This is an overall flowchart of a method for measuring the length of a complex branched cable provided in the first aspect of this disclosure.

[0047] Figure 3 This is a flowchart illustrating the specific process of single-branch cable segmentation based on iterative prompts in a method for measuring the length of a complex branched cable provided in the first aspect of this disclosure.

[0048] Figure 4 This is a flowchart illustrating the extraction, fitting, and compensation of a single skeleton line in a method for measuring the length of a complex branched cable, as provided in the first aspect of this disclosure.

[0049] Figure 5 Figures (a), (b), and (c) show the results of the extraction and compensation of the skeleton line of a single cable branch in this embodiment, respectively.

[0050] Figure 6 A schematic diagram of the structure of an electronic device provided in a third aspect embodiment of this disclosure. Detailed Implementation

[0051] To make the objectives, technical solutions, and advantages of this application clearer, the application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for explaining this application and are not intended to limit this application.

[0052] Conversely, this application covers any alternatives, modifications, equivalent methods, and schemes made within the spirit and scope of this application as defined by the claims. Furthermore, to provide the public with a better understanding of this application, certain specific details are described in detail below. However, this application can be fully understood by those skilled in the art even without these detailed descriptions.

[0053] In the description of this disclosure, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are used only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the foundation or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this disclosure, "a plurality of" means two or more, unless otherwise explicitly specified.

[0054] In the description of this disclosure, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this disclosure according to the specific circumstances.

[0055] In this disclosure, unless otherwise expressly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.

[0056] See Figure 2 The first aspect of this disclosure provides a method for measuring the length of a complex multi-branch cable, comprising the following steps:

[0057] S1. Acquire multiple images of a complex multi-branch cable under test with different exposure properties, and input them into an image surface enhancement model to fuse the input image sequence, enhance the surface details of the image, and obtain a fused cable image.

[0058] S2. Use the SAM model and prompts to segment each cable branch in the fused cable image obtained in step S1.

[0059] S3. Extract the outline of each cable branch obtained from step S2, and extract the skeleton line of each cable branch based on the parallel thinning method to obtain the skeleton line missing at the end of each cable branch. Fit and compensate for the missing skeleton line at each end, and take the two intersection points of each fitted skeleton line and the outline of the corresponding cable branch as the two ends of the complete skeleton line of the cable branch, so as to obtain the complete skeleton line of each cable branch.

[0060] S4. Calculate the pixel length of the complete skeleton line of each cable branch, and calculate the actual length of each cable branch based on the pixel length.

[0061] In some embodiments, in step S1, multiple images of a complex multi-branch cable under test with different exposure properties are acquired by an image acquisition device.

[0062] Furthermore, in this embodiment, the image acquisition device includes an imaging unit and an illumination unit. The imaging unit includes an industrial camera with an imaging resolution of 3840×2748 and an 8mm fixed-focus telecentric lens. The industrial camera is fixed by a bracket, and its axis is perpendicular to the horizontal plane and the object surface. A working distance of at least 100mm is maintained between the industrial camera and the complex multi-branch cable under test. The illumination unit adopts a combination of backlighting and frontlighting. Backlighting is provided by an LED light board, which also serves as the working plane on which the complex multi-branch cable under test is placed. Backlighting obtains a clear edge of the complex multi-branch cable under test, suitable for cable length measurement. Frontlighting is provided by the flash built into the industrial camera, ensuring the acquisition of surface detail images. The camera's intrinsic parameters are calibrated using a standard calibration plate, and the actual length per unit pixel, i.e., pixel equivalent, is obtained.

[0063] Furthermore, the exposure attributes defined in this embodiment include exposure angle and exposure intensity, etc.

[0064] In many machine vision-based dimensional measurement systems, image preprocessing typically involves simple filtering or binarization. However, in step S1 of this disclosure, a complex cable image fusion method based on multi-angle exposure is used as the preprocessing method to enhance cable surface details and lay the foundation for optimizing measurement results. Multi-image methods are an important aspect of image processing, and multi-exposure fusion is one of the most representative. Its basic idea is to input the same image with different exposure attributes (exposure angle, exposure intensity, etc.) and finally output a fused single image, which possesses richer details and colors.

[0065] Preferably, considering the need to minimize measurement time, this embodiment employs the MEF-Net network (Ma K, Duanmu Z, Zhu H, et al. Deep guided learning for fast multi-exposure image fusion[J]. IEEE Transactions on Image Processing, 2020, 29: 2808–2819.) based on unsupervised learning as the image surface enhancement model. This network has a particularly prominent advantage in fusion time. The MEF-Net network consists of a bilinear downsampler, a context feature prediction network (ContextAggregationNet, CAN), a guided filter, and a weighted fusion module. The bilinear downsampler is used to downsample the input image sequence to obtain a low-resolution multi-angle exposure image input sequence. CAN, as the core module of the MEF-Net network, is specifically a convolutional network used to convert the low-resolution multi-angle exposure image input sequence into a corresponding weight map. The MEF-Net network requires allowing images of arbitrary size and the number of exposures, generating feature maps of corresponding size and number. Finally, a weight map is fused using a guided filter. In the weighted fusion module, the input original image sequence is weighted and fused with the weight map. The fusion formula is as follows:

[0066]

[0067] In the formula, Y represents the fused image, and W k This represents the image sequence X obtained in step S1. k The weighted graph is shown, where ⊙ represents the Hadamard product.

[0068] The MEF-Net network is optimized using a loss function based on SSIM(x,y), which primarily considers the structural information of the image. Its calculation formula is as follows:

[0069]

[0070] In the formula, x and y represent two images, and μ x and μ y σ represents the average intensity of the two images, respectively. x and σ y Let σ represent the local variance of image x and image y, respectively. z Let C1 and C2 represent the covariance between image x and image y, and C1 and C2 represent two small constants used to maintain stability.

[0071] This embodiment uses a public dataset and multi-angle exposure images of cable components as the training set to train the optimal MEF-Net network as the image surface enhancement model. By inputting complex cable images exposed from multiple angles, a detailed cable image is finally fused to improve the subsequent segmentation effect. The aspect ratio of the images before and after fusion remains unchanged.

[0072] Considering the complexity of multi-branched cables, extracting the entire skeleton line would lead to problems such as extraction errors, incomplete ends, and burrs on the skeleton line. Therefore, image segmentation methods will be used to segment individual cable branches, which places extremely high demands on the dataset. Thus, step S2 of this embodiment employs the Segment-Anything Model (SAM model, Kirillov A, Mintun E, Ravi N, et al. Segment anything[J]. arXiv preprint arXiv:2304.02643,2023.), using point selection iteration prompts to complete the segmentation of cable branches in the fused cable image obtained in step S1.

[0073] Specifically, the SAM model is a relatively new image segmentation foundation model with zero-sample transfer capability and strong generalization performance. It can guide image segmentation through interactive prompts. The SAM model structure includes a prompt decoder, an image decoder, and a lightweight mask decoder. By inputting an image and corresponding prompts, a mask for the segmented image can be obtained. The prompts can be in the form of single points, multi-points, bounding boxes, masks, or text, or a combination of multiple methods. In this embodiment, multi-points are selected as the prompt method, with positive points selecting the main body of the cable branch and negative points selecting unwanted areas. In addition, the SAM model has an iterative prompting mechanism, that is, the segmentation mask of the current segmentation can be used as the input for the next segmentation. Furthermore, by setting it to obtain one or three results per segmentation, where the three results can each point to three different valid objects. If it is set to obtain only one result, the result with the highest accuracy among the three results is obtained. Step S2 of this embodiment is based on the SAM model and formulates an interactive segmentation strategy for complex multi-branch cables, see [link to relevant documentation]. Figure 3 The interactive segmentation steps are as follows:

[0074] S21. Set selection point prompts: Select a cable branch that needs to be split by selecting points. Positive points are set to select a cable branch that needs to be split, and negative points are set to areas that do not need to be split. You can set a single positive or negative point or multiple positive or negative points. The number or method of selection point prompts should meet the requirement of being able to completely split a single cable branch. If the selection point prompts are insufficient, a single branch cannot be completely split.

[0075] S22. Generate three prediction results: Based on the point selection prompts, three iterative segmentation results are generated through the SAM model;

[0076] S23. Save segmentation results or iterative hints: If there is a complete segmentation in the iterative segmentation results, you can choose to save the results; if there is no complete segmentation, you can choose one of the results (represented in the form of a mask) as the basis for iterative hints, that is, to perform segmentation by selecting more hint points (the selection method is random).

[0077] S24. Generate new prediction results: Based on the iterative prompts in step S23, generate more accurate segmentation results.

[0078] S25. If the segmentation result obtained in step S24 does not meet the set accuracy requirements, repeat the iterative process of steps S21 to S24 until the segmentation result meets the set accuracy requirements, and save the final segmentation result.

[0079] In some embodiments, see Figure 4 Step S3 specifically includes:

[0080] S31. Extract the contour lines of each individual cable branch obtained in step S2 (in this embodiment, the findContours function in OpenCV is used for contour line extraction) to obtain the continuous contour lines of each individual cable branch.

[0081] S32. The image of the single cable branch obtained in step S2 is binarized using a threshold segmentation method, and then erosion is performed. Subsequently, the skeleton lines of each single cable branch are extracted using the parallel thinning method proposed by Zhang et al., resulting in the skeleton lines corresponding to the missing ends of each cable branch. (See [link to relevant documentation]). Figure 5 In (a), the white thin line is the skeleton line with missing ends obtained in this step. The area enclosed by the white line is the continuous outline of the single cable branch obtained in step S31. It can be seen that the two ends of the skeleton line are slightly shorter than the two ends of the cable branch outline.

[0082] S33. Using a polynomial fitting method, the missing skeleton lines at the ends corresponding to each cable branch obtained in step S32 are fitted to achieve an extension effect. The fitted lines of the cable skeleton lines are drawn on the same graph as the cable outline. (See figure) Figure 5 In (b), the white thin line is the extension of the skeleton line of the single cable branch obtained in this step, and the area enclosed by the white line is the continuous outline of each single cable branch obtained in step S31.

[0083] S34. Traverse and obtain the two intersection points of the cable outline and the fitted line of the skeleton line. Use the intersection points as the two endpoints of the fitted line to obtain a new fitted line. This fitted line is the complete skeleton line. See [link to documentation]. Figure 5 In (c), the thin white line is the complete skeleton line of the single cable branch obtained in this step. The area enclosed by the white line is the continuous outline of each single cable branch obtained in step S31. It can be seen that the end of the skeleton line has been completed.

[0084] Furthermore, the parallel thinning algorithm used in step S32 was proposed by Zhang et al. in 1984 (Zhang TY, Suen CY. A fast parallel algorithm for thinning digital patterns[J]. Communications of the ACM, 1984, 27(3):236–239.). It mainly utilizes the idea of ​​iterative deletion to extract the skeleton lines of the target. The steps are as follows:

[0085] S321. Delete point P1 that satisfies the following formula, where the foreground point in the segmentation result obtained in step S2 is marked as 1 and the background point is marked as 0. N(P1) represents the number of foreground points among the 8 pixels adjacent to point P1. These 8 pixels are evenly distributed around point P1. The pixels located directly above, to the upper right, to the right, to the lower right, directly below, to the lower left, to the left, and to the upper left of point P1 are respectively recorded as P2, P3, P4, P5, P6, P7, P8, and P9. The arrangement of each point is shown in Table 1. S(P1) represents the number of times the 8 neighboring points of point P1 change from the background point to the foreground point (0→1) in a clockwise direction (P2→P9).

[0086]

[0087] Table 1

[0088] [P9] [P2] [P3] [P8] [P2] [P4] [P7] [P6] [P5]

[0089] S322. Similar to step S321, delete point P1 that satisfies the following formula;

[0090]

[0091] S323. Traverse all foreground points and repeat steps S321 and S322 to finally obtain a skeleton line with a single pixel width.

[0092] Since the thinning algorithm is based on morphological operations, the extracted skeleton lines will be missing at both ends, resulting in incompleteness. That is, the skeleton lines of each cable branch extracted by the parallel thinning method have missing ends. Therefore, the embodiments of this disclosure use polynomial fitting to compensate for the integrity of the skeleton lines and obtain complete skeleton lines.

[0093] In some embodiments, step S4 uses the infinitesimal method to calculate the pixel length of the complete skeleton line of each cable branch. The principle is to obtain the coordinates of the complete skeleton line through curve search, calculate the length of the micro-segments in the curve, and finally accumulate them to obtain the pixel length of the branch. The formula for calculating the micro-segment is as follows:

[0094]

[0095] Among them, l i Let Δx represent the length of the i-th micro-segment. i Δy i Let x represent the width and height of the i-th micro-segment, respectively. si With y si Let x and y be the x and y coordinates of the first endpoint of the i-th micro-segment, respectively. ti With y ti Let x and y represent the x and y coordinates of the endpoint of the i-th micro-segment, respectively.

[0096] By sampling at reasonable intervals (the number of interval samples is set to 10 in this embodiment, but can be set to other interval samples according to accuracy requirements), the actual length of a single cable can be quickly and accurately calculated by multiplying the pixel length by the pixel equivalent. Through segmentation loops, the length of each branch of the cable can finally be obtained.

[0097] It is understood that the embodiments of this disclosure, through a mixed illumination scheme of forward and backward illumination, construct a mixed illumination image acquisition device to accurately acquire images of multi-branch cables and obtain pixel equivalents through calibration; a preprocessing method based on multi-angle exposure image fusion is proposed to obtain fused cable images with enhanced details, rich colors, and abundant surface information, which is beneficial for the segmentation of single cable branches; through interactive segmentation based on iterative prompts, single cable branches can be accurately extracted; finally, based on the skeleton line extraction fitting compensation method and using a micro-element length calculation algorithm, the actual length of a single cable branch can be accurately calculated. Through the method designed in the embodiments of this disclosure, accurate measurement of complex multi-branch cables can be achieved, realizing intelligentization of the production and manufacturing inspection process.

[0098] The second aspect of this disclosure provides a measuring device for the length of multi-branch complex cables, comprising:

[0099] The image acquisition module is used to acquire multiple images of a complex multi-branch cable under test with different exposure properties and to form an image sequence.

[0100] The image fusion module contains an image surface enhancement model, which is used to fuse the input image sequence, enhance the surface details of the image, and obtain a fused cable image.

[0101] The cable branch segmentation module is used to segment each cable branch in the fused cable image using the SAM model and prompt information;

[0102] The skeleton line extraction module is used to extract the contour lines of each segmented cable branch, and extract the skeleton lines of each cable branch based on the parallel thinning method to obtain the skeleton lines missing at the ends of each cable branch. The missing skeleton lines at the ends are fitted and compensated, and the two intersection points of each fitted skeleton line and the contour line of the corresponding cable branch are taken as the two ends of the complete skeleton line of the cable branch, thus obtaining the complete skeleton line of each cable branch.

[0103] The cable branch length calculation module is used to calculate the pixel length of the complete skeleton line of each cable branch, and calculate the actual length of each cable branch based on the pixel length.

[0104] It should be noted that the aforementioned explanation of the embodiment of the method for measuring the length of multi-branch complex cables also applies to the measuring device in this embodiment, and will not be repeated here.

[0105] To implement the above embodiments, this disclosure also proposes a computer-readable storage medium storing a computer program that is executed by a processor to perform the method for measuring the length of multi-branch complex cables described in the above embodiments.

[0106] The following is for reference. Figure 6 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of the present disclosure. It should be noted that the electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs, desktop computers, and servers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0107] like Figure 6As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 102 or a program loaded from a storage device 108 into a random access memory (RAM) 103. The RAM 103 also stores various programs and data required for the operation of the electronic device. The processing unit 101, ROM 102, and RAM 103 are interconnected via a bus 104. An input / output (I / O) interface 105 is also connected to the bus 104.

[0108] Typically, the following devices can be connected to I / O interface 105: input devices 106 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, etc.; output devices 107 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 108 including, for example, magnetic tapes, hard disks, etc.; and communication devices 109. Communication device 109 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.

[0109] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, this embodiment includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via communication device 109, or installed from storage device 108, or installed from ROM 102. When the computer program is executed by processing device 101, it performs the functions defined above in the methods of embodiments of this disclosure.

[0110] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0111] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0112] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to perform the aforementioned method for measuring the length of a complex multi-branch cable.

[0113] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and Python, as well as conventional procedural programming languages ​​such as the "C-" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0114] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0115] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0116] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the function involved, as will be understood by those skilled in the art to which embodiments of this application pertain.

[0117] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0118] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0119] Those skilled in the art will understand that implementing all or part of the steps of the methods in the above embodiments can be accomplished by instructing related hardware through a program. The developed program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0120] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0121] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A method for measuring the length of a complex multi-branch cable, characterized in that, include: Multiple images of a complex multi-branch cable under test with different exposure properties are acquired, and these images are used to form an image sequence. The input image sequence is then fused to enhance the surface details of the images, resulting in a fused cable image. The SAM model and prompts are used to segment each cable branch in the fused cable image, specifically including: S21. Set selection point prompts, where positive points are set to select cable branches that need to be split, and negative points are set to areas that do not need to be split; S22. Based on the point selection prompts, iterative segmentation results are generated using the SAM model; S23. If a complete segment exists in the iterative segmentation results, save the result; if no complete segment exists in the iterative segmentation results, select one of the iterative segmentation results as the basis and provide iterative suggestions, that is, segment by selecting more suggestion points. S24. Based on the iteration prompts in step S23, generate more accurate segmentation results; S25. If the segmentation result obtained in step S24 does not meet the set accuracy requirements, repeat the iterative process of steps S21 to S24 until the segmentation result meets the set accuracy requirements, and save the final segmentation result. The outline of each segmented cable branch is extracted, and the skeleton line of each cable branch is extracted based on the parallel thinning method. The skeleton lines missing at the ends of each cable branch are obtained. The missing skeleton lines at the ends are fitted and compensated. The two intersection points of each fitted skeleton line and the outline of the corresponding cable branch are taken as the two ends of the complete skeleton line of the cable branch, thus obtaining the complete skeleton line of each cable branch. Calculate the pixel length of the complete skeleton line for each cable branch, and then calculate the actual length of each cable branch based on this pixel length.

2. The measurement method according to claim 1, characterized in that, Multiple images of a complex multi-branch cable under test with different exposure properties are acquired using an image acquisition device. The image acquisition device includes an imaging unit and an illumination unit. The imaging unit includes an industrial camera. The illumination unit uses a combination of backlighting and frontlighting. The backlighting is provided by an LED light board, which also serves as a working plane for placing the complex multi-branch cable under test. The frontlighting is provided by the flash unit built into the industrial camera.

3. The measurement method according to claim 1, characterized in that, The exposure attributes include exposure angle and exposure intensity.

4. The measurement method according to claim 1, characterized in that, The image surface enhancement model employs the MEF-Net network based on unsupervised learning.

5. The measurement method according to claim 4, characterized in that, The publicly available dataset and multi-angle exposure images of the cable components are used together as the training set for the image surface enhancement model.

6. The measurement method according to claim 1, characterized in that, The number or method of setting selection points should meet the requirement of being able to completely separate a single cable branch.

7. The measurement method according to claim 1, characterized in that, The specific steps for obtaining the complete skeleton wire of each cable branch include: S31. Extract the outlines of each segmented individual cable branch to obtain the continuous outline of each individual cable branch. S32. The images of each segmented cable branch are binarized and eroded. Then, the skeleton lines of each single cable branch are extracted by a parallel thinning method to obtain the skeleton lines of the missing ends of each cable branch. S33. Using a polynomial fitting method, the missing skeleton lines at the ends corresponding to each cable branch obtained in step S32 are fitted to achieve the effect of extension. The fitted lines of the cable skeleton lines and the cable outline lines are drawn in the same figure. S34. Traverse and obtain the two intersection points of the cable outline and the fitted line of the skeleton line. Use the intersection points as the two endpoints of the fitted line to obtain a new fitted line. The new fitted line is the complete skeleton line.

8. A device for measuring the length of a complex multi-branch cable, characterized in that, include: The image acquisition module is used to acquire multiple images of a complex multi-branch cable under test with different exposure properties and to form an image sequence. The image fusion module contains an image surface enhancement model, which is used to fuse the input image sequence, enhance the surface details of the image, and obtain a fused cable image. The cable branch segmentation module is used to segment each cable branch in the fused cable image using the SAM model and prompting information, specifically including: S21. Set selection point prompts, where positive points are set to select cable branches that need to be split, and negative points are set to areas that do not need to be split; S22. Based on the point selection prompts, iterative segmentation results are generated using the SAM model; S23. If a complete segment exists in the iterative segmentation results, save the result; if no complete segment exists in the iterative segmentation results, select one of the iterative segmentation results as the basis and provide iterative suggestions, that is, segment by selecting more suggestion points. S24. Based on the iteration prompts in step S23, generate more accurate segmentation results; S25. If the segmentation result obtained in step S24 does not meet the set accuracy requirements, repeat the iterative process of steps S21 to S24 until the segmentation result meets the set accuracy requirements, and save the final segmentation result. The skeleton line extraction module is used to extract the contour lines of each segmented cable branch, and extract the skeleton lines of each cable branch based on the parallel thinning method to obtain the skeleton lines missing at the ends of each cable branch. The missing skeleton lines at the ends are fitted and compensated, and the two intersection points of each fitted skeleton line and the contour line of the corresponding cable branch are taken as the two ends of the complete skeleton line of the cable branch, thus obtaining the complete skeleton line of each cable branch. The cable branch length calculation module is used to calculate the pixel length of the complete skeleton line of each cable branch, and calculate the actual length of each cable branch based on the pixel length.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method for measuring the length of a multi-branch complex cable as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • A vision-based cable cutting length measurement system and method

    CN110601063B

  • Cable length measuring method

    CN114719729A

  • A method, system, electronic device and storage medium for measuring the length of a cable in a coil

    CN115420181B

  • Cable length detection method

    CN117109420A

  • Vision-based cable length measuring system

    CN217331047U