Optical fiber image guide defect detection method and device, storage medium and electronic equipment

By employing a multi-scale morphological gradient fusion segmentation algorithm and multi-feature analysis, the problem of distinguishing between texture and surface defect features in fiber optic image bundle defect detection was solved, achieving highly accurate defect determination.

CN122391095APending Publication Date: 2026-07-14CHINA BUILDING MATERIALS ACADEMY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA BUILDING MATERIALS ACADEMY CO LTD
Filing Date
2026-04-02
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing methods for detecting defects in optical fiber image bundles are unable to accurately distinguish between the texture of individual optical fibers and surface defect features, resulting in insufficient accuracy of the detection results.

Method used

A multi-scale morphological gradient fusion segmentation algorithm is adopted, which combines texture features, multi-directional multi-scale energy features, gray-scale statistical features and contour morphology features. Potential defect areas are determined by matching degree and overall similarity. After removing surface defects, internal defects are determined.

Benefits of technology

It improves the accuracy of defect detection in fiber optic image bundles, avoids bias in judgment based on a single feature through comprehensive feature analysis, and ensures that the detection results are highly consistent with the actual features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391095A_ABST
    Figure CN122391095A_ABST
Patent Text Reader

Abstract

The application discloses a kind of optical fiber image transmission beam defect detection method, device, storage medium and electronic equipment.The method comprises the following steps: collecting the multiple optical fiber images of the target detection position of the optical fiber image transmission beam to be measured;Determine the potential defect area in multiple optical fiber images based on multi-scale morphological gradient fusion segmentation algorithm;Extract the texture feature of potential defect area, multi-direction multi-scale energy feature, gray statistical feature and contour morphological feature, determine the matching degree of contour morphological feature and the overall similarity of texture feature, multi-direction multi-scale energy feature and gray statistical feature, determine the surface defect in potential defect area according to matching degree and overall similarity;Determine the internal defect in potential internal defect area by the adaptation degree of texture feature, multi-direction multi-scale energy feature, gray statistical feature and contour morphological feature of potential internal defect area and preset internal defect feature threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of detection technology, and in particular to a method, apparatus, storage medium and electronic equipment for detecting defects in optical fiber image bundles. Background Technology

[0002] Currently, fiber optic image bundle defect detection often employs microscope magnification combined with instrumental measurement methods such as mechanical diameter method, near-field refraction method, and transverse interferometry. The detection principle of these methods primarily relies on direct observation of the fiber surface. However, fiber optic image bundles are composed of tens of thousands or even millions of regularly stacked fiber filaments. This dense filament structure creates complex surface background interference, making it difficult for detection methods to accurately distinguish between the fiber filament's own texture and surface defect features. This leads to errors in feature capture and accurate judgment of surface defects, ultimately resulting in insufficient accuracy in surface defect detection results. Summary of the Invention

[0003] In view of the above problems, this application provides a method, apparatus, storage medium and electronic device for detecting defects in optical fiber image bundles.

[0004] To solve the above-mentioned technical problems, this application proposes the following solution: In a first aspect, this application provides a method for detecting defects in optical fiber image bundles. The method includes: acquiring multiple optical fiber images of the target detection location of the optical fiber image bundle under test; determining potential defect regions in the multiple optical fiber images based on a multi-scale morphological gradient fusion segmentation algorithm; extracting texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphological features of the potential defect regions; determining the matching degree of the contour morphological features and the overall similarity of the texture features, multi-directional multi-scale energy features, and gray-scale statistical features; determining surface defects in the potential defect regions based on the matching degree and overall similarity; removing the determined surface defects from the potential defect regions to obtain internal defect regions to be screened; selecting regions from the internal defect regions to be screened that appear in at least one working state with light injection in the multiple optical fiber images and do not appear in the working state without light injection, and determining them as potential internal defect regions; determining internal defects in the potential internal defect regions by the fit between the texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphological features of the potential internal defect regions and a preset internal defect feature threshold.

[0005] Secondly, this application provides a fiber optic image bundle defect detection device, which includes: The acquisition module is used to acquire multiple fiber images of the target detection location in the fiber optic image bundle under test. The determination module is used to determine potential defect regions in multiple fiber optic images based on a multi-scale morphological gradient fusion segmentation algorithm. The first detection module is used to extract texture features, multi-directional multi-scale energy features, gray-scale statistical features and contour morphology features of potential defect areas, determine the matching degree of contour morphology features and the overall similarity of texture features, multi-directional multi-scale energy features and gray-scale statistical features, and determine surface defects in potential defect areas based on the matching degree and overall similarity. The filtering module is used to remove the identified surface defects from the potential defect area to obtain the internal defect area to be filtered. From the internal defect area to be filtered, the area that appears in at least one working state with light injection in multiple fiber images and does not appear in the working state without light injection is identified as the potential internal defect area. The second detection module is used to determine the internal defects in the potential internal defect region by matching the texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphology features of the potential internal defect region with the preset internal defect feature threshold.

[0006] To achieve the above objectives, according to a third aspect of this application, a storage medium is provided, the storage medium including a stored program, wherein, when the program is running, the device where the storage medium is located is controlled to execute the fiber optic image bundle defect detection method of the first aspect.

[0007] To achieve the above objectives, according to a fourth aspect of this application, an electronic device is provided, the device including at least one processor, and at least one memory and bus connected to the processor; wherein the processor and memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the fiber optic image bundle defect detection method of the first aspect described above.

[0008] By employing the above-described technical solution, the technical solution provided in this application has at least the following advantages: This application characterizes the inherent properties of surface defects from different dimensions by extracting texture features, multi-directional and multi-scale energy features, gray-scale statistical features, and contour morphology features from potential defect regions. Contour morphology features focus on the geometric shape and edge features of surface defects; texture features capture the texture distribution and detailed changes of surface defects; multi-directional and multi-scale energy features characterize the energy response patterns of surface defects at different scales and directions; and gray-scale statistical features reflect the gray-scale distribution and numerical characteristics of the surface defect region. These four types of features form a complementary feature representation system, quantifying the feature differences between surface defects and normal areas of the optical fiber.

[0009] Based on this, this application determines the matching degree of contour morphology features and the overall similarity of three types of features: texture, multi-directional multi-scale energy, and grayscale statistics. Surface defect determination is carried out through two-dimensional feature analysis. The matching degree of contour morphology features provides an intuitive morphological basis for surface defect identification from a geometric perspective, enabling the identification of regions that conform to the morphological features of surface defects. The overall similarity of the three types of features is quantitatively verified at the pixel-level detail level. Through comprehensive similarity analysis of multiple features, subtle differences in features between surface defects and normal fiber optic regions are distinguished. The two determination dimensions corroborate and constrain each other, avoiding the judgment bias caused by single feature analysis. This application ultimately makes a comprehensive judgment based on the matching degree of contour morphology features and the overall similarity of the three types of features. Only when both dimensions meet the judgment criteria for surface defects is the potential defect region determined as a surface defect. This comprehensive judgment method provides both intuitive geometric basis and quantitative support from multiple detailed features for surface defect identification, ensuring that the judgment results highly match the actual characteristics of the surface defects and improving the accuracy of surface defect determination.

[0010] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0011] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart illustrating a fiber optic image bundle defect detection method provided in an embodiment of this application is shown. Figure 2 This paper shows a schematic diagram of the structure of a fiber optic image bundle defect detection system provided in an embodiment of this application; Figure 3 This paper shows a schematic diagram of the structure of an image acquisition module provided in an embodiment of this application; Figure 4 A schematic diagram of an optical fiber defect provided in an embodiment of this application is shown; Figure 5 A schematic diagram of a defect detection result provided in an embodiment of this application is shown; Figure 6 This paper shows a schematic diagram of the structure of a fiber optic image bundle defect detection device provided in an embodiment of this application; Figure 7A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0012] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.

[0013] In the embodiments of this application, the terms "first," "second," etc., do not have a logical or temporal dependency, nor do they limit the quantity or execution order. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another.

[0014] In this application, the term "at least one" means one or more, and the term "multiple" means two or more.

[0015] It should also be understood that the term “if” can be interpreted as “when” or “upon”, or “in response to determination” or “in response to detection”. Similarly, depending on the context, the phrase “if determination…” or “if detection [the stated condition or event]” can be interpreted as “when determination…” or “in response to determination…” or “when detection [the stated condition or event]” or “in response to detection [the stated condition or event]”.

[0016] Currently, defect detection in fiber optic image bundles is primarily based on microscopic observation, supplemented by instrumental measurement methods such as mechanical diameter measurement, near-field refraction measurement, and transverse interferometry. These methods all rely on direct observation of the fiber surface as their core principle. However, fiber optic image bundles are composed of tens of thousands or even millions of neatly stacked fiber filaments. This dense arrangement of filaments creates a complex, native texture background on the fiber surface. This background significantly interferes with detection, making it difficult for existing methods to effectively distinguish the texture features of the individual fiber filaments from surface defects. This leads to deviations in the feature capture and accurate determination of surface defects, ultimately resulting in insufficient accuracy in the surface defect detection results of fiber optic image bundles.

[0017] The following section provides a detailed explanation of the fiber optic image bundle defect detection method in conjunction with the accompanying drawings. Figure 1 This is a flowchart illustrating a method for detecting defects in an optical fiber image bundle, as provided in this application. Specifically, it includes the following steps: Step 110: Acquire multiple fiber images of the target detection location in the fiber optic image bundle under test.

[0018] Before conducting the defect detection of the fiber optic image bundle to be measured, first build and conduct joint debugging on each component module of the detection system. As Figure 2 shown, mount the fiber optic image bundle to be measured on the motor (2) of the rotating coil. At the same time,配套搭建顶部光源模块(1)、激光测径仪(3)、图像采集模块(4)及主控处理模块(5)。其中,转动线圈的电机作为光纤传送的动力核心,可按预设参数带动被测光纤传像束匀速行进,为连续检测提供稳定的运动基础。顶部光源模块可实现开关状态切换,通过开启状态向光纤注入光线以增强内部缺陷特征显示,关闭状态则捕捉光纤表层自然成像,两种状态配合完成内外缺陷的区分。激光测径仪经标准量块或标准光纤校准后,以“连续输出”模式同步采集纤径数据,实时传输至主控处理模块,同时对超出预设范围的异常纤径触发标记,为目标检测位置的确定提供依据。如 Figure 3 shown, the image acquisition module integrates two pairs of uniformly arranged lateral LED illumination groups (401), a camera (402), and an optical fiber collection module (403). The LED illumination groups form a uniform and stable imaging environment through light field superposition. The camera matches the exposure parameters according to the fiber optic transmission speed and synchronously captures the fiber optic images under different light source states at the same position to ensure clear capture of defect features. The optical fiber collection module synchronously receives the optical fibers that have completed image acquisition and realizes orderly storage to ensure the continuity of the detection process. The main control and processing module, as the control and data processing center of the system, is responsible for coordinating the operation timing of each module, receiving and storing the data of the laser diameter gauge and the image acquisition module, and simultaneously executing algorithms such as image preprocessing, feature extraction, and defect determination.

[0019] Before image acquisition, conduct a full-process cleaning treatment of surface dust removal and static elimination on the fiber optic image bundle to be measured that travels uniformly with the motor motion system. First, pass through a low-speed rotating ultra-fine soft brush wheel in the opposite direction to the traveling direction of the fiber optic image bundle to be measured. With the gentle rotation of the brush wheel, sweep away large particle dust and loose impurities attached to the fiber optic surface. Then, make the fiber optic image bundle to be measured pass through the effective working area of the ion wind rod. Use the ion wind to neutralize the static electricity on the fiber optic surface, make the fine dust adsorbed on the surface lose its adsorption force, and then配合侧向吹扫的方式,将这类微尘彻底吹离光纤表面。最后让被测光纤传像束与低速反向旋转的高纯度粘性清洁硅胶轮相接触,通过硅胶轮的粘性吸附作用,清除光纤表面残留的极细微颗粒杂质。通过这一系列操作确保被测光纤传像束表面洁净、无静电,从根源上避免表面杂质与静电对成像造成干扰,防止出现成像误判。

[0020] It should be noted that there are some parts in the original text that seem to be incomplete or have incorrect expressions in Chinese. I have translated it as accurately as possible based on the existing content.After surface cleaning of the fiber optic image bundle under test, two sets of laterally symmetrically arranged LED light sources are used to illuminate the imaging area. Through the superposition effect of the light fields from the two sets of symmetrical LED light sources, a uniform and stable illumination field is formed in the imaging area at the target detection position of the fiber optic image bundle under test, avoiding uneven brightness in the imaging area and ensuring consistent illumination across multiple image acquisitions. Subsequently, by pre-setting the switching sequence of multiple sets of top light sources and simultaneously matching and adjusting the exposure time and shooting mode of the industrial CCD camera, the industrial CCD camera is driven to synchronously and continuously capture images of the same target detection position according to the actual uniform transmission speed of the fiber optic image bundle under test. This acquires fiber images under two different operating states: when the top light source is on (light injection) and when the top light source is off (no light injection), thus obtaining multiple fiber images of the target detection position. Throughout the entire process of image acquisition at the target detection position of the fiber optic image bundle by the industrial CCD camera, a bottom turntable device operates synchronously, orderly winding the fiber optic image bundle after image acquisition at that position onto the bottom turntable device, achieving automated collection of the fiber optic image bundle under test. Figure 4 A schematic diagram of an optical fiber defect provided in an embodiment of this application is shown.

[0021] After image acquisition, to address potential issues of localized overexposure or underexposure, this application performs grayscale processing on the acquired image to enhance the distinction between defective and normal areas. The specific process is as follows: First, a row-by-row, column-by-column pixel traversal algorithm is used, starting from the top left corner of the image, to read the grayscale value of each pixel in a left-to-right, top-to-bottom order. After acquiring all grayscale information, the total pixel count n is directly calculated based on the image resolution. For example, for a 2448×652 resolution image, n = 2448×652 = 1596096. To accurately statistically analyze the distribution of each grayscale level, an array with a length matching the total number of grayscale levels L is used to store the pixel frequency n of each grayscale level. i The array index directly corresponds to the grayscale level, and the value within the array represents the number of pixels at that grayscale level. The total number of grayscale levels, L, is determined based on the output format of the industrial CCD camera and remains consistent with the system initialization parameters; for a common 8-bit camera, L=256. Considering the balance between preserving defect information and simplifying redundant grayscale levels, the new total number of grayscale levels, L... new Take 1 / 2 to 2 / 3 of the original total number of gray levels L (e.g., when L=256, L) new =128), and then based on the discrete cumulative distribution function, the original gray level k and the new gray level S are established. k The mapping relationship is calculated using the following formula: ,in This is the cumulative pixel frequency value for gray levels 0 to k. `round()` is the rounding function. For example, for an image with n=1596096, L... new =128, k=50 =287297, then S k =round[287297 / 1596096×127]≈23. This calculation method achieves a uniform mapping from the original gray level to the new gray level. To further optimize the gray level distribution and highlight defect features, the gray level range of 0-L is divided into 20 intervals at equal intervals, with each interval covering 12-13 gray levels. Subsequently, the cumulative percentage of pixels in each interval is calculated (i.e., the percentage of all gray levels in the interval). i The ratio of the sum of the values ​​to n is used to define the pixel density range (where the sum of the values ​​is greater than 15%) and the sparse range (where the sum is less than 3%). This threshold is based on statistics from 500 sets of different types of fiber optic defect images and can effectively cover the grayscale distribution characteristics of defects such as surface scratches and internal dark spots. For dense ranges, an adjustment coefficient α of 1.2-1.5 is introduced to amplify the grayscale difference between defects and normal areas. The more subtle the defect, the larger the value of α. The correction formula is S. k =round[α×S k For example, when α=1.3, the original S k =23 is adjusted to 30. For sparse regions, to reduce interference by merging redundant gray levels, an adjustment coefficient β of 0.6-0.8 is introduced. The lower the proportion of extreme gray levels, the smaller the value of β. The correction formula is S. k ''=round[β×S k ], such as when β=0.7, the original S k =5 is adjusted to 3. After completing the mapping adjustment, a mapping table between the original gray level and the new gray level is established. The image is then traversed again, and the gray value of each pixel is replaced to generate the gray-level adjusted image. Finally, the gray-level variance before and after adjustment is calculated. To verify the contrast enhancement effect, the grayscale variance after adjustment should be increased by more than 30% compared with that before adjustment, so as to ensure that the grayscale difference between surface dust, internal broken wires and other defects and normal areas is effectively amplified.

[0022] During the acquisition of multiple images, slight vibrations in the optical fiber and minor equipment offsets can cause deviations in the spatial position of the images. To ensure the accuracy of subsequent defect region extraction and feature comparison, this application performs registration optimization on multiple images after grayscale adjustment. The specific operations are as follows: First, a two-dimensional fast Fourier transform is performed on each grayscale-adjusted optical fiber image to convert the spatial domain image into a frequency domain image. This transformation highlights the overall structural features of the image while reducing the influence of local noise. Next, conjugate multiplication is performed on any two frequency domain images, followed by normalization to obtain the cross-power spectrum. The cross-power spectrum is used to capture the correlation information between the two images in the frequency domain. An inverse Fourier transform is performed on the obtained cross-power spectrum to convert the correlation information in the frequency domain back to the spatial domain, forming a correlation peak image. Subsequently, a peak selection rule is set: the top three peaks in terms of amplitude are selected, while noise peaks with amplitudes less than 10% of the maximum peak are excluded. By identifying the coordinates and amplitudes corresponding to the effective peaks, the deviation parameters between multiple images can be accurately decomposed. The translation amount is directly determined by the peak coordinate offset. For example, when the peak coordinates are (x0, y0), the corresponding translation amount is (-x0, -y0). The rotation angle is calculated by fitting the distribution angles of multiple peaks, and the fitting error must be controlled within 0.5°. The scaling ratio is derived based on the change ratio of the peak amplitude. If the amplitude ratio is k, the corresponding scaling ratio is 1 / k. The core optimization objective is to maximize the mutual information value among multiple images. This mutual information value is calculated based on the gray-level histogram, with the formula I(X,Y)=H(X)+H(Y)-H(X,Y), where H represents the information entropy. The number of iterations is set to 100 to 200, and the convergence condition is that the change in mutual information value is less than 1×10⁻⁶. -5 The gradient descent method is used to iteratively adjust three deviation parameters: translation, rotation angle, and scaling ratio. After each iteration, the mutual information value is recalculated, and the iteration continues until the convergence condition is met. Ultimately, precise spatial alignment of multiple fiber optic images is achieved, and the coordinate deviation of the same defect area in images under different working conditions can be controlled within 1 pixel.

[0023] Step 120: Determine potential defect regions in multiple fiber optic images based on a multi-scale morphological gradient fusion segmentation algorithm.

[0024] Step 110 has completed preprocessing work such as image grayscale adjustment, registration optimization, and surface dust removal and electrostatic elimination. This not only effectively improves image contrast and corrects spatial position deviations, but also removes surface interference and some noise. However, defects in fiber optic image bundles themselves include various types such as surface dust, scratches, internal dark spots, and broken wires. The size range of different defects has significant natural differences (e.g., surface dust diameter 1-5μm, internal broken wire width 1-3μm, compared to scratch length 50-200μm, and internal dark spot diameter 3-8μm, which is quite different), and the edge morphology of various defects is mostly irregular. These inherent characteristics cannot be eliminated by preprocessing. Therefore, even if the image quality has been optimized, it is still difficult to fully adapt to the detection requirements of defects of different sizes using a single-scale segmentation algorithm. It cannot simultaneously and accurately capture the details of minute defects and the complete outline of large defects, and it is easy to miss minute defects or extract incomplete features of large defects. Therefore, this application uses a multi-scale morphological gradient fusion segmentation algorithm to determine the potential defect regions in multiple fiber optic images.

[0025] First, this application, considering the actual size range of various defects in the tested optical fiber image bundle (where surface dust diameter is typically 1-5 μm, scratch length is 50-200 μm, internal dark spot diameter is 3-8 μm, and broken wire width is 1-3 μm), constructs multi-scale asymmetric structural elements covering small, medium, and large scales. Small-scale structural elements are circular (radius corresponding to 1-2 pixels) to accommodate tiny dust particles and minor broken wires. Medium-scale structural elements are rectangular (length × width corresponding to 5-8 × 3-5 pixels) to accommodate medium-sized scratches and dark spots. Large-scale structural elements are irregular polygons (6-8 vertices) to accommodate larger areas of defects or defect clusters. This asymmetric design better conforms to the irregular shapes of various defect edges, ensuring comprehensive capture of defects of different types and sizes.

[0026] For each fiber optic image after grayscale adjustment and registration optimization, the multi-scale asymmetric structuring element constructed above is used to calculate the corresponding morphological gradient map through dilation and erosion operations (gradient map = dilated image - eroded image). This operation can highlight the grayscale difference between defects and the background, making the edge contour of defects clearer. The gradient map corresponding to the small-scale structuring element focuses on extracting the detailed features of small defects, the medium-scale gradient map focuses on presenting the overall contour of medium-sized defects, and the large-scale gradient map focuses on capturing the range information of large defects or defect clusters, avoiding the problem of missing subtle defects or incomplete features of large defects caused by a single-scale structuring element.

[0027] After obtaining the morphological gradient maps corresponding to structural elements at each scale, a preset weight coefficient is introduced to fuse the feature information of all gradient maps. The weight coefficient is determined based on the contribution analysis of structural elements at different scales to the defect features. The weight coefficient corresponding to the small-scale structural elements is set to 0.3, the medium-scale to 0.4, and the large-scale to 0.3, and the sum of the weights is 1. The defect feature information at multiple scales is integrated through the weighted summation formula (fused gradient map = small-scale gradient map × 0.3 + medium-scale gradient map × 0.4 + large-scale gradient map × 0.3) to form a fused gradient map that comprehensively reflects the features of various defects, which not only preserves the details of small defects, but also does not ignore the overall features of large defects.

[0028] Subsequently, the fused gradient map is binarized based on a preset segmentation threshold. This threshold is determined through Otsu's adaptive thresholding algorithm combined with statistical optimization of 500 sets of sample fiber optic images containing various defects, specifically set to 1.2-1.5 times the average grayscale value of the fused gradient map. When the grayscale value of a pixel in the fused gradient map is higher than this threshold, it is identified as a candidate defect pixel; otherwise, it is identified as a background pixel. After segmentation, a preliminary candidate defect region is obtained, consisting of candidate defect pixels. This region contains real defects and a small number of false defects caused by image noise.

[0029] Finally, noise filtering is performed on the preliminary defect candidate region. The preset area threshold is determined based on the statistical analysis of the area of ​​the smallest identifiable defect. Combined with the image resolution of 2448×652, the area threshold is set to 5 pixels (i.e., areas with fewer than 5 pixels in the preliminary defect candidate region are judged as isolated noise regions). The preliminary defect candidate region is traversed by a connected component analysis algorithm to identify and remove all isolated noise regions whose area does not reach the threshold. These isolated regions are mostly false defects formed by image noise or minor interference. The remaining continuous regions after removal are the potential defect regions to be further detected.

[0030] Step 130: Extract texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphology features of potential defect areas; determine the matching degree of contour morphology features and the overall similarity of texture features, multi-directional multi-scale energy features, and gray-scale statistical features; and determine surface defects in potential defect areas based on the matching degree and overall similarity.

[0031] After identifying the potential defect region, this application determines surface defects by extracting features and quantizing matching. The specific implementation process is as follows: First, the Canny edge detection algorithm is applied to the potential defect region to extract edge contours. A 5×5 Gaussian filter kernel is used to smooth the image of the potential defect region, filtering out minor noise within the region to avoid noise interfering with edge extraction accuracy. The Sobel operator is used to calculate the gradient values ​​and gradient directions in the x and y directions of the image, and the gradient magnitude of each pixel is further calculated based on the gradient values ​​to capture the edge gradient features of the image. Then, non-maximum suppression is performed on the gradient magnitude image. Neighborhood comparison is performed on the gradient magnitude of each pixel along the gradient direction, retaining only local maxima as edge candidates and eliminating non-maximum points to achieve edge refinement. Next, adaptive dual thresholds are used for edge detection and connection, where the high threshold is 1.5 times the average grayscale value of the potential defect region image, and the low threshold is 0.5 times the high threshold. Pixels with gradient magnitudes greater than a high threshold are marked as strong edge points, pixels with gradient magnitudes between the high and low thresholds are marked as weak edge points, and pixels with gradient magnitudes less than the low threshold are directly discarded. Weak edge points connected to strong edge points are then integrated into valid edges, and isolated weak edge points are discarded, thus completing the extraction of edges for potential defect regions.

[0032] Next, an eight-neighborhood-based contour tracking algorithm is used to traverse the extracted effective edges. Starting from the top left corner of the potential defect area image, pixels within the area are scanned row by row and column by column. When the first effective edge point is detected, it is taken as the contour starting point. The eight-neighborhood is used as the search range to sequentially track adjacent effective edge points until the contour starting point is returned to form a closed contour curve. At the same time, the coordinate information of all edge points during the tracking process is recorded to obtain a complete contour coordinate point set. Based on this point set, various contour morphological feature parameters are calculated sequentially. The perimeter is the sum of the Euclidean distances between all adjacent coordinate points on the contour. The area is calculated using the pixel filling method, which counts the total number of pixels within the closed contour area. The roundness is calculated using the formula roundness = 4π × area / perimeter². The minimum bounding rectangle is calculated from the contour coordinate point set using the rotating caliper method, and the rectangularity is calculated using the formula rectangularity = area / minimum bounding rectangle area. The convex hull is obtained from the contour coordinate point set using the Graham scan method, and the concavity is calculated using the formula concavity = actual contour area / convex hull area. The calculated contour morphology feature parameters such as perimeter, area, roundness, rectangularity, and concavity are first normalized using the maximum-minimum method, and each parameter value is mapped to the 0-1 interval to eliminate dimensional differences. Then, they are arranged in a preset order of perimeter, area, roundness, rectangularity, and concavity to form the contour morphology feature vector of the potential defect area.

[0033] Furthermore, based on the grayscale value distribution pattern of the potential defect area, grayscale image of this area is preprocessed with grayscale compression to map the original grayscale values ​​to a grayscale range of 0-16 levels, reducing the complexity of subsequent matrix calculations while preserving texture feature recognition. A 3×3 sliding window is then selected to traverse the entire grayscale image of the potential defect area row by row and column by column without overlap, ensuring that the sliding window covers every pixel within the area and fully captures the texture details at each location. Grayscale co-occurrence matrices are constructed in four directions: 0°, 45°, 90°, and 135°, where 0° is the horizontal rightward direction, 45° is the diagonal upward rightward direction, 90° is the vertical upward direction, and 135° is the diagonal upward leftward direction. The pixel step size in each direction is set to 1, meaning the interval between adjacent pixels is 1 pixel. For each direction, the actual frequency of grayscale value combinations of any two pixels within the sliding window at that direction and step size is counted. The frequency results are normalized to obtain the corresponding grayscale co-occurrence matrix for that direction. The rows and columns of the matrix correspond to preprocessed grayscale levels 0-16, and the element values ​​are the probabilities of occurrence of the corresponding grayscale value combinations. For each grayscale co-occurrence matrix generated for each direction, four types of texture feature parameters are calculated, with contrast calculated according to the formula... The calculation is performed where i and j are the row and column indices of the matrix, and P(i,j) is the probability value of the corresponding position in the matrix. This parameter reflects the significance of gray-level differences within the region. Correlation is calculated using the formula... calculate, These are the mean values ​​of the row and column grayscale values ​​of the matrix, respectively. These represent the standard deviations of the grayscale values ​​in the matrix's rows and columns, respectively. This parameter reflects the strength of the linear correlation between grayscale distributions within the region. Energy is calculated using the formula... The calculation reflects the uniformity of gray-level distribution and the entropy of texture fineness within the region, according to the formula. The calculation reflects the randomness of grayscale distribution and texture complexity within the region. Sixteen texture feature parameters (contrast, correlation, energy, entropy) calculated in each of the four directions are normalized using the minimax method, mapping each parameter value to the 0-1 range. This eliminates dimensional differences between parameters and prevents excessively large single parameter values ​​from biasing the feature vector. Then, the contrast, correlation, energy, and entropy parameters for each direction are sequentially arranged according to 0°, 45°, 90°, and 135°. This arranged one-dimensional numerical sequence is used to construct the texture feature vector for the potential defect region, ensuring that the vector comprehensively and accurately captures the texture distribution characteristics of different directions and dimensions within the region.

[0034] Next, combining the texture and morphological features of the defect region in the optical fiber image bundle, the db4 wavelet basis function was selected for wavelet decomposition. This wavelet basis function has good compact support and smoothness, and can capture high-frequency detail features of the defect region while preserving low-frequency overall contour features, highly adaptable to the feature extraction requirements of optical fiber defect detection. Simultaneously, based on the size and feature refinement requirements of the potential defect region, a 2-3 layer multi-scale wavelet decomposition method was adopted. Two-layer decomposition can meet the feature extraction requirements of defects of conventional size, while three-layer decomposition is suitable for capturing features of minute defects such as micro-sized internal broken wires and tiny surface dust, thus balancing detection efficiency and comprehensive feature extraction. The preprocessed grayscale image of the potential defect region was subjected to layer-by-layer two-dimensional wavelet decomposition. Each layer decomposed the current image into one low-frequency approximation component and three high-frequency detail components. The high-frequency detail components correspond to the wavelet coefficients in the horizontal, vertical, and diagonal directions, respectively. The low-frequency approximation component carries the overall feature information of the image, while the three high-frequency detail components represent the edge, texture, and other detail features of the image in the corresponding directions, enabling the capture of the energy distribution variation patterns of the optical fiber defect region in different directions. For the wavelet coefficient matrix obtained after 2-3 layer wavelet decomposition, for each layer and direction, the absolute value of all elements in the matrix is ​​first taken and then squared. The result is then summed over the entire domain to obtain the energy value of the wavelet coefficients for that layer and direction. The magnitude of the energy value quantifies the significance of the defect region's features at the corresponding scale and direction; a larger energy value indicates a more prominent defect feature at that scale and direction. Subsequently, the wavelet coefficient energy values ​​calculated at all scales and directions are summarized to obtain the sum of all energy values. Each individual energy value is then divided by this sum to normalize all energy values, mapping them uniformly to the [0,1] interval. This eliminates numerical differences in energy values ​​between different scales and directions, preventing excessively large energy values ​​at one scale or direction from masking the energy information of other features, and ensuring that features of each dimension have equal weight in subsequent feature vector construction. Finally, the normalized energy values ​​are ordered and combined according to a fixed order: scale first, then direction. First, the first and second layers are arranged sequentially. If it is a three-layer decomposition, the low-frequency approximate component energy value of the third layer is added. Then, the high-frequency detail component energy values ​​of each layer are arranged in a fixed order of horizontal, vertical and diagonal. The arranged one-dimensional numerical sequence is used to construct a multi-directional and multi-scale energy feature vector of the potential defect region. This vector can comprehensively and accurately characterize the energy distribution of the potential defect region at different scales and in different directions.

[0035] Extract all pixels within the potential defect area and obtain the corresponding grayscale value of each pixel. Construct a grayscale value set G for this area, denoted as G={g1,g2,…,g…}. N}, where gi Let be the grayscale value of the i-th pixel within the potential defect region, where i = 1, 2, ..., N. Based on this set of grayscale values, various grayscale feature parameters are calculated sequentially, with the grayscale mean value calculated according to the formula... The calculation, by summing the grayscale values ​​of all pixels within a region and then averaging them, reflects the overall average level of grayscale values ​​in that region. Grayscale variance is calculated using the formula... The calculation, using the grayscale mean as a benchmark, quantifies the dispersion of grayscale values ​​within a region by averaging the sum of squared deviations of each pixel's grayscale value from the mean. The grayscale range is first determined by traversing the grayscale value set G to identify the maximum grayscale value g within the region. max =max(G) and minimum gray value g min =min(G), then use the formula R=g max -g min The calculation visually reflects the range of grayscale values ​​within a given area. Grayscale skewness is calculated using the formula... The asymmetry of gray-level distribution within a region is characterized by the ratio of the third central moment to the cube of the standard deviation. A positive skewness value indicates a right-skewed distribution, a negative value indicates a left-skewed distribution, and a value of 0 indicates a symmetrical distribution. Gray-level kurtosis is calculated using the formula... The steepness of the gray-level distribution within the region is quantified by subtracting 3 from the ratio of the fourth-order central moment to the fourth power of the standard deviation. A kurtosis value of 0 indicates that the gray-level distribution is as steep as a normal distribution, a value greater than 0 indicates a peaked distribution, and a value less than 0 indicates a flat-peaked distribution. Since the dimensions and numerical ranges of the calculated gray-level mean, variance, range, skewness, and kurtosis parameters differ, direct combination could mask the characteristic effects of some parameters. Therefore, the five original feature parameters are processed using a maximum-minimum normalization method, mapping each parameter value to the [0,1] interval to eliminate the dimensional and numerical differences between different parameters and ensure the consistency of the weights of each parameter in the subsequent feature vector. Finally, the five normalized gray-level feature parameters are arranged in a fixed order of gray-level mean, variance, range, skewness, and kurtosis to construct the gray-level statistical feature vector of the potential defect region. This vector can comprehensively and quantitatively reflect the overall distribution characteristics of gray-level values ​​within the potential defect region.

[0036] The latter three types of feature vectors—contour morphology feature vector, texture feature vector, multi-directional multi-scale energy feature vector, and grayscale statistical feature vector—are concatenated to form a joint feature vector. Simultaneously, a standard contour morphology feature vector set and a standard joint feature vector set corresponding to surface defects are pre-constructed (obtained and optimized by collecting over 1000 sets of surface defect samples of different types using the same feature extraction process). The distance between the contour morphology feature vector and the standard contour morphology feature vector is calculated using the formula H(A,B)=max(h(A,B),h(B,A)), where h(A,B)=max(A,B). a∈Amin β ∈B∥ab∥, where A is the set of points corresponding to the feature vector of the contour shape to be detected, B is the set of points corresponding to the feature vector of the standard contour shape of the surface defect, and ∥ab∥ is the Euclidean distance between the two points. This formula ensures that the distance value can objectively reflect the degree of matching of the contour shape. According to The distance between the joint feature vector and the standard joint feature vector is calculated, where X is the joint feature vector to be detected, Y is the standard joint feature vector of the surface defect, and Σ is the covariance matrix of the standard feature vector set of the surface defect. This formula can effectively measure the overall similarity between the two types of joint feature vectors.

[0037] The contour matching threshold and feature similarity threshold are pre-determined using Receiver Operating Characteristic (ROC) curves. The contour matching threshold is set to 0.3-0.5 based on the morphological differences of the surface defect contour, and the feature similarity threshold is set to 0.8-1.0 based on the distribution characteristics of the joint features (specific values ​​are optimized through sample validation). When the calculated contour morphology matching distance is less than the contour matching threshold and the joint feature similarity distance is less than the feature similarity threshold, the potential defect region is determined to be a surface defect.

[0038] Step 140: Remove the identified surface defects from the potential defect areas to obtain the internal defect areas to be screened. From the internal defect areas to be screened, select areas that appear in at least one working state with light injection in multiple fiber images and do not appear in the working state without light injection, and determine them as potential internal defect areas.

[0039] First, based on the detection results of all previously identified surface defect regions, the complete pixel coordinate set of each surface defect region is extracted. According to the original resolution of the image of the fiber optic image bundle under test, a binary mask image is generated that achieves pixel-level precise alignment with the potential defect region image. In this mask image, all pixels in the surface defect regions are marked as 1, and the remaining pixels in the potential defect regions that are not identified as surface defects are marked as 0. To prevent blurred pixels at the edges of surface defect regions from being mixed into subsequent screening areas, the edge pixels of the surface defect regions are dilated by 1 pixel to ensure that the surface defect regions are completely marked. After the mask image is generated, pixel-level masking operations are performed between the binary mask image and the original potential defect region image. Surface defect pixel regions marked as 1 in the mask image are removed, and only pixel regions marked as 0 are retained. Subsequently, connected component analysis is performed on the remaining regions obtained after the mask operation to remove isolated and scattered pixel regions with fewer than the preset area threshold. This area threshold is consistent with the 5-pixel threshold used when judging potential defect regions. The continuous and valid pixel regions after verification are retained and defined as internal defect regions to be screened. At the same time, the minimum bounding rectangle coordinates, pixel set and connected component number of each internal defect region to be screened are extracted to complete the preliminary filing of the regions to be screened.

[0040] Next, fiber optic images of the same target detection location under two working states—with and without light injection—are retrieved. Based on the previously established image registration parameters, the internal defect regions to be screened are mapped at the pixel level in both images. Then, the pixel grayscale features of each region to be screened are extracted under both states, and their presentation effects are compared. If a region to be screened does not exhibit abnormal grayscale features in the image without light injection and its grayscale performance is consistent with that of the normal fiber optic region, but exhibits obvious abnormal grayscale features in at least one image with light injection, then that region is screened out. Finally, the pixel coordinate range and core grayscale features of the screened regions are calibrated, thus identifying them as potential internal defect regions.

[0041] Step 150: Determine the internal defects in the potential internal defect region by matching the texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphology features of the potential internal defect region with the preset internal defect feature threshold.

[0042] The contour morphology feature vector, texture feature vector, multi-directional multi-scale energy feature vector, and gray-level statistical feature vector of the potential internal defect region are sequentially concatenated and combined to form a complete joint feature vector. Then, based on a pre-defined internal defect feature pattern, a multi-dimensional preliminary screening is performed on all potential internal defect regions. This internal defect feature pattern is derived from the feature statistics and analysis of a large number of internal defect samples such as dark spots and broken fibers, and also incorporates the actual characteristic manifestations of internal defects in the fiber optic image bundle, eliminating regions that do not possess internal defect characteristics layer by layer. Specifically, the gray-level difference matrix of the potential internal defect region under the light injection state and the corresponding region under the no-light injection state is first extracted from multiple fiber images. This gray-level difference matrix is ​​used to amplify the gray-level difference between the internal defect region and the normal region, more intuitively highlighting the gray-level characteristics of the internal defect. Then, the mean and standard deviation of this gray-level difference matrix are calculated. When the mean value is greater than a preset grayscale difference mean threshold and the standard deviation is less than a preset grayscale difference fluctuation threshold, the corresponding potential internal defect area is retained as the first screening area. This threshold is determined through testing and optimization of a large number of internal defect samples, ensuring that the selected areas possess typical grayscale difference characteristics of internal defects, and that the grayscale difference is stable without significant fluctuations. Next, the variance of the texture feature vector corresponding to the first screening area is calculated. When this variance is less than a preset texture uniformity threshold and is negatively correlated with the mean of the corresponding grayscale difference matrix, the area is selected as the second screening area. This negative correlation characteristic aligns with the inherent characteristic that the texture of internal defect areas in optical fibers is relatively uniform, and the larger the grayscale difference, the more uniform the texture. Subsequently, the proportion of pixels corresponding to peak grayscale values ​​in the grayscale statistical feature vector of the second screening area is statistically analyzed to determine the proportion of pixels with peak grayscale values ​​to the total number of pixels in that area. When this proportion is less than a preset peak grayscale proportion threshold and is positively correlated with the variance of the corresponding texture feature vector, the corresponding area is retained as the third screening area, aligning with the characteristic pattern of relatively flat grayscale distribution and low peak grayscale proportion in internal defect areas. Next, the number of connected components and contour smoothness in the contour morphology feature vector of the third screening region are analyzed. When the number of connected components does not exceed a preset connected component threshold, the contour smoothness is higher than a preset contour smoothness threshold, and the contour smoothness is negatively correlated with the corresponding peak grayscale ratio, the corresponding region is retained as the fourth screening region. Defects such as dark spots and broken fibers inside the optical fiber usually have fewer connected components and a certain degree of contour smoothness. Then, the Pearson correlation coefficient between the multi-directional multi-scale energy feature vector and the contour morphology feature vector of the fourth screening region is calculated. When the Pearson correlation coefficient is greater than a preset feature correlation threshold and is positively correlated with the corresponding contour smoothness, the corresponding region is retained as a potential internal defect region after preliminary screening. Through the correlation verification between feature vectors, it is further ensured that the features of each dimension of the selected region conform to the feature patterns of internal defects.

[0043] After initial screening, a basic dictionary for sparse representation is constructed based on predefined internal defect feature patterns. First, at least 1000 precisely labeled internal defect samples, such as dark spots and broken wires, are collected. Labeling is performed using professional labeling tools in the Anaconda environment, clearly marking defect categories, boundaries, and core regions to ensure consistency and accuracy. All samples undergo the same denoising, grayscale adjustment, and feature extraction preprocessing as the images to be inspected to avoid affecting dictionary compatibility due to differences in sample preprocessing. For each labeled internal defect sample, contour morphology feature vectors, texture feature vectors, multi-directional multi-scale energy feature vectors, and grayscale statistical feature vectors are extracted one by one according to the previously determined feature extraction process. These are then concatenated and combined in a fixed order to form a joint feature vector. The joint feature vectors of all samples are then summarized to construct a feature vector set, which constitutes the basic dictionary for sparse representation. The dimensions of the dictionary are completely consistent with the dimensions of the joint feature vectors corresponding to the potential internal defect regions after preliminary screening, ensuring the compatibility of subsequent sparse coding solutions. Moreover, the dictionary covers internal defect feature vectors of different sizes and shapes, which can comprehensively and accurately cover the feature information of common internal defects in optical fiber image bundles in all dimensions.

[0044] Next, sparse encoding is performed on the joint feature vectors corresponding to the potential internal defect regions after preliminary screening. The L1 norm minimization method is used to construct the optimization objective function, the specific formula of which is as follows: Where x is the joint feature vector to be detected, D is the constructed basic dictionary, α is the sparse coefficient to be solved, and λ is the regularization parameter used to balance reconstruction error and sparsity constraints. Its value range is determined to be 0.01-0.1 through 5-fold cross-validation to ensure that reconstruction error is reduced while maintaining sparsity. The gradient descent method is used to iteratively solve the optimization objective function, with the number of iterations set to 100-150. The convergence condition is that the change in the objective function value between two adjacent iterations is less than 1×10⁻⁶. -5 During the iteration process, the sparse coefficient α is updated step by step, and finally the converged sparse coefficient is obtained. Most of the elements in the coefficient are close to 0, and only a few non-zero elements correspond to the defect feature vectors in the basic dictionary that are highly matched with the features to be detected. This can accurately represent the matching relationship between the joint features of the region to be detected and the internal defect features in the basic dictionary, highlighting the degree of correlation between the two.

[0045] Then, matrix multiplication is performed using the obtained sparse coefficients and the basic dictionary to reconstruct the corresponding joint feature vector, i.e. ,in This represents the reconstructed joint feature vector. The reconstruction error is calculated by comparing elements one by one, using the mean squared error (MSE) as the error quantification metric. The specific calculation formula is as follows: , where is the i-th element of the original joint feature vector, is the i-th element of the reconstructed joint feature vector, and N is the total dimension of the joint feature vector. This mean square error directly reflects the degree of fit between the features of the region to be detected and the standard internal defect features. The smaller the error, the higher the matching degree between the features to be detected and the internal defect features in the dictionary, and the better the fit.

[0046] Finally, the calculated reconstruction error is compared with the preset reconstruction error threshold, and the joint feature vector is comprehensively checked to ensure that it meets all the threshold requirements of the preset internal defect feature rules. This reconstruction error threshold is determined through analysis and optimization of the detection data results after model training, ensuring that both detection accuracy and recall are considered. When the reconstruction error does not exceed the reconstruction error threshold and the joint feature vector meets all threshold requirements, the potential internal defect region after preliminary screening is determined to be an internal defect of the fiber optic image bundle.

[0047] After determining the potential internal defect areas, the fiber optic image bundle defect detection process of this application has achieved comprehensive identification of both surface and internal defects. Figure 5 shows a schematic diagram of a defect detection result provided by an embodiment of this application. In summary, after acquiring multiple images of the target detection location of the fiber optic image bundle under different light source states, this application first amplifies the gray-scale difference between the defect and normal areas through gray-scale adjustment, and then eliminates the spatial position deviation of the image through registration optimization. This provides high-quality data support with clear details and consistent positions for subsequent detection stages, ensuring that defect features under different light source states can be accurately compared. The multi-scale morphological gradient fusion segmentation algorithm constructs structural elements adapted to defects of different sizes, comprehensively covering various common defects in fiber optic image bundles. At the same time, it combines a noise filtering mechanism to eliminate isolated interference areas, achieving no omissions or false locking of potential defect areas, allowing subsequent feature extraction to focus only on areas related to real defects. The surface defect assessment stage extracts four types of features: texture, multi-directional and multi-scale energy, grayscale statistics, and contour morphology. This comprehensively characterizes defect attributes from multiple dimensions, including morphology, grayscale, texture, and energy. A dual-quantization matching logic is then used to comprehensively verify these features, effectively distinguishing between the fiber filament's own texture and surface defects, avoiding judgment biases that may result from single-feature analysis. Internal defect detection first accurately defines potential areas based on differences in light source conditions. Then, multiple rounds of feature filtering narrow down the scope, eliminating areas that do not conform to the characteristics of internal defects. Finally, sparse representation reconstruction and error verification further confirm the authenticity of internal defects, ensuring accurate identification of internal defects such as dark spots and broken filaments. These stages are closely linked and work synergistically, achieving clear distinction between surface and internal defects while comprehensively capturing defect features of different shapes and sizes, effectively avoiding interference from false defects and the omission of genuine defects.

[0048] It is understood that, in order to achieve the functions in the above embodiments, the computer device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and method steps described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.

[0049] Furthermore, as a response to the above Figure 1 The implementation of the method embodiment shown in this application provides a fiber optic image bundle defect detection device. This device embodiment corresponds to the foregoing method embodiments. For ease of reading, this embodiment will not repeat the details of the foregoing method embodiments one by one, but it should be clear that the device in this embodiment can correspondingly implement all the contents of the foregoing method embodiments. Specifically, as shown... Figure 6 As shown, the fiber optic image bundle defect detection device 600 includes: The acquisition module 610 is used to acquire multiple fiber images of the target detection position of the fiber optic image bundle under test; The determination module 620 is used to determine potential defect regions in multiple fiber optic images based on a multi-scale morphological gradient fusion segmentation algorithm. The first detection module 630 is used to extract texture features, multi-directional multi-scale energy features, gray-scale statistical features and contour morphology features of potential defect areas, determine the matching degree of contour morphology features and the overall similarity of texture features, multi-directional multi-scale energy features and gray-scale statistical features, and determine surface defects in potential defect areas based on the matching degree and overall similarity. The screening module 640 is used to remove the identified surface defects from the potential defect area to obtain the internal defect area to be screened. From the internal defect area to be screened, the area that appears in at least one working state with light injection in multiple fiber images and does not appear in the working state without light injection is identified as the potential internal defect area. The second detection module 650 is used to determine the internal defects in the potential internal defect region by matching the texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphology features of the potential internal defect region with the preset internal defect feature threshold.

[0050] Furthermore, such as Figure 6As shown, the determination module 620 is specifically used to construct multi-scale asymmetric structural elements based on the size range of defects in the optical fiber image bundle, and to calculate the morphological gradient map of each optical fiber image using the multi-scale asymmetric structural elements; to fuse the feature information of each morphological gradient map corresponding to the multi-scale asymmetric structural elements using preset weight coefficients; to segment the fused gradient map based on a preset segmentation threshold to obtain preliminary defect candidate regions; and to determine the isolated noise regions in the preliminary defect candidate regions whose area does not reach the preset area threshold as potential defect regions.

[0051] Furthermore, such as Figure 6 As shown, the first detection module 630 is specifically used to extract the edge contour of the potential defect area, calculate the contour feature parameters of the edge contour, and form a contour morphology feature vector; based on the gray value distribution law of the potential defect area, calculate the texture feature parameters in multiple directions to form a texture feature vector; perform wavelet decomposition on the potential defect area to obtain wavelet coefficients of different scales and directions, calculate the energy value of each wavelet coefficient and normalize it to obtain a multi-directional multi-scale energy feature vector; statistically analyze the gray value feature parameters of the potential defect area to form a gray value statistical feature vector; and determine the distance between the contour morphology feature vector and the standard contour morphology feature vector corresponding to the surface defect according to H(A,B)=max(h(A,B),h(B,A)), where h(A,B)=max(h(A,B),h(B,A)). a∈A min b∈B ∥ab∥, A is the set of points corresponding to the contour morphology feature vector, B is the set of points corresponding to the standard contour morphology feature vector of the surface defect, and ∥ab∥ is the Euclidean distance between two points in the set; according to The distance between the joint feature vector composed of texture feature vector, multi-directional multi-scale energy feature vector, and gray-scale statistical feature vector and the standard joint feature vector corresponding to the surface defect is determined. Here, X is the joint feature vector, Y is the standard joint feature vector corresponding to the surface defect, and Σ is the covariance matrix of the standard feature vector of the surface defect. When the distance value corresponding to the contour shape matching degree is less than the contour matching threshold, and the distance value corresponding to the overall similarity is less than the feature similarity threshold, the potential defect region is determined to be a surface defect.

[0052] Furthermore, such as Figure 6As shown, the second detection module 650 is specifically used to combine the contour morphology feature vector, texture feature vector, multi-directional multi-scale energy feature vector, and grayscale statistical feature vector of the potential internal defect region to form a joint feature vector; to perform preliminary screening of the potential internal defect region based on the preset internal defect feature rules; to construct a feature vector set based on the internal defect feature rules as the basic dictionary for sparse representation; to perform sparse encoding on the joint feature vector corresponding to the preliminarily screened region to obtain sparse coefficients; to reconstruct the joint feature vector using the sparse coefficients and the basic dictionary, and to calculate the reconstruction error between the reconstructed joint feature vector and the original joint feature vector; when the reconstruction error does not exceed the reconstruction error threshold and the joint feature vector meets the threshold requirement in the internal defect feature rules, the potential internal defect region is determined to be an internal defect.

[0053] Furthermore, such as Figure 6 As shown, the second detection module 650 is specifically used to extract the gray-level difference matrix between potential internal defect regions under light injection conditions and corresponding regions under no-light injection conditions from multiple fiber optic images; calculate the mean and standard deviation of the gray-level difference matrix; when the mean is greater than a preset gray-level difference mean threshold and the standard deviation is less than a preset gray-level difference fluctuation threshold, the corresponding potential internal defect region is retained as the first screening region; calculate the variance of the texture feature vector corresponding to the first screening region; when the variance is less than a preset texture uniformity threshold and is negatively correlated with the mean of the gray-level difference matrix corresponding to the first screening region, the corresponding region is used as the second screening region; and calculate the proportion of the number of pixels corresponding to the peak gray level in the gray-level statistical feature vector of the second screening region to the total number of pixels in the region. When the proportion is less than a preset peak gray level proportion threshold... When the variance of the texture feature vector of the second screening region is positively correlated with the variance of the texture feature vector of the third screening region, the corresponding region is retained as the third screening region. Analyze the number of connected components and the contour smoothness in the contour morphology feature vector of the third screening region. When the number of connected components does not exceed the preset connected component threshold, the contour smoothness is higher than the preset contour smoothness threshold, and the contour smoothness is negatively correlated with the peak gray level ratio of the third screening region, the corresponding region is retained as the fourth screening region. Calculate the Pearson correlation coefficient between the multi-directional multi-scale energy feature vector of the fourth screening region and the contour morphology feature vector of the fourth screening region. When the Pearson correlation coefficient is greater than the preset feature correlation threshold and the Pearson correlation coefficient is positively correlated with the contour smoothness of the fourth screening region, the corresponding region is retained as a potential internal defect region after preliminary screening.

[0054] Furthermore, such as Figure 6As shown, the acquisition module 610 is also used to perform two-dimensional Fourier transform on multiple fiber optic images to obtain frequency domain images, calculate the cross-power spectrum of the frequency domain images, perform inverse Fourier transform on the cross-power spectrum, determine the translation amount, rotation angle and scaling ratio deviation between multiple fiber optic images by using the coordinates and amplitudes corresponding to the peak values ​​in the inverse Fourier transform results, and iteratively adjust the translation amount, rotation angle and scaling ratio deviation with the maximum mutual information value between multiple fiber optic images as the optimization objective.

[0055] Furthermore, such as Figure 6 As shown, the acquisition module 610 is also used to determine the new gray level of each gray level in the fiber optic image by using the total number of pixels in a single fiber optic image, the pixel frequency of each gray level, and the total number of gray levels; determine the mapping relationship between each gray level and the corresponding new gray level based on the discrete cumulative distribution function; adjust the mapping parameters in the mapping relationship based on the distribution state of the pixel-dense gray level intervals and pixel-sparse gray level intervals in the fiber optic image; and adjust the pixel gray values ​​of the fiber optic image according to the mapping parameters, thereby widening the pixel-dense gray level intervals and merging the pixel-sparse gray level intervals.

[0056] Optionally, the fiber optic image bundle defect detection device may be an electronic device with data processing capabilities, or a functional module within the electronic device, without limitation.

[0057] For example, the electronic device can be a server, which can be a single server or a server cluster consisting of multiple servers. As another example, the electronic device can be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, and other terminal devices. As yet another example, the electronic device can also be a recording device, video surveillance equipment, etc. This application does not impose any special limitations on the specific form of the electronic device.

[0058] The following example uses an electronic device for detecting defects in fiber optic image bundles. Figure 7 As shown, Figure 7 The hardware structure of an electronic device 700 provided in this application.

[0059] like Figure 7 As shown, the electronic device 700 includes a processor 710, a communication line 720, and a communication interface 730.

[0060] Optionally, the electronic device 700 may also include a memory 740. The processor 710, memory 740, and communication interface 730 can be connected via a communication line 720.

[0061] The processor 710 can be a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The processor 710 can also be any other device with processing capabilities, such as a circuit, device, or software module, without limitation.

[0062] In one example, processor 710 may include one or more CPUs, for example Figure 7 CPU0 and CPU1 in the CPU.

[0063] As an optional implementation, the electronic device 700 includes multiple processors; for example, in addition to processor 710, it may also include processor 770. A communication line 720 is used to transmit information between the components included in the electronic device 700.

[0064] Communication interface 730 is used for communicating with other devices or other communication networks. These other communication networks can be Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc. Communication interface 730 can be a module, circuit, transceiver, or any device capable of enabling communication.

[0065] Memory 740 is used to store instructions. These instructions can be computer programs.

[0066] The memory 740 can be a read-only memory (ROM) or other type of static storage device that can store static information and / or instructions; it can also be a random access memory (RAM) or other type of dynamic storage device that can store information and / or instructions; it can also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, etc., without limitation.

[0067] It should be noted that the memory 740 can exist independently of the processor 710, or it can be integrated with the processor 710. The memory 740 can be used to store instructions, program code, or some data, etc. The memory 740 can be located inside or outside the electronic device 700, without restriction.

[0068] The processor 710 is configured to execute instructions stored in the memory 740 to implement the communication method provided in the following embodiments of this application. For example, when the electronic device 700 is a terminal or a chip in a terminal, the processor 710 can execute instructions stored in the memory 740 to implement the steps performed by the transmitting end in the following embodiments of this application.

[0069] As an optional implementation, the electronic device 700 also includes an output device 750 and an input device 760. The output device 750 can be a display screen, speaker, or other device capable of outputting data from the electronic device 700 to the user. The input device 760 can be a keyboard, mouse, microphone, joystick, or other device capable of inputting data into the electronic device 700.

[0070] It should be pointed out that, Figure 7 The structure shown does not constitute a limitation on the electronic device, except... Figure 7 In addition to the components shown, the electronic device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.

[0071] The fiber optic image bundle defect detection device and application scenarios described in this application are for the purpose of more clearly illustrating the technical solutions of this application, and do not constitute a limitation on the technical solutions provided in this application. As those skilled in the art will know, with the evolution of fiber optic image bundle defect detection devices and the emergence of new business scenarios, the technical solutions provided in this application are also applicable to similar technical problems.

[0072] This application provides a storage medium storing a program that, when executed by a processor, implements the fiber optic image bundle defect detection method.

[0073] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0074] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0075] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for detecting defects in an optical fiber image bundle, characterized in that, The method includes: Acquire multiple fiber images of the target detection location in the fiber optic image bundle under test; Potential defect regions in the multiple fiber optic images were determined based on a multi-scale morphological gradient fusion segmentation algorithm. Extract texture features, multi-directional multi-scale energy features, grayscale statistical features, and contour morphology features of the potential defect region; determine the matching degree of the contour morphology features and the overall similarity of the texture features, multi-directional multi-scale energy features, and grayscale statistical features; and determine the surface defects in the potential defect region based on the matching degree and the overall similarity. The identified surface defects are removed from the potential defect areas to obtain the internal defect areas to be screened. From the internal defect areas to be screened, areas that appear in at least one working state with light injection in the multiple fiber images and do not appear in the working state without light injection are selected as potential internal defect areas. The internal defects in the potential internal defect region are determined by the fit between the texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphology features of the potential internal defect region and the preset internal defect feature threshold.

2. The method according to claim 1, characterized in that, The potential defect regions in the multiple fiber optic images were determined based on a multi-scale morphological gradient fusion segmentation algorithm, including: A multi-scale asymmetric structural element is constructed based on the size range of defects in the fiber optic image bundle, and the morphological gradient map of each fiber optic image is calculated using the multi-scale asymmetric structural element. Feature information is fused from the morphological gradient maps corresponding to the multi-scale asymmetric structural elements by using preset weighting coefficients. The fused gradient map is segmented based on a preset segmentation threshold to obtain preliminary defect candidate regions; Isolated noise regions whose area does not reach a preset area threshold in the preliminary defect candidate region are identified as potential defect regions.

3. The method according to claim 1, characterized in that, Extract texture features, multi-directional multi-scale energy features, grayscale statistical features, and contour morphology features from the potential defect region; determine the matching degree of the contour morphology features and the overall similarity of the texture features, multi-directional multi-scale energy features, and grayscale statistical features; and determine the surface defects in the potential defect region based on the matching degree and the overall similarity, including: Extract the edge contour of the potential defect region, calculate the contour feature parameters of the edge contour, and construct the contour morphology feature vector. Based on the gray value distribution pattern of the potential defect area, texture feature parameters are calculated in multiple directions to form a texture feature vector; Wavelet decomposition is performed on the potential defect region to obtain wavelet coefficients of different scales and directions. The energy value of each wavelet coefficient is calculated and normalized to obtain a multi-directional and multi-scale energy feature vector. The gray-level feature parameters of the potential defective regions are statistically analyzed to form a gray-level statistical feature vector. The distance between the contour morphology feature vector and the standard contour morphology feature vector corresponding to the surface defect is determined according to H(A,B)=max(h(A,B),h(B,A)), where h(A,B)=max(h(A,B),h(B,A)). a∈A min b∈B ∥ab∥, where A is the set of points corresponding to the contour morphology feature vector, B is the set of points corresponding to the standard contour morphology feature vector of the surface defect, and ∥ab∥ is the Euclidean distance between two points in the set. according to Determine the distance between the joint feature vector composed of the texture feature vector, the multi-directional multi-scale energy feature vector, and the gray-scale statistical feature vector, and the standard joint feature vector corresponding to the surface defect, where X is the joint feature vector, Y is the standard joint feature vector corresponding to the surface defect, and Σ is the covariance matrix of the standard feature vector of the surface defect. When the distance value corresponding to the contour shape matching degree is less than the contour matching threshold, and the distance value corresponding to the overall similarity is less than the feature similarity threshold, the potential defect area is determined to be a surface defect.

4. The method according to claim 3, characterized in that, Internal defects in the potential internal defect region are determined by matching the texture features, multi-directional multi-scale energy features, grayscale statistical features, and contour morphology features of the potential internal defect region with a preset internal defect feature threshold, including: The contour morphology feature vector, texture feature vector, multi-directional multi-scale energy feature vector, and gray-scale statistical feature vector of the potential internal defect region are combined to form a joint feature vector; The potential internal defect regions are initially screened based on the preset internal defect characteristic rules. Based on the aforementioned internal defect characteristics, a set of feature vectors is constructed as the basic dictionary for sparse representation; The sparse coefficients are obtained by sparse coding the joint feature vectors corresponding to the regions after preliminary screening. The joint feature vector is reconstructed using the sparse coefficients and the basic dictionary, and the reconstruction error between the reconstructed joint feature vector and the original joint feature vector is calculated. When the reconstruction error does not exceed the reconstruction error threshold and the joint feature vector satisfies the threshold requirement in the internal defect feature law, the potential internal defect region is determined to be an internal defect.

5. The method according to claim 4, characterized in that, The potential internal defect regions are initially screened based on preset internal defect characteristic patterns, including: Extract the grayscale difference matrix between the potential internal defect region under the light injection state and the corresponding region under the no-light injection state from the multiple fiber images, calculate the mean and standard deviation of the grayscale difference matrix, and retain the corresponding potential internal defect region as the first screening region when the mean is greater than the preset grayscale difference mean threshold and the standard deviation is less than the preset grayscale difference fluctuation threshold. Calculate the variance of the texture feature vector corresponding to the first screening region. When the variance is less than a preset texture uniformity threshold and is negatively correlated with the mean of the gray-level difference matrix corresponding to the first screening region, the corresponding region is taken as the second screening region. The proportion of the number of pixels corresponding to the peak gray level in the gray-scale statistical feature vector of the second screening region to the total number of pixels in the region is calculated. When the proportion is less than the preset peak gray level proportion threshold and is positively correlated with the variance of the texture feature vector of the second screening region, the corresponding region is retained as the third screening region. Analyze the number of connected components and the smoothness of the contour in the feature vector of the third screening region. When the number of connected components does not exceed a preset connected component threshold, the smoothness of the contour is higher than a preset contour smoothness threshold, and the smoothness of the contour is negatively correlated with the peak gray level ratio of the third screening region, the corresponding region is retained as the fourth screening region. Calculate the Pearson correlation coefficient between the multi-directional, multi-scale energy feature vector of the fourth screening region and the contour morphology feature vector of the fourth screening region. When the Pearson correlation coefficient is greater than a preset feature correlation threshold and the Pearson correlation coefficient is positively correlated with the contour smoothness of the fourth screening region, the corresponding region is retained as a potential internal defect region after preliminary screening.

6. The method according to any one of claims 1-5, characterized in that, After acquiring multiple fiber images of the target detection location in the fiber optic image bundle under test, the method further includes: Two-dimensional Fourier transforms are performed on the multiple fiber images to obtain frequency domain images, and the cross power spectrum of the frequency domain images is calculated. Perform an inverse Fourier transform on the cross-power spectrum; The translation, rotation angle, and scaling deviation among the multiple fiber optic images are determined by using the coordinates and amplitudes corresponding to the peak values ​​in the inverse Fourier transform results. With the goal of maximizing the mutual information value among the multiple fiber optic images, the translation amount, the rotation angle, and the scaling ratio deviation are iteratively adjusted.

7. The method according to any one of claims 1-5, characterized in that, After acquiring multiple fiber images of the target detection location in the fiber optic image bundle under test, the method further includes: The new gray level of each gray level in the fiber optic image is determined by the sum of pixels in a single fiber optic image, the pixel frequency of each gray level, and the total number of gray levels. The mapping relationship between each gray level and the corresponding new gray level is determined based on the discrete cumulative distribution function; Based on the distribution of dense and sparse grayscale regions in the fiber optic image, the mapping parameters in the mapping relationship are adjusted. The grayscale values ​​of the fiber optic image pixels are adjusted according to the mapping parameters to widen the densely pixelated grayscale intervals and merge the sparsely pixelated grayscale intervals.

8. A fiber optic image bundle defect detection device, characterized in that, The device includes: The acquisition module is used to acquire multiple fiber images of the target detection location in the fiber optic image bundle under test. The determination module is used to determine potential defect regions in the multiple fiber optic images based on a multi-scale morphological gradient fusion segmentation algorithm; The first detection module is used to extract texture features, multi-directional multi-scale energy features, gray-scale statistical features and contour morphology features of the potential defect area, determine the matching degree of the contour morphology features and the overall similarity of the texture features, multi-directional multi-scale energy features and gray-scale statistical features, and determine the surface defects in the potential defect area based on the matching degree and the overall similarity. The filtering module is used to remove the identified surface defects from the potential defect areas to obtain the internal defect areas to be filtered. From the internal defect areas to be filtered, areas that appear in at least one working state with light injection in the multiple fiber images and do not appear in the working state without light injection are identified as potential internal defect areas. The second detection module is used to determine the internal defects in the potential internal defect region by matching the texture features, multi-directional multi-scale energy features, gray-scale statistical features, and contour morphology features of the potential internal defect region with the preset internal defect feature threshold. The potential internal defect region is a region that is presented in at least one working state with light injection in the multiple fiber images and is not presented in the working state without light injection.

9. A storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the storage medium to perform the fiber optic image bundle defect detection method as described in any one of claims 1-7.

10. An electronic device, characterized in that, The device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the fiber optic image bundle defect detection method as described in any one of claims 1-7.