A single-wire diameter detection method and system based on relative vision

CN122989585APending Publication Date: 2026-10-27SHAO XING XIAN DIAN LI SHE BEI YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611093474.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0005]为了解决现有的单线线径检测通常采用人工抽检方式,检测频率较低,异常发生与异常发现之间存在较长时间间隔,难以及时发现生产过程中出现的短时线径波动、偶发断线等瞬态异常,容易造成大量不合格产品持续生产,导致材料浪费和返工成本增加,且现有在线检测方式在绞线机高速运行、设备振动、环境光照变化以及多根单线同时进入检测区域的情况下,容易受到单线位置变化、图像模糊及背景干扰等因素影响,导致检测结果稳定性和一致性较差,难以长期、准确地获得连续可靠的单线线径检测数据,不利于异常追溯以及生产工艺参数的分析和优化的技术问题,本发明提供了一种基于相对视觉的单线线径检测方法及系统

Benefits of technology

[0008]本发明提供的技术方案带来的有益效果包括:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989585A_ABST
    Figure CN122989585A_ABST
Patent Text Reader

Abstract

The application provides a single-wire diameter detection method and system based on relative vision, relates to the technical fields of machine vision detection and cable manufacturing quality detection, and the method comprises the following steps: acquiring multiple standard single-wire images photographed by a stranding machine under a normal operation state; pre-processing each standard single-wire image to obtain multiple standard single-wire foreground binary images; extracting a standard single-wire contour corresponding to each standard single-wire foreground binary image; constructing a standard Hu moment of each standard single-wire foreground binary image according to each standard single-wire contour; constructing a standard single-wire template according to the standard Hu moments of each standard single-wire foreground binary image; acquiring an image containing a single wire to be detected photographed by the stranding machine in a production process; and relatively comparing the image of the single wire to be detected with the standard single-wire template to determine a single-wire diameter detection result. The application can continuously obtain reliable single-wire diameter detection data, and provides a data basis for abnormal tracing, analysis and optimization of production process parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine vision inspection and cable manufacturing quality inspection technology, and in particular to a method and system for single-wire diameter inspection based on relative vision. Background Technology

[0002] In the production of conductors and cables, multiple metal wires are typically gathered and twisted together by a stranding machine at high speed to form a cable. The uniformity and stability of the wire diameter directly affect the cable's conductivity, mechanical strength, and subsequent processing quality. Therefore, it is necessary to inspect the wire diameter during production to determine if there are any abnormalities such as wires being too thick, too thin, broken, or locally deformed.

[0003] In existing technologies, single-wire diameter testing typically employs manual sampling. Quality inspectors periodically stop the machine or reduce its operating speed to cut single-wire samples from the stranding machine, which are then measured offline using calipers or micrometers. This method has a low testing frequency, and there is a long time interval between the occurrence and detection of anomalies. It is difficult to detect transient anomalies such as short-term wire diameter fluctuations and occasional wire breaks during production in a timely manner, which can easily lead to the continuous production of a large number of defective products, resulting in material waste and increased rework costs.

[0004] In addition, existing online inspection methods are easily affected by factors such as changes in the position of individual wires, image blurring, and background interference when the stranding machine is running at high speed, the equipment is vibrating, the ambient light changes, and multiple single wires enter the inspection area at the same time. This results in poor stability and consistency of the inspection results, making it difficult to obtain continuous and reliable single wire diameter inspection data in a long period of time. This is not conducive to anomaly tracing and the analysis and optimization of production process parameters. Summary of the Invention

[0005] To address the challenges of existing single-wire diameter testing methods that typically rely on manual sampling, resulting in low testing frequency and long time intervals between anomaly occurrence and detection, it is difficult to promptly detect transient anomalies such as short-term wire diameter fluctuations and occasional wire breaks during production. This can lead to the continuous production of a large number of defective products, resulting in material waste and increased rework costs. Furthermore, existing online testing methods are susceptible to factors such as changes in wire position, image blurring, and background interference when the stranding machine is running at high speed, equipment vibrations, ambient lighting changes, or multiple single wires simultaneously entering the testing area. This leads to poor stability and consistency of the testing results, making it difficult to obtain continuous and reliable single-wire diameter testing data accurately and consistently over a long period. This hinders anomaly tracing and the analysis and optimization of production process parameters. Therefore, this invention provides a single-wire diameter testing method and system based on relative vision.

[0006] The technical solution provided by this invention is as follows: In a first aspect, the present invention provides a single-line diameter detection method based on relative vision, comprising: S1: Acquire multiple standard single-wire images taken by the stranding machine under normal operating conditions; S2: Preprocess each standard single-line image to obtain multiple standard single-line foreground binary images; S3: Extract the standard single-line contour corresponding to each standard single-line foreground binary image; S4: Construct standard Hu moments for each standard single-line foreground binary image based on each standard single-line contour; S5: Construct a standard single-line template based on the standard Hu moments of each standard single-line foreground binary image; S6: Real-time acquisition of images containing the single wire to be inspected captured by the stranding machine during the production process; S7: Compare the image of the single line to be detected with the standard single line template to determine the single line diameter detection result.

[0007] Secondly, the present invention provides a single-line diameter detection system based on relative vision, comprising: processor; A memory storing computer-readable instructions, which, when executed by the processor, implement the single-line diameter detection method based on relative vision as described in the first aspect.

[0008] The beneficial effects of the technical solution provided by this invention include: In this embodiment of the invention, by acquiring multiple standard single-wire images captured by the stranding machine under normal operating conditions, and sequentially preprocessing each standard single-wire image, extracting the standard single-wire contour, constructing a standard Hu moment, and constructing a standard single-wire template, the characteristics of multiple frames of qualified standard single-wires under normal production conditions can be used as a relative comparison benchmark, reducing the impact of single-frame image noise, normal equipment vibration, changes in ambient lighting, and minor changes in single-wire position on the detection benchmark. By acquiring images of the single wire to be inspected captured in real time during the stranding machine's production process and comparing these images with the standard single-wire template, periodic manual sampling inspections can be replaced. This method increases the detection frequency of single-wire diameter, shortens the time interval between anomaly occurrence and detection, and promptly detects transient anomalies such as short-term wire diameter fluctuations, occasional wire breaks, and localized deformation during production. This reduces the continuous production of defective products, lowers material waste, and reduces rework costs. Furthermore, by using a standard single-wire template for relative comparison, the method reduces the impact of high-speed stranding machine operation, equipment vibration, changes in ambient lighting, single-wire position variations, and background interference on the detection results. This improves the stability and consistency of the detection results, enabling the continuous acquisition of reliable single-wire diameter detection data. This provides a data foundation for anomaly tracing and the analysis and optimization of production process parameters. Attached Figure Description

[0009] Figure 1 A schematic flowchart of a single-line diameter detection method based on relative vision provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a single-line diameter detection system based on relative vision, provided in an embodiment of the present invention. Detailed Implementation

[0010] Reference manual attached Figure 1 The diagram shows a flowchart of a single-line diameter detection method based on relative vision provided by an embodiment of the present invention.

[0011] This invention provides a single-line diameter detection method based on relative vision, the method comprising: S1: Acquire multiple standard single-wire images taken by the stranding machine under normal operating conditions.

[0012] In one possible implementation, S1 specifically includes sub-steps S101 to S104: S101: Rigidly fixes the industrial camera, fixed-focus lens, and LED backlight above the disc of the stranding machine, and fixes the shooting angle of the industrial camera, the focal length of the fixed-focus lens, and the region of interest.

[0013] S102: An incremental encoder is installed on the disc spindle of the stranding machine, and the pulse signal output by the incremental encoder is used as the trigger signal for the industrial camera.

[0014] S103: Place qualified standard single wires into the stranding machine and control the stranding machine to operate normally.

[0015] S104: When a qualified standard single line moves to the region of interest, the industrial camera is triggered to take pictures of the qualified standard single line in sequence according to the pulse signal output by the incremental encoder, so as to obtain multiple standard single line images.

[0016] Specifically, an industrial camera, a fixed-focus lens, and an LED backlight are positioned above the stranding machine's disc. The industrial camera is a global shutter type with 5 megapixels, and the fixed-focus lens has a focal length of 50mm. The industrial camera, fixed-focus lens, and LED backlight are secured using a rigid bracket and threaded locking device. Anti-loosening washers or thread-locking adhesive are used at each fastening point to ensure relative stability of the industrial camera, fixed-focus lens, and LED backlight during stranding machine operation. The shooting angle of the industrial camera, the focal length of the fixed-focus lens, and the region of interest are fixed to ensure that these parameters remain constant during standard single-line image acquisition.

[0017] Furthermore, under normal production conditions where the equipment vibration frequency is no greater than 50 Hz and the amplitude is no greater than 0.5 mm, the long-term drift of the imaging pose is limited to within ±0.1 mm using rigid supports and threaded locking devices to maintain the stability of the perspective projection model. The exposure time of the industrial camera is set to no greater than 100 microseconds to freeze motion blur caused by high-speed standard single-line motion. For short-period vibrations with a frequency greater than 1 Hz and an amplitude no greater than 0.5 mm, the image position shift caused by the vibration is no greater than 2 pixels. This image position shift does not affect subsequent pixel width measurements based on the minor axis of the contour, thus requiring no additional compensation.

[0018] Furthermore, under a fixed imaging pose, when a standard single line of the same physical size is located at different positions in the image, its pixel width satisfies the following:

[0019] in, This indicates the location of the standard single line in the image. pixel width at that time Represents the perspective factor determined by projection geometry. This indicates the location of the standard single line in the image. The pixel width at that time. For a fixed imaging pose, the perspective factor depends only on the spatial position of the standard single line in the image. When both the standard single line and the subsequent single line to be detected are imaged within a fixed region of interest, they are affected by the same perspective factor, thus providing a unified imaging basis for subsequent pixel-level relative comparisons based on the standard single line template.

[0020] Furthermore, an incremental encoder is installed on the main shaft of the stranding machine disc, and the pulse signal output by the incremental encoder is used as the trigger signal for the industrial camera. When the stranding machine disc rotates and moves the standard single wire to a predetermined relative position within the region of interest, the industrial camera is triggered to take a picture based on the pulse signal output by the incremental encoder. This ensures that the standard single wire is in the same relative position within the region of interest during each picture, thereby eliminating the randomness of the standard single wire imaging position caused by the high-speed operation of the stranding machine.

[0021] Furthermore, standard single wires of suitable diameter are selected and placed into a stranding machine. The stranding machine is then controlled to operate under normal production conditions, allowing the standard single wires to rotate with the stranding machine disc. During the standard single wire image acquisition process, the industrial camera, fixed-focus lens, LED backlight, shooting angle, focal length, and region of interest are kept constant to ensure that each acquired standard single wire image has the same imaging pose and perspective projection conditions.

[0022] Furthermore, as the standard single line moves sequentially to a predetermined relative position within the region of interest, the industrial camera is sequentially triggered by the pulse signal output by the incremental encoder to take multiple pictures of the standard single line, acquiring N clear images of the standard single line, where:

[0023] Each standard single-line image was acquired while the twisting machine was running normally and was used for subsequent region of interest extraction, Gaussian filtering, Otsu adaptive threshold binarization, standard single-line contour extraction, and standard single-line template construction.

[0024] In this embodiment of the invention, by rigidly fixing the industrial camera, fixed-focus lens, and LED backlight above the stranding machine disc, and fixing the shooting angle, lens focal length, and region of interest, the imaging pose and perspective projection conditions during the standard single-line image acquisition process can be kept stable, reducing the impact of equipment vibration, camera displacement, and changes in light source position on image consistency. By setting an incremental encoder on the disc spindle and using the encoder pulse signal to trigger the industrial camera to capture images, the standard single line can be positioned at a predetermined relative position within the region of interest during each capture, reducing the randomness of imaging position and motion interference caused by high-speed rotation. By placing qualified standard single lines in a normally operating stranding machine for image acquisition, the acquired standard single-line images can accurately reflect the equipment vibration, motion posture, and width fluctuations under normal production conditions. By capturing multiple images of qualified standard single lines that have moved into the region of interest, multiple standard single-line images with the same imaging conditions can be obtained. This provides a data foundation for subsequent extraction of pixel width features and Hu rectangular features using a multi-frame statistical method, constructing a stable and reliable standard single-line template, and enabling pixel-level relative comparison between the single line to be detected and the standard single line to automatically cancel out the common perspective distortion effect.

[0025] S2: Preprocess each standard single-line image to obtain multiple standard single-line foreground binary images.

[0026] In one possible implementation, S2 specifically includes sub-steps S201 to S203: S201: Extract the region of interest from each standard single-line image to obtain the region of interest image corresponding to each standard single-line image.

[0027] S202: Perform Gaussian filtering on each region of interest image to obtain multiple filtered region of interest images.

[0028] S203: Using the Otsu adaptive thresholding algorithm, each filtered region of interest image is binarized to obtain multiple standard single-line foreground binary images.

[0029] Specifically, for each acquired standard single-line image, a corresponding local image is extracted from each standard single-line image based on the pre-fixed location and range of the region of interest (ROI), resulting in the ROI image for each standard single-line image. The ROI remains fixed during the acquisition and processing of the standard single-line images, ensuring that each ROI image contains the same imaging area traversed by the standard single line. This reduces interference from the twisting machine structure, background, and other single lines outside the ROI on subsequent image processing and guarantees that different standard single-line images have the same processing range.

[0030] Furthermore, Gaussian filtering is applied to each region of interest (ROI) image to suppress random noise generated during image acquisition and grayscale fluctuations near the standard single-line edges, reducing the impact of image noise on subsequent thresholding results. This yields multiple filtered ROI images that correspond one-to-one with each ROI image. The same Gaussian filtering method is used for each ROI image to maintain processing consistency between different standard single-line images.

[0031] Furthermore, for each filtered region of interest image, the Otsu adaptive thresholding algorithm is applied to adaptively determine the binarization threshold based on the grayscale distribution of the corresponding filtered region of interest image. The foreground region containing the standard single line is then separated from the background region based on the binarization threshold, resulting in multiple standard single line foreground binary images. The standard single line region in the standard single line foreground binary image constitutes the foreground region, and the remaining regions constitute the background region, providing a binary image basis for subsequent standard single line contour restoration, extraction, and smoothing processing.

[0032] Furthermore, the Otsu adaptive thresholding algorithm is used to determine the binarization threshold for each filtered region of interest image, allowing the binarization threshold to be adjusted according to the grayscale distribution of different images, thereby reducing the impact of LED backlight brightness variations on the standard single-line foreground segmentation results. Since subsequent detection is mainly based on the edges and contours of the standard single line, rather than relying on the absolute grayscale values ​​of the image, the Otsu adaptive thresholding algorithm can improve the comparability between different standard single-line foreground binary images.

[0033] In this embodiment of the invention, by extracting regions of interest (ROIs) with fixed positions and ranges from each standard single-line image, subsequent processing can be focused on the effective imaging area traversed by the standard single-line, reducing interference from the twisted-wire structure, background, and other irrelevant targets, and ensuring that each image has a consistent processing range. By applying Gaussian filtering to each ROI image, random noise generated during image acquisition and grayscale fluctuations near the edges of the standard single-line can be suppressed, reducing the impact of noise on threshold segmentation and contour extraction. By employing the Otsu adaptive thresholding algorithm to binarize the filtered ROI images, the segmentation threshold can be adaptively determined based on the grayscale distribution of each image, reducing the impact of LED backlight brightness variations on the foreground segmentation results, and accurately separating the standard single-line foreground from the background. This results in multiple standard single-line foreground binary images with clear contours and consistent processing conditions, providing a reliable image foundation for subsequent standard single-line contour extraction, pixel width measurement, and Hu rectangular feature calculation.

[0034] S3: Extract the standard single-line contour corresponding to each standard single-line foreground binary image.

[0035] In one possible implementation, S3 specifically includes sub-steps S301 to S304: S301: Perform morphological closing operations on each standard single-line foreground binary image to obtain multiple contour-repaired binary images.

[0036] S302: Extract candidate contours from each contour restoration binary image, and perform Gaussian smoothing on the contour point sequence of each candidate contour to obtain multiple smooth candidate contours.

[0037] S303: Calculate the contour area and contour perimeter of each smooth candidate contour, and determine the smooth candidate contour as a valid candidate contour if the contour area and contour perimeter meet the preset contour screening conditions.

[0038] S304: For each contour restoration binary image, if there is only one valid candidate contour in the contour restoration binary image, the valid candidate contour is determined as the corresponding standard single-line contour. If there are multiple valid candidate contours in the contour restoration binary image, the valid candidate contour with the largest contour area is determined as the corresponding standard single-line contour, thus obtaining the standard single-line contour corresponding to each standard single-line foreground binary image.

[0039] Specifically, morphological closing operations are performed on each standard single-line foreground binary image to fill in tiny holes within the foreground region and minor breaks at the contour edges, ensuring the foreground region of the standard single line remains intact and continuous. This results in multiple contour-repaired binary images that correspond one-to-one with each standard single-line foreground binary image. The morphological closing operation uses a 3×3 circular structuring element and iterates once. Morphological closing operations reduce the impact of local gaps and edge discontinuities generated during foreground binarization on subsequent candidate contour extraction.

[0040] Furthermore, one or more closed candidate contours are extracted from each contour-restored binary image, and the corresponding contour point sequence is obtained for each candidate contour. Gaussian smoothing is then applied to the contour point sequence of each candidate contour to eliminate local burrs and minor bumps formed by image noise at the contour edges, resulting in multiple smooth candidate contours. The standard deviation of the Gaussian smoothing is 1.0, and the Gaussian kernel size is 5×5, thereby reducing the interference of local contour noise on subsequent measurements of contour area, contour perimeter, and pixel width.

[0041] Further, the contour area and perimeter of each smooth candidate contour are calculated separately, and then compared with preset contour area ranges and preset contour perimeter ranges, respectively. When a smooth candidate contour simultaneously meets both the preset contour area range and the preset contour perimeter range, the smooth candidate contour is determined as a valid candidate contour. The preset contour selection criteria are:

[0042] in, This indicates the lower limit of the preset contour area. This represents the area of ​​the smoothed candidate contour. This indicates the maximum area of ​​the preset outline. This indicates the lower limit of the preset contour perimeter. The perimeter of the smoothed candidate contour is represented. This indicates the upper limit of the preset outline perimeter.

[0043] Furthermore, the preset lower limit of the contour area, the preset upper limit of the contour area, the preset lower limit of the contour perimeter, and the preset upper limit of the contour perimeter are preset based on the nominal line diameter and imaging magnification of the current standard single line. The preset contour area range is typically taken as ±50% of the pixel area corresponding to the nominal diameter. By simultaneously using the contour area and contour perimeter to filter smooth candidate contours, interfering contours formed by dust, dirt, metallic reflective fragments, and other non-standard single-line targets can be eliminated.

[0044] Furthermore, for each contour-restored binary image, the number of valid candidate contours in the image is counted. When there is only one valid candidate contour in a contour-restored binary image, that candidate contour is directly identified as the corresponding standard single-line contour. When there are multiple valid candidate contours in a contour-restored binary image, the contour areas of each valid candidate contour are compared, and the valid candidate contour with the largest contour area is identified as the corresponding standard single-line contour, thus obtaining the standard single-line contour corresponding to each standard single-line foreground binary image.

[0045] Furthermore, the standard single-line contour corresponding to each standard single-line foreground binary image is used as the processing object for subsequent minimum bounding rectangle calculation, standard pixel width statistics, and Hu rectangle feature extraction, so as to ensure that the width and shape features are derived from the target contour after contour repair, smoothing, and effectiveness screening.

[0046] In this embodiment of the invention, by performing morphological closing operations on each standard single-line foreground binary image, the microscopic holes inside the standard single-line foreground region and the small breaks at the contour edges can be filled, ensuring the contour remains complete and continuous. By extracting candidate contours and performing Gaussian smoothing on the contour point sequence, edge burrs and local bumps caused by image noise can be eliminated, reducing the impact of irregular contour fluctuations on subsequent area, perimeter, pixel width, and Hu moment calculations. By combining contour area and contour perimeter to filter smoothed candidate contours, interference contours formed by dust stains, metallic reflective fragments, and other non-target areas can be eliminated. By directly determining the target contour when only one valid candidate contour exists, and selecting the contour with the largest contour area as the standard single-line contour when multiple valid candidate contours exist, the target single line in each standard single-line foreground binary image can be determined stably and accurately, providing a reliable contour data foundation for subsequent standard pixel width measurement, width statistics, and Hu rectangular feature extraction.

[0047] In one possible implementation, after S3 and before S4, the following is also included: The minimum bounding rectangle of each standard single-line contour is calculated using the rotating caliper algorithm, and the length of the short side of the minimum bounding rectangle is used as the standard pixel width of the corresponding standard single-line foreground binary image.

[0048] The average pixel width is calculated based on the standard pixel width of each standard single-line foreground binary image.

[0049] Calculate the standard deviation of pixel width based on the standard pixel width and the mean pixel width of each standard single-line foreground binary image.

[0050] Based on the mean pixel width and the standard deviation of pixel width, the acceptable width range is determined by introducing a process tolerance coefficient or a width ratio tolerance.

[0051] Specifically, for each standard single-line foreground binary image, the contour point set of the standard single-line contour is obtained, and the minimum bounding rectangle of the contour point set is calculated using the rotating caliper algorithm. The minimum bounding rectangle rotates with the tilt direction of the standard single-line contour in the image to reduce the impact of changes in the standard single-line imaging direction on width measurement. The shorter of the two sides of the minimum bounding rectangle is determined as the standard pixel width of the corresponding standard single-line foreground binary image.

[0052] in, Indicates the standard pixel width. This indicates taking the minimum value. and These represent the two side lengths of the minimum bounding rectangle, respectively, with the standard pixel width in pixels. By using the shorter side length of the minimum bounding rectangle as the standard pixel width, the diameter of the standard single-line profile can be characterized by its minor axis dimension.

[0053] Furthermore, after obtaining the contour area of ​​the current standard single-line contour, the contour area of ​​the current standard single-line contour is compared with the contour area of ​​the same numbered standard single-line contour in the previous frame. When the change in the contour area of ​​the current standard single-line contour relative to the contour area of ​​the same numbered standard single-line contour in the previous frame exceeds ±30%, the standard pixel width measurement result of the current frame is determined as a suspicious measurement result, and it is checked whether there is contour adhesion between adjacent standard single lines in the binary image of the standard single-line foreground of the current frame.

[0054] Furthermore, concave point detection is used to determine whether there is adhesion between adjacent standard single-line contours in the binary image of the standard single-line foreground of the current frame. When adhesion between adjacent standard single-line contours is detected, the adhesion contours are segmented, and the standard pixel width is remeasured based on the segmented standard single-line contours. When no adhesion between adjacent standard single-line contours is detected, the current frame data is marked as "suspected anomaly," and the original image of the current frame is retained for subsequent manual review.

[0055] Furthermore, for the historical standard pixel width sequence of the same numbered standard single line, a sliding window of length 5 is maintained, and the average pixel width within the sliding window is calculated. and pixel width standard deviation The standard pixel width measured in the current frame is used as the current pixel width. And determine whether the current pixel width is an outlier based on the following formula:

[0056] in, This represents the current pixel width measured in the current frame. During outlier detection, This represents the average pixel width within a sliding window of length 5. This represents the standard deviation of pixel width within the sliding window.

[0057] Furthermore, when the current pixel width meets the outlier detection criteria described above, the current pixel width is identified as an outlier, the current frame data is discarded, and the system waits for the next encoder trigger cycle to reacquire the standard single-line image and perform standard pixel width measurement. Simultaneously, the outlier event is recorded in the log for later traceability. By identifying and processing abrupt changes in contour area and abnormal fluctuations in pixel width in the current frame, the impact of adjacent single-line contour adhesion and occasional image noise on the statistical results of standard pixel width can be reduced.

[0058] Furthermore, the minimum bounding rectangle calculation is performed on each of the standard single-line foreground binary images retained after anomaly measurement result identification and processing, resulting in multiple standard pixel widths corresponding one-to-one with each standard single-line foreground binary image. Let the... The standard pixel width of a standard single-line foreground binary image is: Calculate the average pixel width based on all standard pixel widths:

[0059] in, Indicates the average pixel width. This indicates the number of standard single-line foreground binary images. Indicates the first The standard pixel width of a standard single-line foreground binary image. The average pixel width is used to characterize the baseline pixel width of a qualified standard single line under conditions of fixed shooting angle, fixed lens focal length, and fixed region of interest.

[0060] Furthermore, based on the standard pixel width and mean pixel width corresponding to each standard single-line foreground binary image, the standard deviation of pixel width is calculated:

[0061] in, This represents the standard deviation of pixel width. The standard deviation of pixel width is used to characterize the degree of fluctuation in pixel width of a qualified standard line under normal operating conditions, caused by normal equipment vibration, minor changes in line position, and image contour extraction errors.

[0062] Furthermore, based on the mean pixel width and the standard deviation of pixel width, a process tolerance coefficient is introduced to determine the acceptable width range. Alternatively, based on the mean pixel width, a width ratio tolerance is introduced to determine the acceptable width range. The acceptable width range is expressed as:

[0063] in, This indicates the lower limit of the acceptable width range. This indicates the upper limit of the acceptable width range. The acceptable width range is used in subsequent online inspection processes to determine whether the current pixel width of the line under inspection meets the width requirements of the standard line.

[0064] Furthermore, when determining the acceptable width range using the process tolerance coefficient, the lower and upper limits of the acceptable width range are determined based on the mean pixel width and the standard deviation of pixel width, respectively:

[0065]

[0066] in, This represents the process tolerance coefficient, which is set to 2. The process tolerance coefficient amplifies the normal statistical fluctuation range of pixel width, resulting in the upper and lower limits used for determining the width of the single line to be detected.

[0067] Furthermore, when determining the acceptable width range through the width ratio tolerance, the lower and upper limits of the acceptable width range are determined based on the average pixel width and the preset width ratio tolerance, respectively:

[0068]

[0069] in, This indicates the width proportion tolerance, which is set to 0.02, so that the acceptable width range corresponds to a range of ±2% of the average pixel width. This determination method is applicable when calculating pixel width boundaries based on the absolute requirements of the single-line diameter tolerance.

[0070] Furthermore, the mean pixel width, standard deviation of pixel width, lower limit of acceptable width range, and upper limit of acceptable width range are used as the width statistical features of the standard single line, so as to construct the standard single line template together with the standard Hu moment, and serve as the benchmark for the relative comparison of the current pixel width of the single line to be detected.

[0071] In this embodiment of the invention, by employing a rotating caliper algorithm to calculate the minimum bounding rectangle of each standard single-line profile, and using the short side length of the minimum bounding rectangle as the standard pixel width, the influence of the standard single line's tilt or directional change in the image on the line diameter measurement can be reduced, and the single-line diameter can be stably characterized by the minor axis dimension of the profile. By calculating the average standard pixel width of multiple standard single-line foreground binary images, the reference pixel width of a qualified standard single line under fixed imaging pose and normal operating conditions can be obtained, reducing the impact of single-frame measurement errors on the template. By calculating the standard deviation of pixel width, the width dispersion caused by normal equipment vibration, minor changes in single-line position, and contour extraction fluctuations can be quantified. By combining the average pixel width, the standard deviation of pixel width, and the process tolerance coefficient, or by combining the average pixel width and the width ratio tolerance to determine the acceptable width range, the acceptable width range can take into account both the normal statistical fluctuations of the standard single line and the actual process tolerance requirements, providing a stable and reasonable judgment benchmark for the relative comparison of the current pixel width of the single line to be detected, and reducing misjudgments caused by occasional noise.

[0072] S4: Based on each standard single-line contour, construct the standard Hu moments for each standard single-line foreground binary image.

[0073] In one possible implementation, S4 specifically includes sub-steps S401 to S404: S401: Calculate the central moments of each standard single-line profile, and calculate the normalized central moments of each standard single-line profile based on the central moments and profile areas.

[0074] S402: Based on the normalized central moments of each standard single-line profile, calculate the multiple Hu moment invariants corresponding to each standard single-line profile.

[0075] S403: Perform logarithmic operations on the absolute values ​​of each Hu moment invariant to obtain the Hu moment components corresponding to each standard single-line profile.

[0076] S404: Construct the standard Hu moments of the corresponding standard single-line foreground binary image based on each Hu moment component corresponding to the same standard single-line contour.

[0077] Specifically, for each standard single-line foreground binary image, the coordinates of each pixel in the standard single-line contour are obtained. Using the centroid of the standard single-line contour as a coordinate reference, the statistics of each pixel relative to the centroid are calculated to obtain the central moment of the standard single-line contour. The central moment is used to characterize the spatial distribution of pixels in the standard single-line contour relative to the contour centroid, providing a computational basis for subsequently constructing shape features unaffected by contour position changes.

[0078] Furthermore, based on the central moments of each standard single-line profile and the corresponding profile area, the normalized central moments of each standard single-line profile are calculated:

[0079]

[0080]

[0081] in, Represents a standard single-line profile Normalized central moments of order 1 Represents a standard single-line profile The central moment of the first order, The zeroth moment of a standard single-line profile. Represents the normalization index, and This represents the order parameter of the central moments. By normalizing the central moments using the zeroth moment, subsequent shape features constructed based on the normalized central moments become insensitive to scale variations in the standard single-line profile.

[0082] Furthermore, based on the normalized central moments corresponding to each standard single-line profile, seven Hu moment invariants are calculated for each profile. Each Hu moment invariant is obtained by combining normalized central moments of different orders and is used to characterize the overall shape of the standard single-line profile. Since each Hu moment invariant is invariant to rotation, translation, and scale, even when the standard single-line undergoes minor changes in position, orientation, or scale within the region of interest, the shape of the standard single-line profile can still be characterized using the Hu moment invariants.

[0083] Furthermore, considering the differences in the numerical dynamic range among the various Hu moment invariants, logarithmic operations are performed on the absolute values ​​of each Hu moment invariant to obtain the corresponding Hu moment components:

[0084] in, Indicates the first The Hu moment components are obtained by taking the logarithm of the absolute values ​​of the Hu moment invariants. Represents logarithmic operations. Indicates the first Each Hu moment invariant is logarithmically compressed to reduce the dynamic range of each Hu moment component, ensuring that different Hu moment components contribute relatively evenly to subsequent shape similarity calculations, thereby improving the sensitivity and reliability of single-line profile deformation determination.

[0085] Furthermore, according to the preset Hu moment component arrangement order, the seven Hu moment components corresponding to the same standard single-line contour are combined to construct the standard Hu moment of the corresponding standard single-line foreground binary image:

[0086] in, This represents the standard Hu moment constructed from the individual Hu moment components. Each standard single-line foreground binary image corresponds to a seven-dimensional standard Hu moment, ensuring a one-to-one correspondence between multiple standard single-line foreground binary images and multiple standard Hu moments.

[0087] Furthermore, the standard Hu moments corresponding to each standard single-line foreground binary image serve as the basis data for subsequent calculation of the Hu moment mean template. By statistically analyzing the seven-dimensional standard Hu moments corresponding to multiple standard single-line foreground binary images, the influence of single-frame image noise, minor fluctuations in contour edges, and normal vibrations of the stranding machine on the shape characteristics of the standard single line can be reduced, and a shape feature benchmark can be provided for the relative comparison between the current Hu moment of the single line to be detected and the standard single-line template.

[0088] In this embodiment of the invention, by calculating and normalizing the central moments of each standard single-line contour, the influence of contour position and scale changes on shape features can be weakened. By calculating multiple Hu moment invariants based on the normalized central moments, the overall shape of the standard single-line contour can be characterized from different dimensions, and the extracted shape features are rotationally, translationally, and scale-invariant. By performing logarithmic operations on the absolute values ​​of each Hu moment invariant, the numerical dynamic range between different Hu moment invariants can be compressed, so that each Hu moment component has a relatively balanced contribution in subsequent shape similarity calculations. By combining multiple Hu moment components corresponding to the same standard single-line contour into a standard Hu moment, a unified seven-dimensional shape feature vector can be formed, providing a stable and reliable shape judgment benchmark for subsequent statistical analysis of shape features of multiple standard single-line images, construction of Hu moment mean templates, and identification of deformations such as local flattening, gaps, and burrs in the single line to be detected.

[0089] S5: Construct a standard single-line template based on the standard Hu moments of each standard single-line foreground binary image.

[0090] In one possible implementation, S5 specifically includes sub-steps S501 and S502: S501: Sum the standard Hu moments corresponding to each standard single-line foreground binary image and calculate the average value to obtain the Hu moment mean template.

[0091] S502: Associate and save the mean pixel width, standard deviation pixel width, lower limit of acceptable width range, upper limit of acceptable width range, and Hu moment mean template to construct a standard single-line template.

[0092] Specifically, for each standard single-line foreground binary image, the standard Hu moments are summed and averaged according to the same Hu moment component arrangement order to obtain the Hu moment mean template:

[0093] in, This represents the template for the mean of Hu's moments. Indicates the first The standard Hu moments of a standard single-line foreground binary image. Each standard Hu moment is a seven-dimensional shape feature vector composed of seven logarithmically compressed Hu moment components; therefore, the Hu moment mean template is also a seven-dimensional shape feature vector.

[0094] Furthermore, when calculating the Hu moment mean template, multi-frame statistics are performed on the standard Hu moments corresponding to each standard single-line foreground binary image. This allows the Hu moment mean template to characterize the overall contour shape features of a qualified standard single-line under normal operating conditions, and reduces the impact of single-frame image noise, minor fluctuations in the contour edges of the standard single-line, and normal equipment vibration on the shape features. The Hu moment mean template serves as the shape feature benchmark for relative comparison of the current Hu moments of subsequent single-line to be tested.

[0095] Furthermore, the average pixel width obtained during the standard pixel width statistics process is acquired. Pixel width standard deviation The lower limit of the acceptable width range and the upper limit of the acceptable width range And compare the above width statistics parameters with the Hu moment mean template. The correlation is performed. Among them, the mean pixel width is used to characterize the reference pixel width of the qualified standard line under a fixed imaging pose, the standard deviation of pixel width is used to characterize the normal fluctuation of the pixel width of the qualified standard line, the lower limit and upper limit of the width qualified range are used to limit the allowable pixel width range of the line to be detected, and the Hu moment mean template is used to characterize the reference contour shape of the qualified standard line.

[0096] Furthermore, the mean pixel width, standard deviation pixel width, lower limit of acceptable width range, upper limit of acceptable width range, and Hu moment mean template are saved together to a template file to construct a standard single-line template. .

[0097] Furthermore, the standard single-line template includes both width statistical features for determining line diameter width and shape features for determining contour deformation. During subsequent online inspection, the current pixel width of the single line to be inspected is compared with the acceptable width range in the standard single-line template, and the current Hu moment of the single line to be inspected is compared with the Hu moment mean template, thus achieving joint detection of anomalies such as excessively thick or thin lines, local flattening, gaps, or burrs.

[0098] Furthermore, when producing single lines of different specifications, images of qualified standard single lines of the corresponding specifications are re-acquired, and the mean pixel width, standard deviation of pixel width, acceptable width range, and mean Hu moment template are recalculated to generate a new standard single line template corresponding to the current single line specification. The new standard single line template is saved to a file for subsequent online inspection without requiring adjustments to the industrial camera's imaging pose, the focal length of the fixed-focus lens, or the LED backlight.

[0099] In this embodiment of the invention, by summing and averaging the standard Hu moments corresponding to multiple standard single-line foreground binary images, a Hu moment mean template that can characterize the overall contour shape of a qualified standard single line can be obtained. This reduces the influence of single-frame image noise, minor fluctuations in contour edges, and normal equipment vibration on shape features, thereby improving the stability of the shape reference. By associating and saving the pixel width mean, pixel width standard deviation, upper and lower limits of the width qualification range, and the Hu moment mean template, the statistical features of line diameter width and contour shape features can be integrated simultaneously in the same standard single-line template. This provides a unified relative comparison benchmark for subsequently judging whether the single line to be detected is too thick or too thin, and whether there are deformations such as local flattening, gaps, or burrs. This improves the comprehensiveness, stability, and reliability of single-line diameter detection and facilitates direct calling and updating of the standard single-line template during subsequent online detection.

[0100] In one possible implementation, after S5 and before S6, the following is also included: Perform validity validation on the standard single-line template. If the validation passes, the template is deemed valid and proceeds to step S6. If the validation fails, the template is deemed invalid and a new template is generated.

[0101] Specifically, before the first run of the stranding machine each day, a rapid validity verification is performed on the currently stored standard single-wire template. A known qualified standard single wire is placed in a fixed region of interest, while keeping the industrial camera's shooting angle, the focal length of the fixed-focus lens, the position of the LED backlight, and the region of interest unchanged, so that the qualified standard single wire is in the same imaging pose and perspective projection conditions as when the standard single-wire template was created.

[0102] Furthermore, three verification images containing qualified standard single lines are acquired using an industrial camera. Following the image processing and width measurement methods used when establishing the standard single-line template, region of interest extraction, binarization, and contour extraction are performed on each verification image. The pixel width of the standard single-line contour in each verification image is calculated. The average pixel width of the three verification images is then calculated to obtain the average verification width. .

[0103] Furthermore, the average pixel width is read from the currently saved standard single-line template. And verify the average width Average pixel width Compare them. Determine whether the relative deviation between the two is within the acceptable range using the following formula:

[0104] in, This represents the average verification width obtained from three verification images. This represents the average pixel width in the current standard single-line template.

[0105] Furthermore, when the relative deviation between the average verification width and the average pixel width is no greater than 2%, it indicates that the changes in the current imaging pose, lens parameters, and lighting conditions are still within the allowable range of the process. The standard single-line template is then determined to be valid, and the current standard single-line template continues to be used for online detection of the image of the single line to be detected.

[0106] Furthermore, when the relative deviation between the average verification width and the average pixel width is greater than 2%, it indicates that the slow deformation of the camera bracket, lens parameter drift caused by temperature changes, changes in light source status, or other long-term disturbances have affected the comparability between the standard single-line template and the current image. The standard single-line template is then determined to be invalid, and a prompt message "The pose or light source has changed, it is recommended to re-establish the template" is output.

[0107] Furthermore, after a standard single-line template is determined to be invalid, a qualified standard single line is reintroduced, and the standard single-line image acquisition, image preprocessing, standard single-line contour extraction, standard pixel width statistics, standard Hu moment calculation, and standard single-line template construction processes are re-executed to generate a new standard single-line template. The new standard single-line template is then used to cover the original standard single-line template, ensuring that the pixel width and shape features of subsequent single lines to be detected remain comparable to the updated standard single-line template.

[0108] Furthermore, when a fixed-focus lens is replaced or the position and range of the region of interest are adjusted, the original standard single-line template is automatically deemed unsuitable due to the active change in imaging pose or perspective projection conditions. A new standard single-line template is then established after the lens replacement or region of interest adjustment, prohibiting the continued use of the original template under the changed imaging conditions. Through template verification before the first run each day and template reconstruction after active changes, the standard single-line template remains effective during long-term equipment operation, maintenance, and single-line specification switching.

[0109] In this embodiment of the invention, by validating the standard single-line template before the first run each day, changes in imaging conditions caused by factors such as slow deformation of the camera bracket, lens parameter drift due to temperature changes, changes in light source status, and equipment maintenance can be identified in a timely manner. When the verification passes, the current standard single-line template is continued to be used, which can ensure that the single line to be detected and the standard single line still have consistent imaging pose and comparable conditions while avoiding repeated modeling. When the verification fails, the current standard single-line template is determined to be invalid, and the standard single-line image is re-acquired, the width statistical features and Hu rectangular features are calculated to generate a new standard single-line template and cover the old template. This can prevent misjudgment caused by continuing to use the invalid template after changes in imaging pose or lighting conditions, thereby ensuring that the standard single-line template always matches the current detection environment under conditions such as long-term equipment operation, lens replacement, region of interest adjustment, and specification switching, improving the long-term stability, accuracy, and reliability of single-line diameter detection results.

[0110] S6: Real-time acquisition of images containing the single wire to be inspected captured by the stranding machine during the production process.

[0111] Specifically, after the standard single-wire template is constructed and verified to be effective, the stranding machine is controlled to enter normal production, causing multiple single wires to be tested to rotate with the stranding machine disc. While maintaining the installation positions of the industrial camera, fixed-focus lens, and LED backlight, as well as the shooting angle of the industrial camera, the focal length of the fixed-focus lens, and the region of interest (ROI) remain unchanged, an incremental encoder mounted on the main shaft of the stranding machine disc outputs pulse signals. These pulse signals are used as trigger signals for the industrial camera. When the single wire to be tested moves to a predetermined relative position within the ROI, the industrial camera is triggered to capture an image of the single wire in real time. The industrial camera is a 5-megapixel global shutter industrial camera with a fixed-focus lens focal length of 50 mm. The exposure time of the industrial camera is no more than 100 microseconds to freeze motion blur caused by the high-speed movement of the single wire to be tested and to ensure that the image of the single wire to be tested has the same imaging pose and perspective projection conditions as the standard single-wire image.

[0112] S7: Compare the image of the single line to be detected with the standard single line template to determine the single line diameter detection result.

[0113] In one possible implementation, S7 specifically includes sub-steps S701 to S707: S701: Preprocess the image of the single line to be detected to obtain the binary image of the foreground of the single line to be detected, and extract multiple candidate contours to be detected from the binary image of the foreground of the single line to be detected.

[0114] S702: Calculate the contour area and contour perimeter of each candidate contour to be detected. When the contour area and contour perimeter meet the preset contour screening conditions, the candidate contour to be detected is determined as a valid single-line contour to be detected, and proceed to S703. When the contour area and contour perimeter do not meet the preset contour screening conditions, the single-line diameter detection result is determined as a broken wire.

[0115] S703: Calculates the minimum bounding rectangle of the valid single-line contour to be detected using the rotating caliper algorithm, and uses the length of the short side of the minimum bounding rectangle as the current pixel width.

[0116] S704: Compare the current pixel width with the acceptable width range in the standard single-line template. If the current pixel width is within the acceptable range, proceed to S705. If the current pixel width is not within the acceptable range, the single-line diameter detection result is determined to be unacceptable.

[0117] S705: Calculate the current Hu moment based on the normalized central moment of the valid single-line profile to be detected.

[0118] S706: Calculate the Euclidean distance between the current Hu moment and the mean Hu moment template in the standard single-line template.

[0119] S707: Compare the Euclidean distance with the shape determination threshold. When the Euclidean distance is less than or equal to the shape determination threshold, the single-wire diameter detection result is determined to be qualified. When the Euclidean distance is greater than the shape determination threshold, the single-wire diameter detection result is determined to be deformed.

[0120] Specifically, a pre-fixed region of interest (ROI) is extracted from the real-time acquired image of the single line to be detected, resulting in the ROI image corresponding to the single line. Gaussian filtering is applied to the ROI image, followed by binarization using the Otsu adaptive thresholding algorithm, yielding a binary foreground image of the single line to be detected. Morphological closing operations are then performed on the binary foreground image to fill in minute holes and minor breaks at the contour edges within the foreground region. Candidate contours are then extracted, and the contour point sequences of each candidate contour are Gaussian smoothed to reduce the impact of edge jaggedness and local unevenness caused by image noise on subsequent detection results. The image of the single line to be detected employs the same ROI extraction, filtering, binarization, contour repair, and contour smoothing methods as when establishing the standard single line template, ensuring consistent processing conditions between the image of the single line to be detected and the standard single line image.

[0121] Furthermore, the contour area and perimeter of each candidate contour to be detected are calculated separately, and the candidate contours are filtered for validity according to the preset contour filtering conditions used when establishing the standard single-line template. When the contour area and perimeter of a candidate contour to be detected simultaneously meet the preset contour filtering conditions, the candidate contour to be detected is determined as a valid single-line contour to be detected. When there are multiple candidate contours to be detected that meet the conditions, the candidate contour with the largest contour area is selected as the valid single-line contour to be detected.

[0122] Furthermore, when no valid single-line contour is detected in the binary image of the single-line foreground, it indicates that no foreground region matching the single-line contour features has been formed within the region of interest. The corresponding single-line diameter detection result is then judged as a broken wire, and an abnormal alarm is triggered. When a valid single-line contour is detected, the pixel width and Hu rectangular feature of the valid single-line contour are calculated.

[0123] Furthermore, the set of contour points of the valid single-line contour to be detected is obtained, and the minimum bounding rectangle of the contour point set is calculated by the rotating caliper algorithm. The length of the short side of the minimum bounding rectangle is used as the current pixel width of the single line to be detected. Since the minimum circumscribed rotation rectangle can rotate with the tilt direction of the single line profile to be detected, its short side length can be used to represent the current pixel width, which can reduce the impact of changes in the imaging direction of the single line to be detected on the line diameter detection results.

[0124] Furthermore, the lower limit of the acceptable width range is read from the standard single-line template. and the upper limit of the acceptable width range and the current pixel width The width test result is determined by comparing it with the acceptable width range and using the following formula:

[0125] in, This indicates the current pixel width. When the current pixel width is within the acceptable range, the width detection result is determined to be acceptable, and shape feature comparison continues. When the current pixel width is not within the acceptable range, the width detection result is determined to be unacceptable.

[0126] Furthermore, when the current pixel width is greater than the upper limit of the acceptable width range, i.e. When the current pixel width is less than the lower limit of the acceptable width range, the corresponding anomaly type is determined to be "too thick". When the anomaly is identified, it is determined to be too thin. By comparing the current pixel width with the acceptable width range established under the same imaging pose and the same region of interest, the perspective scaling effect on both the standard single line and the single line to be detected cancels each other out during the comparison process, without having to convert the pixel width to an absolute physical size.

[0127] Furthermore, for the valid single-line profile to be detected, the same calculation method as the standard Hu moments is used to calculate the central moments and normalized central moments of the valid single-line profile to be detected, and seven Hu moment invariants are calculated based on the normalized central moments. Logarithmic operations are then performed on the absolute values ​​of the seven Hu moment invariants to obtain seven current Hu moment components, which are then constructed in the same order as the standard Hu moments. The current Hu moment is used to characterize the overall shape of the single-line profile to be detected, and to identify shape anomalies such as local flattening, gaps, or burrs that are difficult to accurately reflect by pixel width alone.

[0128] Furthermore, the Hu moment mean template is read from the standard single-line template. Calculate the Euclidean distance between the current Hu moment and the Hu moment mean template:

[0129] in, Represents Euclidean distance. This represents the number of Hu moment invariants. Represents the current Hu moment's th... Each Hu moment component, Represents the first value of the Hu moment mean template. Each Hu moment component. The Euclidean distance is used to characterize the shape difference between the current single-line profile to be detected and the qualified standard single-line profile. The smaller the Euclidean distance, the closer the profile shapes of the two are.

[0130] Furthermore, the Euclidean distance Shape determination threshold The shape determination threshold is set between 0.2 and 0.4 and adjusted based on actual samples. When the Euclidean distance is not greater than the shape determination threshold, it indicates that the difference between the current contour shape of the single line to be detected and the Hu moment mean template is within the allowable range, and the shape detection result is determined to be qualified. When the Euclidean distance is greater than the shape determination threshold, it indicates that the current contour of the single line to be detected has changed significantly relative to the standard single line contour, and the single line diameter detection result is determined to be deformed. Deformation includes local flattening, notches, or burrs.

[0131] Furthermore, by combining the width detection result of the current pixel width and the shape detection result of the Euclidean distance, the final single-line diameter detection result is determined:

[0132] When the current pixel width is within the acceptable width range and the Euclidean distance is not greater than the shape determination threshold, the single-line diameter detection result is judged as acceptable. In other cases, the single-line diameter detection result is judged as unacceptable, and the anomaly type is determined as too thick, too thin, or deformed based on the comparison results of the current pixel width with the acceptable width range and the comparison results of the Euclidean distance with the shape determination threshold.

[0133] Furthermore, when the single-wire diameter detection result is broken wire, too thick, too thin, or deformed, the image of the corresponding single wire to be detected is saved, and the outline of the valid single wire to be detected and the anomaly type are marked in the image. At the same time, an alarm code is sent to the PLC of the stranding machine via Modbus TCP, and the timestamp, single wire number, current pixel width, Hu moment Euclidean distance, and anomaly type are written to the SQLite database to realize anomaly alarm and traceability of detection results.

[0134] In this embodiment of the invention, by preprocessing the image of the single line to be detected and extracting candidate contours, the impact of image noise, illumination changes, and background interference on the detection results can be reduced. By combining contour area and contour perimeter to screen valid single line contours to be detected, non-target contours such as dust and reflective debris can be excluded, and broken wires can be identified in a timely manner when no valid contour is detected. By calculating the minimum circumscribed rectangle of rotation using the rotating caliper algorithm and using its short side length as the current pixel width, the impact of tilt or directional changes of the single line to be detected on the wire diameter measurement can be reduced. By comparing the current pixel width with the acceptable width range in the standard single line template, anomalies such as excessive thickness and thinness can be identified without pixel-to-millimeter absolute calibration. By calculating the current Hu moment and its Euclidean distance with the Hu moment mean template, the shape difference between the single line contour to be detected and the acceptable standard single line contour can be quantified, and deformations such as local flattening, gaps, or burrs can be identified. Therefore, by using width features and shape features for joint judgment, the comprehensiveness, accuracy, and reliability of single line diameter detection can be improved, and online detection of various anomalies such as broken wires, excessive thickness, excessive thinness, and deformation can be achieved.

[0135] In one possible implementation, it also includes: The physical numbering of multiple valid single-line contours to be detected in each image of the single line to be detected is assigned, and the detection results of each single line to be detected are stored independently and anomaly alarms are triggered according to the physical number.

[0136] Specifically, suppose that the stranding machine disc has evenly distributed... The single line to be tested, and The incremental encoder mounted on the main shaft of the disc generates a signal per revolution. If there are 1 pulse, then the encoder pulse interval between two adjacent single lines to be detected is:

[0137] in, This indicates the encoder pulse interval between two adjacent single wires to be tested. This indicates the number of pulses generated per revolution of the incremental encoder. This indicates the number of individual lines to be detected, evenly distributed on the disk. Each encoder pulse interval triggers the industrial camera to capture an image of the individual line to be detected.

[0138] Furthermore, because the field of view of the industrial camera covers a certain angular range of the disk, multiple lines to be detected appear simultaneously in each image of the single line to be detected, typically 4 to 6. Each valid single line to be detected in the image of each single line to be detected is assigned a 1 to 6-100 mm profile. One of the physical numbers, and ensure that the physical number of the same single line to be detected remains consistent in consecutive frames.

[0139] Furthermore, a pulse counter corresponding to the incremental encoder is set. A manual calibration is performed before the stranding machine's first run. The single wire to be tested, numbered 1, is marked on the disc. The trigger phase of the industrial camera is adjusted so that when the single wire to be tested, numbered 1, is located at the center of the field of view of the region of interest, the pulse counter satisfies... Subsequently, each time an encoder pulse interval is elapsed and the industrial camera is triggered to capture an image, the pulse counter is controlled. Increment by 1.

[0140] Furthermore, the reference number in the image of the current single line to be detected is determined based on the current count value of the pulse counter:

[0141] in, This indicates the reference number corresponding to the single line to be detected located at the center of the field of view within the current triggering cycle. This indicates the current count value of the pulse counter. This indicates the modulo operation.

[0142] Furthermore, extract all valid single-line contours from the image of the current single-line to be detected, and determine the horizontal pixel coordinates of the center point of each valid single-line contour. Sort the data from left to right. The valid single-line contour closest to the center of the region of interest is identified as the central contour, and its index in the sorting results is denoted as [index]. Then the sorted number is 1. The physical number of each valid single-line profile to be detected is:

[0143] When the modulo result is 0, the physical number is taken as... Indicates the sorted order of the first... The physical number of a valid single-line profile to be detected. , Indicates the reference number, This represents the index of the center contour in the sorting results. Therefore, the valid single-line contour closest to the center of the field of view is assigned a reference number, the numbers of valid single-line contours to the left of the center contour are decremented by 1, and the numbers of valid single-line contours to the right of the center contour are incremented by 1.

[0144] Furthermore, between consecutive frames of the image of the single line to be detected, a pulse counter is activated after each encoder pulse interval. Increment by 1, base number The corresponding progression 1 and according to The model is taken so that each physical number rolls synchronously with the rotation of the disk, so as to maintain the number correspondence of the same single line to be detected in adjacent frames and avoid the same single line to be detected being repeatedly numbered or missing in the same frame.

[0145] Furthermore, to prevent misalignment of the physical number of the single line to be detected due to encoder pulse loss, trigger jitter, or disk slippage, a historical feature vector is maintained for each physical number corresponding to the single line to be detected:

[0146] in, Indicates the physical number is The historical feature vector corresponding to the single line to be detected. This indicates the center horizontal position of the corresponding valid single-line profile to be detected. This indicates the pixel width of the corresponding single line to be detected. This represents the area of ​​the corresponding valid single-line profile to be detected.

[0147] Furthermore, when continuous When a systematic jump occurs in the single-line feature to be detected corresponding to the same physical number within a frame, number verification is automatically triggered. Systematic jumps include positional shifts in the effective detectable line profile exceeding half the spacing between adjacent detectable lines, or changes in the pixel width of a detectable line relative to its corresponding historical average exceeding ±15%.

[0148] Furthermore, after triggering the number verification, the feature vectors of each valid line contour in the image of the current line to be detected are matched with the historical feature vectors corresponding to each physical number in the previous frame using nearest neighbor matching. When a match is successful, the valid line contours that have successfully matched retain their original physical numbers, and the pulse counter is adjusted according to the matching result. The cumulative error. When two consecutive numbering verifications fail, the current state is judged as a serious anomaly, triggering an alarm and prompting the operator to recalibrate the numbering system. Serious anomalies include incremental encoder failure or slippage of the stranding machine disc.

[0149] Furthermore, for each physical identifier, the pixel width sequence, Hu-moment Euclidean distance, and alarm record corresponding to the single line to be detected are stored independently. For example, when The image of the single line to be detected Furthermore, if there are 3 single lines to be detected in the image of the single line to be detected from left to right, and the middle single line to be detected is located in the center of the field of view, then the physical number of the single line to be detected on the left is determined to be 4, the physical number of the single line to be detected in the middle is determined to be 5, and the physical number of the single line to be detected on the right is determined to be 6.

[0150] Furthermore, when any single wire corresponding to a physical number is determined to be broken, too thick, too thin, or deformed, the image of the current single wire to be inspected is automatically saved, and the corresponding valid single wire outline and abnormality type are marked in the image. Simultaneously, a corresponding alarm code is sent to the PLC of the stranding machine via Modbus TCP, with the alarm mode configured as recording only, audible and visual alert, or emergency stop.

[0151] Furthermore, the timestamp corresponding to the anomaly, the physical number of the single wire to be inspected, the current pixel width, the Hu moment Euclidean distance, and the anomaly type are written into the SQLite database, and the qualified and abnormal inspection data of each single wire to be inspected are stored separately according to the physical number. The inspection data are periodically summarized to generate SPC control charts, which are used to analyze the correlation between the wire diameter change of the single wire to be inspected and process parameters such as tension, stranding machine running speed, and die wear.

[0152] In this embodiment of the invention, by determining the pulse interval corresponding to adjacent single lines based on the number of single lines on the disk and the number of pulses per encoder revolution, the image acquisition time can correspond to the disk's rotation position. By combining pulse counters, reference numbers, and horizontal position sorting of the contour center, physical numbers are assigned to multiple valid single-line contours to be detected in the same frame. This establishes a correspondence between the image contour and the actual single lines on the disk, and the numbering progresses synchronously with disk rotation, thereby reducing duplicate and missing numbers. By maintaining a historical feature vector for each physical number, consisting of center position, pixel width, and contour area, and performing nearest neighbor matching and number correction when systematic jumps occur in consecutive frames, number misalignment caused by encoder pulse loss, trigger jitter, and disk slippage can be reduced, improving numbering stability and fault tolerance during multi-rotation continuous operation. By independently storing the width sequence, Hu moment Euclidean distance, and alarm records of each single line to be detected according to its physical number, abnormal single lines and their historical changes can be accurately traced. By saving abnormal images, sending alarm codes to the PLC, and writing abnormal data to the database when broken wire, excessively thick wire, excessively thin wire, or deformation is detected, timely location of abnormalities, graded alarms, and production control can be achieved. At the same time, SPC control charts can be generated using long-term detection data, and the correlation between wire diameter changes and tension, running speed, and mold wear can be analyzed, thus providing a data foundation for quality traceability and production process optimization.

[0153] Reference manual attached Figure 2 The diagram shows a schematic of a single-line diameter detection system based on relative vision provided in an embodiment of the present invention.

[0154] The present invention also provides a single-line diameter detection system 20 based on relative vision, applied to the above-mentioned single-line diameter detection method based on relative vision, comprising: Processor 201.

[0155] The memory 202 stores computer-readable instructions, which, when executed by the processor 201, implement the single-line diameter detection method based on relative vision as described in the method embodiment.

[0156] The single-line diameter detection system 20 based on relative vision provided by the present invention can perform the above-mentioned single-line diameter detection method based on relative vision and achieve the same or similar technical effects. To avoid repetition, the present invention will not elaborate further.

[0157] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. The scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for detecting the diameter of a single line based on relative vision, characterized in that, include: S1: Acquire multiple standard single-wire images taken by the stranding machine under normal operating conditions; S2: Preprocess each of the standard single-line images to obtain multiple standard single-line foreground binary images; S3: Extract the standard single-line contour corresponding to each of the standard single-line foreground binary images; S4: Based on each of the standard single-line contours, construct the standard Hu moments for each of the standard single-line foreground binary images; S5: Construct a standard single-line template based on the standard Hu moments of each of the standard single-line foreground binary images; S6: Real-time acquisition of images containing the single wire to be inspected captured by the stranding machine during the production process; S7: Compare the image of the single line to be detected with the standard single line template to determine the single line diameter detection result.

2. The single-line diameter detection method based on relative vision according to claim 1, characterized in that: S1 specifically includes: S101: The industrial camera, fixed-focus lens and LED backlight are rigidly fixed above the disc of the stranding machine, and the shooting angle of the industrial camera, the focal length of the fixed-focus lens and the region of interest are fixed. S102: An incremental encoder is installed on the disc spindle of the stranding machine, and the pulse signal output by the incremental encoder is used as the trigger signal of the industrial camera. S103: Place qualified standard single wires into the stranding machine and control the stranding machine to operate normally; S104: When the qualified standard single line moves to the region of interest, the industrial camera is triggered to take pictures of the qualified standard single line in sequence according to the pulse signal output by the incremental encoder, so as to obtain multiple images of the standard single line.

3. The single-line diameter detection method based on relative vision according to claim 1, characterized in that: S2 specifically includes: S201: Extract the region of interest from each of the standard single-line images to obtain the region of interest image corresponding to each of the standard single-line images; S202: Perform Gaussian filtering on each of the region of interest images to obtain multiple filtered region of interest images; S203: Using the Otsu adaptive thresholding algorithm, each of the filtered region of interest images is binarized to obtain multiple standard single-line foreground binary images.

4. The single-line diameter detection method based on relative vision according to claim 1, characterized in that: S3 specifically includes: S301: Perform morphological closing operations on each of the standard single-line foreground binary images to obtain multiple contour-repaired binary images; S302: Extract candidate contours from each of the contour restoration binary images, and perform Gaussian smoothing on the contour point sequence of each candidate contour to obtain multiple smooth candidate contours. S303: Calculate the contour area and contour perimeter of each of the smooth candidate contours, and determine the smooth candidate contour as a valid candidate contour if the contour area and contour perimeter meet the preset contour screening conditions. S304: For each of the contour restoration binary images, when there is only one valid candidate contour in the contour restoration binary image, the valid candidate contour is determined as the corresponding standard single-line contour; when there are multiple valid candidate contours in the contour restoration binary image, the valid candidate contour with the largest contour area is determined as the corresponding standard single-line contour, thus obtaining the standard single-line contour corresponding to each of the standard single-line foreground binary images.

5. The single-line diameter detection method based on relative vision according to claim 1, characterized in that: After S3 and before S4, it also includes: Using the rotating caliper algorithm, the minimum bounding rotation rectangle of each of the standard single-line contours is calculated, and the short side length of the minimum bounding rotation rectangle is used as the standard pixel width of the corresponding standard single-line foreground binary image. Calculate the average pixel width based on the standard pixel width of each of the aforementioned standard single-line foreground binary images; Calculate the standard deviation of pixel width based on the standard pixel width and the mean pixel width of each standard single-line foreground binary image; Based on the mean pixel width and the standard deviation of pixel width, the acceptable width range is determined by introducing a process tolerance coefficient or a width ratio tolerance.

6. The single-line diameter detection method based on relative vision according to claim 1, characterized in that: S4 specifically includes: S401: Calculate the central moments of each of the standard single-line profiles respectively, and calculate the normalized central moments of each of the standard single-line profiles based on the central moments and profile areas of each of the standard single-line profiles. S402: Based on the normalized central moments of each of the standard single-line profiles, calculate the multiple Hu moment invariants corresponding to each of the standard single-line profiles; S403: Perform logarithmic operations on the absolute values ​​of each of the Hu moment invariants to obtain the Hu moment components corresponding to each of the standard single-line profiles; S404: Construct the standard Hu moments of the corresponding standard single-line foreground binary image based on each Hu moment component corresponding to the same standard single-line contour.

7. The single-line diameter detection method based on relative vision according to claim 5, characterized in that: S5 specifically includes: S501: Sum the standard Hu moments corresponding to each of the standard single-line foreground binary images and calculate the average value to obtain the Hu moment mean template; S502: Associate and save the mean pixel width, the standard deviation of pixel width, the lower limit of the acceptable width range, the upper limit of the acceptable width range, and the Hu moment mean template to construct the standard single-line template.

8. The single-line diameter detection method based on relative vision according to claim 1, characterized in that: After S5 and before S6, it also includes: The standard single-line template is validated. If the validation passes, the standard single-line template is deemed valid and proceeds to step S6. If the validation fails, the standard single-line template is deemed invalid and the standard single-line template is regenerated.

9. The single-line diameter detection method based on relative vision according to claim 1, characterized in that: Specifically, S7 includes: S701: Preprocess the image of the single line to be detected to obtain a binary image of the foreground of the single line to be detected, and extract multiple candidate contours to be detected from the binary image of the foreground of the single line to be detected. S702: Calculate the contour area and contour perimeter of each of the candidate contours to be detected; when the contour area and contour perimeter meet the preset contour screening conditions, determine the candidate contour to be detected as a valid single-line contour to be detected, and proceed to S703; when the contour area and contour perimeter do not meet the preset contour screening conditions, determine the single-line diameter detection result as a broken wire. S703: Calculate the minimum bounding rectangle of the effective single-line contour to be detected using the rotating caliper algorithm, and use the short side length of the minimum bounding rectangle as the current pixel width; S704: Compare the current pixel width with the acceptable width range in the standard single-line template; when the current pixel width is within the acceptable width range, proceed to S705; when the current pixel width is not within the acceptable width range, determine the single-line diameter detection result as unacceptable width. S705: Calculate the current Hu moment based on the normalized central moment of the effective single-line profile to be detected; S706: Calculate the Euclidean distance between the current Hu moment and the mean Hu moment template in the standard single-line template; S707: Compare the Euclidean distance with the shape determination threshold; when the Euclidean distance is less than or equal to the shape determination threshold, determine the single-line diameter detection result as qualified; when the Euclidean distance is greater than the shape determination threshold, determine the single-line diameter detection result as deformed.

10. A single-line diameter detection system based on relative vision, characterized in that, include: processor; A memory storing computer-readable instructions, which, when executed by the processor, implement the single-line diameter detection method based on relative vision as described in any one of claims 1 to 9.