Endoscope optical assembly quality detection method and system based on data analysis
By using alternating wavelength light source scanning and dual-channel image acquisition technology, combined with adaptive threshold segmentation and Gaussian-Laplace difference algorithm, a defect-sensitive feature set is constructed, which solves the problems of manual subjectivity and low efficiency in traditional detection methods and realizes efficient and accurate quality detection of endoscope optical components.
Patent Information
- Application Number
- CN202510970391.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-10-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional quality inspection methods for endoscope optical components are subject to strong subjectivity of manual experience judgment, low efficiency, lack of standardized data analysis processes, and difficulty in accurately identifying and quantifying defects, which cannot meet the needs of high-precision inspection.
By adopting alternating wavelength light source scanning and dual-channel image acquisition technology, combined with adaptive threshold segmentation algorithm and improved Gaussian-Laplace difference algorithm, multi-scale feature points are extracted, defect-sensitive feature set is constructed, and defect type and severity are determined through machine learning model.
It realizes the automation, precise positioning and objective evaluation of the quality inspection of endoscope optical components, improves the accuracy, consistency and efficiency of inspection, and can complete comprehensive, multi-angle and multi-parameter quality analysis in a short time, which is suitable for large-scale production.
Smart Images

Figure CN120761402A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and system for detecting the quality of endoscope optical components based on data analysis. Background Art
[0002] Endoscopes are important diagnostic and therapeutic tools in modern medicine, and the quality of their optical components directly affects the accuracy of medical diagnoses and the safety of surgeries. Traditional methods for inspecting the quality of endoscope optical components rely primarily on manual visual inspection, where operators rely on their experience to identify defects such as scratches, bubbles, impurities, and uneven coatings on the surface of optical components. These inspection methods typically combine simple optical instruments, such as microscopes and lighting devices, to observe the performance of optical components at different angles and lighting conditions, and then grade them according to preset quality standards. With the continuous development of endoscope technology, the precision and performance requirements of optical components continue to increase, and even minor defects can have a significant impact on overall performance, which places higher demands on quality inspection.
[0003] However, traditional quality inspection methods for endoscope optical components have many shortcomings. First, manual experience judgment is highly subjective, and different inspectors may have large differences in their evaluations of the same component, lacking consistency and repeatability. Second, manual inspection is inefficient and cannot meet the needs of large-scale production, especially for high-precision optical components that require comprehensive inspection from multiple angles and multiple wavelengths. Third, traditional inspection methods lack standardized data analysis processes, making it difficult to establish an objective quality assessment system, resulting in inconsistent quality control standards. Fourth, manual inspection makes it difficult to accurately quantify the location, size, and specific impact of defects on optical performance, and cannot provide effective data support for production process optimization. With the development of artificial intelligence and data analysis technology, it is of great significance to apply data-driven methods to the quality inspection of endoscope optical components.
[0004] In addition, in the process of inspecting the optical components of endoscopes, there are deeper technical challenges. Although the existing automated inspection methods have improved the inspection efficiency to a certain extent, they are still insufficient when processing complex optical signals. In particular, there are obvious shortcomings in the data processing of reflected light and scattered light collected synchronously under multi-angle and multi-wavelength light sources, as well as the accurate identification and partitioning of different functional areas. At the same time, there is a lack of effective feature extraction algorithms to capture defect characteristics at multiple scales, making it difficult to accurately identify defects of different types and scales. More importantly, the existing technology cannot establish a quantitative correlation between defect characteristics and optical performance, resulting in the inability to accurately assess the impact of defects on the actual performance of the endoscope. This makes quality control decisions lack reliable data support, reducing the safety and reliability of medical equipment. Summary of the Invention
[0005] The application provides an endoscope optical assembly quality detection method and system based on data analysis, which is used for eliminating the subjectivity of artificial experience judgment, establishing an endoscope optical assembly quality detection method based on objective data analysis, realizing automatic identification, accurate positioning and objective evaluation of defects, and improving the accuracy, consistency and efficiency of detection.
[0006] In a first aspect, the application provides an endoscope optical assembly quality detection method based on data analysis, which comprises: performing alternating wavelength light source scanning on an endoscope optical assembly, synchronously collecting double-channel image data of reflected light and scattered light, and forming an original data set; performing image partition processing on the original data set through a self-adaptive threshold segmentation algorithm, identifying and extracting edge regions and core functional areas, and generating a region feature map; applying an improved Gaussian-Laplacian difference algorithm to the region feature map to extract multi-scale feature points, combining spectral response curve characteristics to construct a defect sensitive feature set; and calculating optical assembly surface integrity indexes and optical performance deviation values based on the defect sensitive feature set to determine defect types and severity.
[0007] In a first implementation of the first aspect, the alternating wavelength light source scanning on the endoscope optical assembly and the synchronous collection of double-channel image data of reflected light and scattered light to form an original data set comprise: The endoscope optical assembly is fixed on a three-axis rotating mechanism, the rotating angle interval is set to 15 degrees, and full-range scanning is performed at each angle position to obtain spatial position data; The endoscope optical assembly is irradiated by narrowband light sources with wavelengths of 350nm to 800nm, the interval is set to 5nm, the optical response under each wavelength is recorded, and multi-band illumination data is obtained; The forward reflection light intensity distribution on the surface of the endoscope optical assembly is captured by a reflection light acquisition device, and the scattering light intensity at a 45-degree scattering angle is recorded by a scattering light acquisition device at the same time, thereby forming double-channel original images; The double-channel original images are spatially registered, a feature point matching algorithm is used to determine the spatial correspondence between the images, and a registered image pair is generated; The registered image pair is combined with the multi-band illumination data to construct a spectral-spatial joint feature matrix, which reflects the optical characteristics of the assembly surface; Based on the spectral-spatial joint feature matrix, the reflectivity and scattering coefficient ratio of each sampling point are calculated to form an original data set.
[0008] In a second implementation of the first aspect, performing image partitioning processing on the original data set using an adaptive threshold segmentation algorithm, identifying and extracting edge areas and core functional areas, and generating a regional feature map, includes: Applying an adaptive histogram equalization algorithm to the original data set, dividing the image into 32×32 sub-blocks, and performing histogram equalization processing on each sub-block separately to obtain a preprocessed image with enhanced contrast; Calculating the Otsu multi-level threshold based on the pre-processed image, dividing the image grayscale value into four levels, corresponding to the non-functional area, edge transition area, core functional area and potential defect area, and generating a preliminary partitioning result; Applying morphological opening and closing operations to the preliminary partitioning results, using a circular structure element with a radius of 3 pixels, eliminating noise and smoothing the region boundaries to form a smooth partition map; Performing regional connectivity analysis on the smoothed partition map, marking connected regions with an area greater than 50 pixels as valid regions, and calculating the geometric center and boundary contour of each valid region to obtain a regional topological structure; The regional topological structure is registered with a preset standard template of the endoscope optical component, the regional boundaries are aligned through affine transformation, the precise positions of the edge area and the core functional area are identified, and a standardized partition map is obtained; A weight coefficient is assigned to each region according to the standardized zoning map, the weight of the core functional area is set to 1.0, and the weight of the edge area decreases linearly according to the distance from the center, thereby generating a weighted regional feature map.
[0009] In a third implementation of the first aspect, applying an improved Gaussian-Laplace difference algorithm to the regional feature map to extract multi-scale feature points, and combining spectral response curve features to construct a defect sensitive feature set, includes: Applying Gaussian filters with different scale parameters to smooth the regional feature maps, with the scale parameters set to 1.0, 1.6, 2.0, 2.5 and 3.2 in sequence, to generate a 5-layer Gaussian pyramid image sequence; Performing pixel-level subtraction operations on two adjacent layers of images in the Gaussian pyramid image sequence, respectively calculating a first difference image as 1.6 layers minus 1.0 layers, a second difference image as 2.0 layers minus 1.6 layers, a third difference image as 2.5 layers minus 2.0 layers, and a fourth difference image as 3.2 layers minus 2.5 layers, to obtain a multi-scale difference image set; In each layer of the multi-scale difference image set, a 3×3×3 local extreme value detection is performed on each non-boundary pixel point, and points that meet both spatial extreme values and scale extreme values are marked as candidate feature points to form an initial feature point set; For each point in the initial feature point set, the sub-pixel level coordinates are accurately positioned by 2-order Taylor expansion, the principal curvatures are calculated based on the eigenvalue ratio of Hessian matrix, the unstable points with curvature ratio greater than 10 are removed, and a stable feature point set is obtained; The spectral response curve at the position of each stable feature point is extracted from the original data set, the 1st and 2nd derivatives of the curve are calculated, the inflection point and the change rate of the curve are detected, and a spectral feature vector is generated; For each point in the stable feature point set, the spatial feature and the corresponding spectral feature vector are combined, a 128-dimensional defect-sensitive feature descriptor is constructed by a feature fusion algorithm, and all feature descriptors are organized into a defect-sensitive feature set.
[0010] In a fourth implementation of the first aspect, in each layer of the multi-scale difference image set, 3*3*3 local extremum detection is performed on each non-boundary pixel point, points that simultaneously satisfy spatial extremum and scale extremum are marked as candidate feature points, and an initial feature point set is formed, including: Boundary extension processing is performed on each layer of the multi-scale difference image set, 1-pixel-wide boundary values are filled around the image, and it is ensured that edge pixels can also participate in the subsequent extremum detection process, and a boundary extension image is obtained; From the boundary extension image, adjacent 3 layers are extracted to form a scale space block, each center point and its 8 adjacent points in the same layer and 18 corresponding points in the upper and lower layers form a 3*3*3 detection window to form a local detection region; For each center point in the local detection region, the gray value difference between the center point and the other 26 points in the window is calculated, and when the center point gray value is greater than all 26 points or less than all 26 points, it is marked as a local extremum point, and a position extremum set is obtained; Each point in the position extremum set is substituted into the Taylor series expansion formula, the exact offset of the extremum point is calculated by derivation, when the offset exceeds 0.5 pixel units in any direction, resampling and iterative calculation are performed along the offset direction until the offset converges, and an accurate position point set is obtained; The principal curvature ratio of each point in the accurate position point set is calculated, the points with curvature ratio less than 10 are selected by solving the ratio of eigenvalues of Hessian matrix, and a stable feature candidate point is formed; The feature points are weighted and selected based on the weight value of the region where the stable feature candidate point is located, the feature point retention rate of the core functional area is set to 100%, and the feature points in the edge area are linearly adjusted according to the weight to generate an initial feature point set.
[0011] In a fifth implementation form of the first aspect, the sub-pixel coordinates of each point in the initial feature point set are accurately located by a second-order Taylor expansion, and principal curvatures are calculated based on eigenvalue ratios of Hessian matrices, unstable points with curvature ratios greater than 10 are removed, and a stable feature point set is obtained, comprising: coordinate positions and scale information of each point in the initial feature point set are extracted to construct an initial feature point parameter table as input data for accurate positioning; for each point in the initial feature point parameter table, a 5*5 neighborhood window is constructed on the differential image layer where the point is located, gradient and Hessian matrix elements in the neighborhood window are calculated to obtain a local structure description of the point; a second-order Taylor expansion is applied to each feature point based on the local structure description, sub-pixel offsets of the feature point in x, y and scale dimensions are calculated by solving linear equations to obtain accurate position coordinates; the stability of the accurate position coordinates is verified, when the offset in any dimension is greater than 1.5 or the iteration exceeds 5 times and still does not converge, the corresponding point is marked as an unstable point and removed from the feature set, forming a position stable point set; the local Hessian matrix of each point in the position stable point set is extracted, the eigenvalues of the local Hessian matrix of each point are calculated, and the principal curvature ratio is obtained, when the ratio is greater than 10, the corresponding point is marked as an edge response point and removed, generating a structure stable point set; a unique identifier is assigned to each point in the structure stable point set, and its accurate coordinates, scale parameter, principal direction and stability measurement value are recorded to construct a stable feature point set.
[0012] In a sixth implementation form of the first aspect, the optical component surface integrity index and optical performance deviation value are calculated based on the defect sensitive feature set, the defect type and severity are determined, comprising: the defect sensitive feature set is input into a pre-trained classification model, the classification model is composed of random forest, support vector machine and gradient boosting decision tree, the defect type to which the feature point belongs is identified by ensemble learning method, and a defect type mapping table is generated; based on the defect type mapping table, clustering analysis is performed on adjacent defect feature points, and a density clustering algorithm is used to classify points with close spatial positions and similar features into the same defect entity to obtain a defect region set; geometric characteristic parameters of each region in the defect region set are calculated, including area, perimeter, compactness and shape factor, and a defect characteristic description matrix is constructed in combination with defect type and position information; spatial correlation analysis is performed between the defect characteristic description matrix and a key functional region map of the endoscope optical component, a position sensitivity coefficient is calculated according to the distribution position of the defect in the functional region, and a weighted defect map is obtained. Calculating a surface integrity index based on the weighted defect map. The integrity index comprehensively considers the number, area, distribution density, and location sensitivity of defects, and obtains a standardized value from 0 to 100 through weighted summation. A higher value indicates better integrity. The optical performance deviation value is calculated based on the surface integrity index and spectral data, and a correlation is established between the deviation value and the defect parameter. The severity level of the defect is determined through a decision tree model, and a comprehensive evaluation report including the defect type, location, size and severity is generated.
[0013] In a second aspect, the present application provides an endoscope optical component quality detection system based on data analysis, the endoscope optical component quality detection system based on data analysis comprising: The scanning module is used to scan the optical components of the endoscope with an alternating wavelength light source, synchronously collect dual-channel image data of reflected light and scattered light, and form an original data set; A partitioning module is used to perform image partitioning processing on the original data set through an adaptive threshold segmentation algorithm, identify and extract edge areas and core functional areas, and generate a regional feature map; An extraction module, configured to apply an improved Gaussian-Laplace difference algorithm to the regional feature map to extract multi-scale feature points, and construct a defect sensitive feature set by combining the spectral response curve features; A calculation module is used to calculate the surface integrity index and optical performance deviation value of the optical component based on the defect sensitive feature set, and determine the defect type and severity.
[0014] In a third aspect, an endoscopic optical component quality detection device based on data analysis is provided, comprising: a memory and at least one processor, wherein instructions are stored in the memory; the at least one processor calls the instructions in the memory so that the endoscopic optical component quality detection device based on data analysis executes the above-mentioned endoscopic optical component quality detection method based on data analysis.
[0015] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, which, when executed on a computer, enables the computer to execute the above-mentioned method for quality detection of endoscope optical components based on data analysis.
[0016] The technical solution provided in this application achieves comprehensive and objective data collection of endoscope optical components through systematic alternating wavelength light source scanning and dual-channel image acquisition technology, forming a raw data set containing rich information and solving the problems of single viewing angle and lighting conditions in traditional manual inspection. An adaptive threshold segmentation algorithm is applied to the raw data set for image partitioning, accurately identifying and extracting edge regions and core functional areas, generating regional feature maps, and overcoming the subjective and ambiguous regional division shortcomings of traditional inspection. The improved Gaussian-Laplace difference algorithm demonstrates significant advantages in extracting multi-scale feature points, capable of simultaneously capturing potential defect characteristics at different scales. The defect-sensitive feature set constructed by combining the spectral response curve characteristics significantly improves the sensitivity and specificity of defect detection. In specific functional areas, the Gaussian-Laplace difference algorithm used in this solution has been modified to target the characteristics of endoscope optical components. Through multi-scale space construction and local extrema detection, the algorithm has extremely high detection capabilities for small surface defects of endoscope optical components. The algorithm's scale invariance ensures consistent recognition of defects of different sizes, making these algorithmic features a key contribution to the solution. Furthermore, the fusion analysis capabilities of algorithms and spectral data enable inspection to move beyond surface morphological features and identify internal defects that impact optical performance. The calculation method for the surface integrity index and optical performance deviation transforms qualitative assessment into quantitative analysis, using objective data to determine defect type and severity, eliminating the subjectivity of manual judgment and improving the consistency and repeatability of inspection results. In the specific application of endoscopic optical component quality inspection, a classification model integrating random forests, support vector machines, and gradient boosting decision trees, combined with a 128-dimensional defect-sensitive feature descriptor constructed using a feature fusion algorithm, provides powerful defect recognition capabilities. These deep learning and machine learning algorithms are specifically optimized for the characteristics of endoscopic optical components, achieving unprecedented classification accuracy. The entire inspection process is digitized and automated, significantly improving inspection efficiency. It enables comprehensive, multi-angle, and multi-parameter quality analysis in a short period of time, making it particularly suitable for quality control needs in large-scale production environments. This method not only accurately identifies and locates defects but also assesses their impact on optical performance, providing data support for production process optimization, thereby improving the overall quality of endoscopic optical components and enhancing the accuracy and safety of medical diagnoses. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 An embodiment of the endoscope optical assembly quality detection method based on data analysis in the present application is shown in the figure; Figure 2 An embodiment of the endoscope optical assembly quality detection system based on data analysis in the present application is shown in the figure; Figure 3 An embodiment of the endoscope optical assembly quality detection device based on data analysis in the present application is shown in the figure. DETAILED DESCRIPTION
[0019] The present application provides an endoscope optical assembly quality detection method and system based on data analysis. The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the above-mentioned figures are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" or "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0020] For ease of understanding, the specific process of the embodiments of the present application is described below. Please refer to Figure 1 An embodiment of the endoscope optical assembly quality detection method based on data analysis in the present application includes: Step S101, scanning the endoscope optical assembly with alternating wavelength light source, synchronously collecting reflected light and scattered light dual-channel image data, and forming original data set; Step S102, performing image partition processing on the original data set by adaptive threshold segmentation algorithm, identifying and extracting edge area and core functional area, and generating area feature map; Step S103, applying improved Gaussian-Laplacian difference algorithm to the area feature map to extract multi-scale feature points, combining with spectral response curve characteristics, and constructing defect sensitive feature set; Step S104, calculating optical assembly surface integrity index and optical performance deviation value based on the defect sensitive feature set, and determining defect type and severity.
[0021] It can be understood that the execution subject of the present application can be an endoscope optical assembly quality detection system based on data analysis, and can also be a terminal or a server, which is not limited here. The embodiments of the present application take the server as the execution subject for example.
[0022] Specifically, by alternating wavelength light source scanning on the endoscope optical assembly, the reflected light and scattered light dual-channel image data are synchronously collected. In this process, the endoscope optical assembly is fixed on a three-axis rotating mechanism, and a full-range scan is performed at an angle interval of 15 degrees to obtain spatial position data. At the same time, a narrow-band light source with a wavelength from 350 nm to 800 nm is used for irradiation, with an interval of 5 nm, and the optical response at each wavelength is recorded to obtain multi-band illumination data. The forward reflection light intensity distribution of the assembly surface is captured by the reflected light acquisition device, while the scattered light intensity at a scattering angle of 45 degrees is recorded by the scattered light acquisition device, forming a dual-channel original image. This dual-channel acquisition method can comprehensively reflect the surface characteristics and internal defect information of the optical assembly, making up for the shortcomings of traditional single light path acquisition. The dual-channel original image is spatially registered by a feature point matching algorithm to determine the spatial correspondence between the images, generating a registered image pair. The registered image pair is combined with the multi-band illumination data to construct a spectral-spatial joint feature matrix, which comprehensively reflects the optical characteristics of the assembly surface. Finally, the reflectivity and scattering coefficient ratio of each sampling point are calculated to form an original data set. The original data set is processed by an adaptive threshold segmentation algorithm. First, the adaptive histogram equalization algorithm is applied to the original data set to divide the image into 32x32 sub-blocks, and the histogram equalization processing is performed on each sub-block separately to enhance the contrast of the image. This block processing method avoids the problems of over-enhancement and detail loss caused by global histogram equalization. Based on the preprocessed image, the Otsu multi-level threshold value is calculated to divide the image grayscale value into four levels, corresponding to the non-functional area, edge transition area, core functional area and potential defect area, respectively, to generate a preliminary partition result. The Otsu algorithm determines the optimal threshold value by maximizing the inter-class variance to achieve automatic segmentation. Morphological opening and closing operations are applied to the preliminary partition result using a circular structural element with a radius of 3 pixels to eliminate noise and smooth the region boundaries, forming a smooth partition map. Then, region connectivity analysis is performed to mark the connected regions with an area greater than 50 pixels as valid regions, calculate the geometric center and boundary contour of each valid region, and obtain the region topology structure. The region topology structure is registered with the preset endoscope optical assembly standard template to align the region boundaries through affine transformation, accurately identify the positions of the edge region and the core functional area, and obtain a standardized partition map. Finally, according to the standardized partition map, a weight coefficient is assigned to each region, with the core functional area weight set to 1.0 and the edge region weight linearly decreasing according to the distance from the center, to generate a region feature map with weight.
[0023] A modified Gaussian-Laplacian difference algorithm is applied to the region feature map to extract multi-scale feature points. First, the region feature map with weight is smoothed by applying Gaussian filters with different scale parameters, which are set as 1.0, 1.6, 2.0, 2.5 and 3.2 respectively, to generate a 5-layer Gaussian pyramid image sequence. This multi-scale processing can capture defect features of different sizes. Then, pixel-level subtraction operation is performed on the adjacent two layers of the Gaussian pyramid image sequence to calculate the difference map between different levels, obtaining a multi-scale difference image set. In each layer of the multi-scale difference image set, 3x3x3 local extremum detection is performed on each non-boundary pixel point, and the points that meet both spatial and scale extremum are marked as candidate feature points to form an initial feature point set. For each point in the initial feature point set, the sub-pixel level coordinates are accurately located through 2-order Taylor expansion, and the principal curvature is calculated based on the eigenvalue ratio of Hessian matrix, and the unstable points with curvature ratio greater than 10 are removed to obtain a stable feature point set. The spectral response curve at the position of each stable feature point is extracted from the original data set, the 1st and 2nd derivatives of the curve are calculated, the inflection point and change rate of the curve are detected, and the spectral feature vector is generated. Combining the spatial feature and the spectral feature vector, a 128-dimensional defect-sensitive feature descriptor is constructed by a feature fusion algorithm, and all the feature descriptors are organized into a defect-sensitive feature set.
[0024] Based on the defect-sensitive feature set, the surface integrity index and the optical performance deviation value of the optical assembly are calculated to determine the defect type and severity. First, the defect-sensitive feature set is input into a pre-trained classification model composed of random forest, support vector machine and gradient boosting decision tree, which identifies the defect type to which the feature points belong through ensemble learning method, and generates a defect type mapping table. Based on the defect type mapping table, clustering analysis is performed on adjacent defect feature points, and the density clustering algorithm is used to classify the points with similar features and close spatial positions into the same defect entity to obtain a defect region set. For each region in the defect region set, the geometric characteristic parameters including area, perimeter, compactness and shape factor are calculated, and the defect characteristic description matrix is constructed by combining the defect type and position information. Spatial correlation analysis is performed between the defect characteristic description matrix and the key functional region map of the endoscope optical assembly, and the position sensitivity coefficient is calculated according to the distribution position of the defect in the functional region to obtain a weighted defect map. Based on the weighted defect map, the surface integrity index is calculated, which considers the number, area, distribution density and position sensitivity of the defect, and the standardized value of 0 to 100 is obtained by weighted summation, and the higher the value, the better the integrity. According to the surface integrity index and the spectral data, the optical performance deviation value is calculated, and the correlation between the deviation value and the defect parameters is established, and the severity level of the defect is determined through the decision tree model to generate a comprehensive evaluation report containing the defect type, position, size and severity.
[0025] During the inspection of endoscope optical components, after scanning a component with alternating wavelength light sources, the reflected light image showed a reflectivity of 0.95 in the center and 0.85 in the edge regions. The scattered light image showed a scattering intensity of 0.15 at a scattering angle of 45 degrees at a wavelength of 500 nm, significantly exceeding the standard value of 0.05, indicating a preliminary scattering anomaly. After adaptive threshold segmentation of the dataset, the core functional area accounted for 84%, the edge transition area accounted for 13%, and the potential defect area accounted for 3%. Using the Difference of Gaussian-Laplace algorithm, 23 feature points were detected in the defect area, 18 of which formed a connected region. The spectral feature vector indicated an abnormal 15% decrease in transmittance in the 450-550 nm band. The resulting defect-sensitive feature set was input into the classification model, which identified the defect as a "bubble-type" defect with an area of 0.8 mm² and located in the core functional area. The calculated surface integrity index was 76 (out of 100), and the optical performance deviation exceeded the allowable range by 20%, resulting in a "medium" defect severity. This method solves the problems of strong subjectivity, low efficiency and inconsistent standards in traditional manual experience judgment through systematic data collection and analysis at multiple angles and wavelengths, and achieves accurate detection of the quality of endoscope optical components.
[0026] In a specific embodiment, the process of executing step S101 may specifically include the following steps: Fix the endoscope optical assembly on the three-axis rotation mechanism, set the rotation angle interval to 15 degrees, perform a full-range scan at each angle position to obtain spatial position data; The endoscope optical components were illuminated with narrow-band light sources ranging from 350 nm to 800 nm, with an interval of 5 nm. The optical response at each wavelength was recorded to obtain multi-band illumination data. The reflected light acquisition device is used to capture the intensity distribution of the forward reflected light on the surface of the endoscope optical component, and the scattered light acquisition device is used to record the scattered light intensity at a 45-degree scattering angle to form a dual-channel original image. Perform spatial registration on the dual-channel original images, use feature point matching algorithm to determine the spatial correspondence between images, and generate registered image pairs; The registered image pairs are combined with multi-band illumination data to construct a spectral-spatial joint feature matrix reflecting the optical properties of the component surface. Based on the spectral-spatial joint feature matrix, the ratio of reflectance to scattering coefficient of each sampling point is calculated to form the original data set.
[0027] Specifically, the endoscope optical component is fixed on a three-axis rotation mechanism. The three-axis rotation mechanism is a precision positioning device that includes three independent rotation axes: X-axis, Y-axis and Z-axis, which can achieve precise positioning and rotation at any angle in space. The endoscope optical component is fixed to the center of the mechanism by a special fixture to ensure that the component remains stable during rotation. The rotation angle interval is set to 15 degrees, which means that the component will perform 24 (360 degrees ÷ 15 degrees) angle sampling in each axis direction, and the three axes are combined to form a three-dimensional angle sampling network. When performing a full-scale scan of each angle position, the component rotates to the preset angle in turn under the control of the mechanism, and remains stationary at each angle position to complete data collection. After the full-scale scan is completed, the spatial position data obtained contains the precise spatial coordinate information of the component at different angles. Each coordinate point corresponds to a set of three-dimensional spatial position parameters (x, y, z) and angle parameters (α, β, γ), which constitute a spatial positioning data set. When the endoscope optical components are irradiated with a multi-band light source, a narrow-band light source with a wavelength range of 350nm to 800nm is used. A narrow-band light source refers to a monochromatic light source with a very narrow spectral width (usually less than 10nm) that can provide pure light of a specific wavelength. Setting the wavelength interval of the light source to 5nm means that 91 (800-350÷5+1) irradiations and data collection at different wavelengths are required within the range of 350nm to 800nm. Each time the light source is irradiated, the center wavelength of the narrow-band light source is precisely adjusted to the target value, and the irradiation power is kept constant to ensure data consistency. After the light source is irradiated, the optical response parameters such as reflectivity and transmittance of the optical component at each wavelength are recorded to form multi-band illumination data, and each sampling point is associated with a spectral response curve.
[0028] When capturing the forward reflected light intensity distribution on the surface of an endoscope optical component through a reflected light collection device, the reflected light collection device is composed of a high-resolution camera and a light intensity detector, which is placed at the same angle as the incident light source but in the opposite direction to capture the light intensity distribution of the mirror reflection on the component surface. At the same time, the scattered light collection device is placed at a 45-degree angle to the incident light source to specifically record the scattered light intensity caused by the surface microstructure and internal defects of the component. The 45-degree scattering angle is an optimized angle at which the scattering characteristics of various defects are most obvious. Dual-channel acquisition is carried out simultaneously to ensure the temporal and spatial consistency of the two image data, forming a dual-channel original image containing two sets of image data, the reflected channel and the scattered channel.
[0029] When spatially registering dual-channel raw images, a feature point matching algorithm is used to determine the spatial correspondence between the images. This algorithm first extracts feature points from each channel. Feature points are pixels with distinct local features, such as edges, corners, or points with noticeable texture. A descriptor is then calculated for each feature point. A descriptor is a numerical vector that characterizes the image region surrounding the feature point. Feature point matching is performed based on the similarity of the descriptors to identify corresponding pairs of points in the two channel images. By matching these point pairs, a spatial transformation relationship is established between the two channel images, achieving precise registration and generating a registered image pair. In the registered image pair, precise spatial correspondence is established for every pixel in the reflectance and diffuse channels. When combining the registered image pair with multi-band illumination data, a spectral-spatial joint feature matrix is constructed. The registered reflected and diffuse light images are first spatially aligned. Then, for each spatial location, the reflectance and diffuse intensity data at different wavelengths are correlated to form a spectral response curve. The joint spectral-spatial characteristic matrix is a multidimensional data structure, with each element containing spatial coordinates (x, y, z), angular parameters (α, β, γ), and reflectance and scattering values at 91 wavelengths. This matrix comprehensively reflects the optical properties of the component surface at different locations, angles, and wavelengths.
[0030] When calculating the ratio of reflectivity to scattering coefficient at each sampling point based on the spectral-spatial joint feature matrix, the reflectivity R(λ) and scattering coefficient S(λ) at each spatial location at each wavelength are first extracted from the joint feature matrix. The reflectivity to scattering coefficient ratio V(λ) = R(λ) / S(λ) is then calculated to obtain a ratio spectrum curve. While the V(λ) curve of a normal optical component typically has a specific shape and range, defective areas will exhibit abnormal ratio variations. The ratio spectrum curves of all sampling points are organized into a comprehensive dataset, forming the raw dataset. The raw dataset contains rich spatial and spectral information, providing a comprehensive data foundation for subsequent defect detection.
[0031] In a specific embodiment, the process of executing step S102 may specifically include the following steps: An adaptive histogram equalization algorithm is applied to the original data set to divide the image into 32×32 sub-blocks. Histogram equalization is performed on each sub-block to obtain a pre-processed image with enhanced contrast. Based on the preprocessed image, the Otsu multi-level threshold is calculated to divide the image grayscale value into four levels, corresponding to the non-functional area, edge transition area, core functional area and potential defect area, and generate preliminary partitioning results; Morphological opening and closing operations are applied to the preliminary partitioning results, using a circular structure element with a radius of 3 pixels to eliminate noise and smooth the region boundaries to form a smooth partition map; Perform regional connectivity analysis on the smooth partition map, mark the connected regions with an area greater than 50 pixels as valid regions, and calculate the geometric center and boundary contour of each valid region to obtain the regional topological structure; The regional topology is registered with the preset standard template of the endoscope optical component, and the regional boundaries are aligned through affine transformation to identify the precise location of the edge area and the core functional area, thus obtaining a standardized partition map. A weight coefficient is assigned to each region according to the standardized zoning map. The weight of the core functional area is set to 1.0, and the weight of the edge area decreases linearly according to the distance from the center, generating a weighted regional feature map.
[0032] Specifically, the adaptive histogram equalization algorithm is an improved histogram equalization method. Unlike global histogram equalization, it divides the image into multiple small blocks and performs histogram equalization on each block individually. The original dataset image is divided into regular 32×32 sub-blocks, each containing a relatively small image area. Histogram equalization is performed on each sub-block individually, calculating the histogram of the pixel grayscale values within the sub-block. The original grayscale distribution is then mapped to a more uniform grayscale distribution using a cumulative distribution function. This local processing method effectively enhances local image contrast while avoiding the over-enhancement problem that global equalization may cause. It is particularly suitable for detecting subtle surface defects in endoscope optical components. After processing all sub-blocks, bilinear interpolation is used to smooth the transition between the equalization results of adjacent sub-blocks to avoid discontinuities at sub-block boundaries, ultimately resulting in a preprocessed image with enhanced contrast. Calculating the Otsu multi-level threshold based on the preprocessed image is the core step in achieving automatic image segmentation. The Otsu algorithm is an automatic threshold selection method based on the image grayscale histogram. Its basic principle is to divide the image into foreground and background components and maximize the inter-class variance between the two components. In this method, a multi-level Otsu thresholding method is used to classify the image grayscale values into four levels, rather than the traditional binary classification method. First, the grayscale histogram of the preprocessed image is calculated. Then, by maximizing the inter-class variance criterion, three optimal thresholds, T1, T2, and T3, are found to classify the image pixels into four grayscale levels: [0, T1], [T1+1, T2], [T2+1, T3], and [T3+1, 255]. These four levels correspond to the non-functional area, edge transition area, core functional area, and potential defect area of the endoscope optical component, respectively. The automatic calculation of the multi-level threshold takes into account the probability of occurrence of each grayscale level and the average grayscale value. By exhaustively enumerating all possible threshold combinations, the threshold combination that maximizes the weighted inter-class variance is found. This automatic segmentation method does not require human intervention and can adaptively determine the optimal segmentation point based on image characteristics to generate preliminary partitioning results.
[0033] Applying morphological opening and closing operations to the preliminary segmentation result is an important means to further optimize the segmentation result. Morphological operation is a set theory-based image processing technique, mainly used for analyzing and processing the geometric structure in images. Opening and closing operations are two basic morphological operations (dilation and erosion) combined. In this method, a circular structural element with a radius of 3 pixels is used for morphological operation. First, the opening operation (erosion followed by dilation) is performed, which can eliminate small bright spots (noise) and smooth the object outline; then the closing operation (dilation followed by erosion) is performed, which can fill small dark areas (holes) and connect disconnected regions. The circular structural element can better maintain the smooth boundary characteristics of the regions in the image compared to the rectangular or linear structural element, and is very suitable for the circular or elliptical structure often presented by the optical components of the endoscope. The continuous application of opening and closing operation effectively eliminates the noise and small regions generated in the segmentation process, and at the same time smooths the region boundaries, making the boundaries of each functional area more smooth and continuous, forming a smooth segmentation map.
[0034] Performing region connectivity analysis on the smooth segmentation map is a key step to identify effective regions. Region connectivity analysis is a technique for calculating connected regions in an image, mainly used to label pixel groups in an image that have the same properties and are connected to each other. In this method, first, each pixel in the smooth segmentation map is labeled, and adjacent pixels with the same gray level are considered to be connected; then a two-pass scanning algorithm is used, the first pass scans the image from left to right and from top to bottom, assigns a temporary label to each pixel, and records the label equivalence relationship; the second pass rescans the image, analyzes the equivalence relationship, and assigns a unique final label to the labels with equivalence relationship. Calculate the area of the labeled region, and only keep the connected regions with an area greater than 50 pixels, and the regions smaller than the threshold are considered as noise or meaningless regions and are filtered out. For the retained effective regions, calculate their geometric center (centroid) and boundary contour. The geometric center is obtained by calculating the average of all pixel coordinates of the region, and the boundary contour is extracted by the boundary tracking algorithm to obtain the region topology, including the spatial position, area, shape and adjacency relationship of the region.
[0035] The standard template of an endoscope optical component is a predefined ideal model that contains the standard shape, position, and size information of each functional area of a typical endoscope optical component. The registration process first extracts feature points from the regional topology and the standard template, including the regional centroid, boundary key points, and shape feature points; then establishes the correspondence between the two through feature point matching; and finally, achieves regional alignment through affine transformation. Affine transformation is a mapping transformation that preserves points, lines, and planes and can handle geometric transformations such as translation, rotation, scaling, and shearing. The optimal affine transformation matrix is obtained by solving the least squares problem, and then the matrix is applied to transform the regional topology so that it is precisely aligned with the standard template in space. After the registration is completed, the precise positions of the edge area and the core functional area of the endoscope optical component are accurately identified by comparison with the standard template, and a standardized partition map is obtained.
[0036] The final step in generating a regional feature map is to assign a weight coefficient to each region based on the standardized partition map. The weight coefficient reflects the importance and sensitivity of different regions in the function of the optical component. In this method, the weight of the core functional area is set to 1.0, indicating that this area has the greatest impact on optical performance and the highest sensitivity for defect detection. The weight of the edge area decreases linearly according to the distance from the center. The specific calculation method is to linearly map the normalized distance from the pixel to the center of the core functional area to a weight range of 0.5 to 1.0. The closer the distance, the closer the weight is to 1.0; the farther the distance, the closer the weight is to 0.5. After the weight assignment is completed, the weight information is superimposed on the standardized partition map to generate a weighted regional feature map. This weighted regional characterization method takes into account the functional importance differences between different regions of the endoscope optical component.
[0037] In a specific embodiment, the process of executing step S103 may specifically include the following steps: Gaussian filters with different scale parameters are applied to smooth the regional feature maps. The scale parameters are set to 1.0, 1.6, 2.0, 2.5 and 3.2 respectively to generate a 5-layer Gaussian pyramid image sequence. Perform pixel-level subtraction operations on two adjacent layers of images in the Gaussian pyramid image sequence, and calculate the first difference image as 1.6 layers minus 1.0 layers, the second difference image as 2.0 layers minus 1.6 layers, the third difference image as 2.5 layers minus 2.0 layers, and the fourth difference image as 3.2 layers minus 2.5 layers, respectively, to obtain a multi-scale difference image set; In each layer of the multi-scale difference image set, a 3×3×3 local extreme value detection is performed on each non-boundary pixel point, and the points that meet both spatial extreme values and scale extreme values are marked as candidate feature points to form an initial feature point set; For each point in the initial feature point set, its sub-pixel level coordinates are accurately located by 2nd order Taylor expansion, and the principal curvatures are calculated based on the eigenvalue ratio of Hessian matrix, and unstable points with curvature ratio greater than 10 are removed, to obtain a stable feature point set; The spectral response curve at the position of each stable feature point is extracted from the original data set, the 1st and 2nd derivatives of the curve are calculated, the inflection point and the change rate of the curve are detected, and a spectral feature vector is generated; For each point in the stable feature point set, a 128-dimensional defect-sensitive feature descriptor is constructed by a feature fusion algorithm combining its spatial feature and the corresponding spectral feature vector, and all the feature descriptors are organized into a defect-sensitive feature set.
[0038] Specifically, the Gaussian filter is an important image smoothing tool, which uses a Gaussian function as the filter kernel to perform convolution operation on the image. The Gaussian function is in the shape of a bell in the spatial domain, with the central value being the maximum and decreasing with the distance from the central point. In this method, five Gaussian filters with different scale parameters are applied to the region feature map. The scale parameter refers to the standard deviation of the Gaussian function, which is set to 1.0, 1.6, 2.0, 2.5 and 3.2 respectively. A smaller scale parameter (such as 1.0) preserves the details and local features in the image, while a larger scale parameter (such as 3.2) filters out the details and only preserves the main structure of the image. During the filtering process, the Gaussian kernel corresponding to the scale parameter is first constructed, and then the convolution operation between the Gaussian kernel and the image is performed to achieve the smoothing effect. After this processing, a sequence of 5-layer Gaussian pyramid images is obtained, each layer of which reflects the features of the endoscope optical assembly at different scales. The difference between adjacent layers can highlight the features that change between the two scales, which is particularly suitable for detecting edges and local anomalies on the endoscope optical assembly. The difference operation directly subtracts the pixel values of the corresponding positions of the adjacent two layers of images. Specifically, when calculating the 1st difference map, each pixel value of the 1.6th layer is subtracted from the corresponding pixel value of the 1.0th layer; when calculating the 2nd difference map, each pixel value of the 2.0th layer is subtracted from the corresponding pixel value of the 1.6th layer; when calculating the 3rd difference map, each pixel value of the 2.5th layer is subtracted from the corresponding pixel value of the 2.0th layer; and when calculating the 4th difference map, each pixel value of the 3.2th layer is subtracted from the corresponding pixel value of the 2.5th layer. The 4 layers of difference images obtained in this way form a multi-scale difference image set, also known as Gaussian-Laplacian difference (DoG) images, which can effectively capture the feature changes of different scales on the endoscope optical assembly.
[0039] Local extremum detection refers to the process of finding the extremum points in both image space and scale space. For each layer in the difference image set, a 3x3x3 local extremum detection is performed for each non-boundary pixel. Here, 3x3x3 means that the current pixel is taken as the center, and 8 spatial neighborhood pixels in the current layer and 9+9=18 pixels in the corresponding positions of the upper and lower adjacent layers are considered, for a total of 26 neighborhood pixels. If the current pixel value is greater than or less than all 26 neighborhood pixel values, the point is marked as a local extremum point. This method of considering both spatial and scale extremum can find points that have significant characteristics in both space and scale, which often correspond to corner points, edge intersection points, or feature points of local abnormal regions on the endoscope optical assembly. After extremum detection, all points that meet the conditions are marked as candidate feature points, forming an initial feature point set.
[0040] Because the difference image is discrete, the initial detected extreme point locations are only accurate to integer pixels. A second-order Taylor expansion allows the precise location of the extreme points at the sub-pixel level. For each candidate feature point, a 3×3 neighborhood is first extracted from the difference image centered at the point. A second-order Taylor expansion is then performed on the difference function within this area. By solving the derivatives of the expansion, the exact offsets of the extreme point in the x, y, and scale dimensions are calculated. If the calculated offsets are large (typically greater than 0.5), new neighborhood points are selected and the calculation is iterated until the offsets converge within a small range. Once the offsets are determined, the Hessian matrix (a matrix describing the second-order partial derivatives of the function at that point) is calculated for that point. The stability of the point is assessed by calculating the eigenvalue ratio of the Hessian matrix. An eigenvalue ratio greater than 10 indicates that the point is located on an edge rather than a corner, indicating that the point's position is unstable and should be eliminated. This precise location and screening process results in a set of stable feature points. The spectral response curve of an endoscope's optical components reflects its optical properties at different wavelengths and is of great value for defect detection. For each point in the stable feature point set, the spectral response values at all measured wavelengths at that location are extracted from the original dataset based on its spatial coordinates, forming a spectral response curve. The first and second derivatives of this curve are then calculated. The first derivative reflects the rate of change of the curve and can detect upward and downward trends; the second derivative reflects the degree of curvature and can detect inflection points. By analyzing the shape characteristics, rate of change, and inflection point location of the spectral curve, key parameters characterizing the spectral characteristics of that point are extracted to form a spectral feature vector. These spectral features are crucial for distinguishing normal from defective areas of an endoscope's optical components. Spatial features include the precise coordinates, scale parameters, and principal directions of the feature point, while the spectral feature vector contains the spectral response characteristics of the point. These two types of features are organically combined using a feature fusion algorithm to construct a 128-dimensional defect-sensitive feature descriptor. During feature fusion, the spatial and spectral features are first normalized to bring their numerical ranges into line. The two types of features are then weighted and combined according to preset weights. Finally, dimensionality reduction techniques (such as principal component analysis) are used to compress the combined features to 128 dimensions, forming the final feature descriptor. This feature descriptor, which integrates spatial and spectral information, comprehensively reflects the comprehensive characteristics of the endoscope's optical components at each feature point, demonstrating a particularly high sensitivity to defective areas. The descriptors of all feature points are organized together to form a defect-sensitive feature set, providing the data foundation for subsequent defect identification and classification.
[0041] In a specific embodiment, the process of performing the 3×3×3 local extremum detection step for each non-boundary pixel point may specifically include the following steps: Boundary extension is performed on each layer image of the multi-scale difference image set, and a 1-pixel wide boundary value is filled around the image to ensure that edge pixels can also participate in the subsequent extreme value detection process, and a boundary extension image is obtained; A scale space block is extracted from the boundary extension image, and each center point and its 8 adjacent points in the same layer and 18 points in the upper and lower layers form a 3x3x3 detection window to form a local detection area; For each center point in the local detection area, the gray value difference between the center point and the other 26 points in the window is calculated. When the gray value of the center point is greater than or less than all 26 points, it is marked as a local extreme point, and a position extreme set is obtained; Each point in the position extreme set is substituted into the Taylor series expansion formula, and the accurate offset of the extreme point is calculated by derivation. When the offset exceeds 0.5 pixel units in any direction, resample and iterate along the offset direction until the offset converges, and obtain the accurate position point set; The principal curvature ratio of each point in the accurate position point set is calculated, and the points with a curvature ratio less than 10 are screened out by solving the ratio of eigenvalues of Hessian matrix to form a stable feature candidate point; The feature points are weighted and screened based on the weight value of the region where the stable feature candidate points are located. The feature point retention rate of the core functional area is set to 100%, and the feature points in the edge area are linearly adjusted according to the weight to generate an initial feature point set.
[0042] Specifically, boundary extension involves adding additional rows and columns of pixels around the image, allowing the original image's edge pixels to participate in subsequent feature point detection. In this method, a 1-pixel-wide boundary extension is employed, adding a row or column of pixels to each of the top, bottom, left, and right edges of the image. Boundary values are filled using a mirror padding method, mirroring the pixel values at the image edge to the extended region. This method maintains the continuity of the image edge and avoids interference introduced by abrupt boundary changes. For example, for a multi-scale difference image of size M×N, the boundary extension reduces the image size to (M+2)×(N+2), shifting the pixel positions of the original image from (0,0) to (1,1), and filling the boundary region with the mirrored values of the corresponding edge pixels. This boundary extension ensures that image edge pixels can also serve as center points for local extrema detection within a 3×3×3 window, avoiding loss of edge information and resulting in a boundary-extended image. Extracting scale-space blocks composed of three adjacent layers from the boundary-extended image is a key step in constructing the 3D detection window. A scale-space block is a three-dimensional data structure composed of three adjacent layers of images in a multi-scale difference image set. It is used to capture local variations in feature points in both spatial and scale dimensions. In this method, for each layer in the multi-scale difference image set (except the top and bottom layers), it is combined with the two adjacent layers above and below it to form a three-layer scale-space block. For each center point in this block, a 3×3×3 detection window centered on it is extracted. This window contains a 3×3 neighborhood (9 points in total, including the center point itself) surrounding the center point of the current layer, as well as 3×3 neighborhoods (9 points each) at the corresponding locations in the upper and lower layers. A total of 27 points form a cubic local detection region. This three-dimensional window design simultaneously considers local characteristics in both spatial and scale domains, facilitating the detection of feature points that are significant in both spatial and scale.
[0043] Grayscale value difference refers to the numerical difference between the pixel value of a central point and its neighboring points, and is used to determine whether the point is a local maximum or minimum. In this method, for each 3×3×3 detection window, the grayscale value of the central point is compared with the grayscale values of the other 26 points within the window (8 neighboring points in the same layer and 9 points in the layers above and below, for a total of 26 points). If the grayscale value of the central point is greater than the grayscale values of all 26 neighboring points, the point is marked as a local maximum; if the grayscale value of the central point is less than the grayscale values of all 26 neighboring points, the point is marked as a local minimum. Maximum and minimum points are collectively referred to as local extreme points, and together they constitute the position extreme value set. This method of extreme value detection in three-dimensional space can effectively identify feature points that are significant in both spatial position and scale variation, making it particularly suitable for detecting defect features in endoscope optical components. Taylor series expansion is a mathematical method that uses polynomials to approximate the behavior of a function near a point and is commonly used for sub-pixel localization in image processing. In this method, for each point in the position extreme value set, the pixel values surrounding it are extracted, centered around its integer coordinates in the differential image. A Taylor series expansion is then applied to approximate the function expression around that point. Specifically, a second-order Taylor expansion is performed on the differential function D(x, y, σ) at the point (x_0, y_0, σ_0). The derivative is then taken and set equal to zero, resulting in the precise offset (Δx, Δy, Δσ) of the extreme value point. If the calculated offset exceeds 0.5 pixel units in any direction, it indicates that the actual extreme value point is far from the integer grid point. The point needs to be moved to a new integer grid point in the offset direction and recalculated at the new location. This process is iterated until the offset converges to within 0.5 pixel units or the number of iterations reaches a preset upper limit (typically 5), ultimately resulting in a precise set of position points. This sub-pixel precision significantly improves the accuracy of feature point positioning and is crucial for detecting subtle defects in endoscope optical components.
[0044] The principal curvature is a geometric quantity that describes the degree of curvature of a surface at a certain point, and the principal curvature ratio reflects the anisotropy of the curvature at that point. In this method, the principal curvature is calculated by solving the eigenvalues of the Hessian matrix. The Hessian matrix is a matrix composed of the second-order partial derivatives of a function. For a point (x, y) in a two-dimensional image, its Hessian matrix H is a second-order matrix containing four elements: D_xx, D_xy, D_yx, D_yy, which represent the second-order partial derivatives of the difference function D in the x and y directions, respectively. Calculate the two eigenvalues λ_1 and λ_2 of the Hessian matrix, which represent the principal curvature at that point. Then calculate the ratio of the eigenvalues r = r = — (λ1*λ2), when the two eigenvalues have the same sign and close in value, the value of r is small, indicating that the point is a corner point; when the two eigenvalues have the same sign but differ greatly in value, the value of r is large, indicating that the point is an edge point. In the present method, the points with a curvature ratio r less than 10 are screened out as stable feature candidate points, because these points usually correspond to corner points or blob points rather than edge points, and have better position stability.
[0045] The weight value reflects the importance and sensitivity of different regions of the optical assembly of the endoscope, and is used to adjust the retention rate of the feature points. In the present method, the retention strategy of the feature points is determined according to the weight value of the region where the feature points are located. For the feature points in the core functional area, since this area has the greatest impact on the optical performance and the highest sensitivity of defect detection, the retention rate is set to 100%, that is, all feature points meeting the foregoing conditions are retained. For the feature points in the edge area, considering that the impact of this area on the optical performance is relatively small, a linear adjustment strategy of the retention rate is adopted according to the weight. Specifically, the weight of the edge area decreases linearly according to the distance from the center of the core area, and the higher the weight value of the region, the closer the retention rate to 100%, and the lower the weight value of the region, the lower the retention rate. For example, for the edge area with a weight value of 0.8, the retention rate of the feature points can be set to 80%, that is, 80% of the feature points in this area are randomly retained, and 20% are discarded. Through this weighted screening strategy matching the importance of the region, the initial feature point set containing the points with accurate position, stable structure and reasonable distribution is finally generated.
[0046] In a specific embodiment, the process of performing the sub-pixel level step of accurately positioning each feature point by 2-order Taylor expansion can specifically include the following steps: Extracting the coordinate position and scale information of each point from the initial feature point set, constructing an initial feature point parameter table as input data for accurate positioning; For each point in the initial feature point parameter table, a 5x5 neighborhood window is constructed on the differential image layer where the point is located, the gradient and Hessian matrix elements in the neighborhood window are calculated to obtain the local structure description of the point; Based on the local structure description, 2-order Taylor expansion is applied to each feature point, and the sub-pixel offset in x, y and scale dimensions of the feature point is calculated by solving the linear equation set to obtain the accurate position coordinates; Stability verification is performed on the accurate position coordinates, and when the offset in any dimension is greater than 1.5 or the iteration exceeds 5 times without convergence, the corresponding point is marked as an unstable point and removed from the feature set to form a set of position stable points; From the set of position stable points, the local Hessian matrix of each point is extracted, the eigenvalues of the local Hessian matrix of each point are calculated, and the principal curvature ratio is obtained. When the ratio is greater than 10, the corresponding point is marked as an edge response point and removed to generate a set of structure stable points; A unique identifier is assigned to each point in the structural stable point set, and its precise coordinates, scale parameters, main directions and stability measurement values are recorded to construct a stable feature point set.
[0047] Specifically, the initial feature point set is a set of points obtained by performing local extrema detection on a multi-scale difference image. Each point has its position in the image and the scale level it belongs to. The coordinate position refers to the x and y coordinates of the point on the image plane, typically integer values, representing the row and column position of the pixel in the image matrix. The scale information refers to the Gaussian pyramid level at which the point resides, corresponding to the scale parameter value of the Gaussian filter. During data processing, each point in the initial feature point set is first traversed, and its coordinate position (x, y) and scale parameter σ are extracted and recorded, organizing them into a feature point initial parameter table. This parameter table is a data structure with each row corresponding to a feature point and containing fields such as the point's unique identifier, x coordinate, y coordinate, and scale parameter. The purpose of constructing the feature point initial parameter table is to provide a unified data access interface for subsequent precise positioning, simplifying data organization and management.
[0048] Constructing a 5×5 neighborhood window on the difference image layer for each point in the feature point initial parameter table is a key step in obtaining a local structure description. A 5×5 neighborhood window is a square region consisting of 25 pixels in 5 rows and 5 columns, centered on the feature point. Compared to the 3×3 window used in previous extremum detection, a 5×5 window provides greater local contextual information, facilitating a more accurate estimation of the point's local structural characteristics. When calculating gradients and Hessian matrix elements within the neighborhood window, the grayscale gradient of each point within the window is first calculated. The gradients consist of the first-order derivatives in the x- and y-directions, typically approximated using the finite difference method. Next, the Hessian matrix elements, i.e., the second-order derivatives of the grayscale values, are calculated, including the second-order derivative in the x- and y-directions, and the xy-cross second-order derivatives. These gradients and Hessian matrix elements collectively describe the local grayscale value trend around the feature point, forming the point's local structure description. The local structure description is a data representation that quantitatively characterizes the geometric and photometric properties of the feature point's neighborhood.
[0049] Applying a second-order Taylor expansion to each feature point based on local structure description is the core technology for achieving sub-pixel precision positioning. A second-order Taylor expansion is a mathematical approximation method that expresses a function near a point as a polynomial of the function value and its derivative at that point. In feature point localization, the differential function D(x, y, σ) is expanded into a second-order Taylor polynomial at the feature point's initial position (x0, y0, σ0). The exact location of the extreme point is then determined by solving the conditions for the derivative to be zero. The specific solution involves establishing a system of linear equations whose unknowns are the feature point's offsets Δx, Δy, and Δσ in the three dimensions of x, y, and σ. The coefficients of the system are composed of the gradient at the feature point and the elements of the Hessian matrix. Solving this system of linear equations through matrix operations yields the sub-pixel offset of the feature point. The sub-pixel offset refers to the fractional portion of the feature point's actual position relative to the integer pixel position. By accounting for these fractional offsets, the accuracy of feature point localization is significantly improved. Adding the calculated offset to the initial integer coordinates yields the precise location coordinates of the feature points. These coordinates include decimals and have sub-pixel accuracy. Verifying the stability of these precise coordinates is a crucial measure for ensuring the reliability of feature points. Stability verification assesses the accuracy and stability of feature point positions, focusing on two key aspects: offset magnitude and iterative convergence. During data processing, the calculated offsets Δx, Δy, and Δσ are first checked. If the absolute value of the offset in any dimension exceeds 1.5 pixels, the initial position deviates significantly from the actual extreme point location and requires recalculation centered on the new integer position. If the offset remains large after the position update, further iterations are required. If the offset still fails to converge after multiple iterations, or if the number of iterations exceeds a preset upper limit of five, the point is deemed unstable, marked as unstable, and removed from the feature set. Stability verification ensures the high accuracy and stability of the retained feature point positions, preventing uncertain or oscillating points from interfering with subsequent processing. The points retained after stability verification constitute the stable point set.
[0050] Extracting the local Hessian matrix for each point from the set of positionally stable points is a fundamental step in calculating the principal curvature ratio. The local Hessian matrix is a 2×2 matrix that describes the local second-order derivative structure of the feature point. It contains four elements: the x-direction second-order derivative Dxx, the y-direction second-order derivative Dyy, and two cross-second-order derivatives Dxy and Dyx (usually Dxy = Dyx). These second-order derivatives reflect the rate of change of the grayscale value at the feature point and describe the local curvature characteristics. During data processing, the elements of the Hessian matrix for each positionally stable point are first extracted from the previously calculated local structure description, and then the eigenvalues of this matrix are calculated. The eigenvalues of the Hessian matrix are a pair of real numbers representing the principal curvature at the feature point, that is, the degree of curvature of the local surface in the principal direction. Eigenvalues are typically calculated by solving the characteristic equation or by matrix diagonalization. Once the eigenvalues are obtained, the principal curvature ratio is calculated as the square of the sum of the two eigenvalues divided by the product of the two eigenvalues. When the principal curvature ratio is greater than the preset threshold of 10, it indicates that the point is located on the edge rather than the corner. Such points are more sensitive to position changes and are less stable, so they should be removed. The points retained after the principal curvature ratio screening constitute the structurally stable point set.
[0051] Assigning a unique identifier to each point in the structurally stable point set and recording its key parameters is the final step in constructing the final stable feature point set. The unique identifier is an integer or string that uniquely references and distinguishes each feature point in subsequent processing. During data processing, each structurally stable point is assigned a unique identifier according to a specific rule (such as sorting by coordinates or directly using an index). Key parameters such as the precise coordinates, scale parameter, principal direction, and stability metric are then recorded. The precise coordinates are the coordinate values of the feature point after subpixel precision positioning, including a fractional part. The scale parameter reflects the scale of the feature point and corresponds to the standard deviation of a Gaussian filter. The principal direction is the direction with the highest frequency in the local gradient statistics of the feature point, typically expressed as an angle. The stability metric is a numerical value reflecting the reliability of the feature point and can be calculated based on contrast, gradient amplitude, or eigenvalue ratio. These parameters comprehensively describe the location, scale, orientation, and stability characteristics of the feature point, providing information for subsequent feature description and matching. All points and their parameters are organized together to form the final stable feature point set.
[0052] In a specific embodiment, the process of executing step S104 may specifically include the following steps: The defect-sensitive feature set is input into a pre-trained classification model. The classification model consists of a random forest, a support vector machine, and a gradient boosting decision tree. The ensemble learning method is used to identify the defect type to which the feature points belong and generate a defect type mapping table. Based on the defect type mapping table, cluster analysis is performed on adjacent defect feature points. The density clustering algorithm is used to classify points with close spatial positions and similar features as the same defect entity, and a defect area set is obtained. Calculate the geometric characteristic parameters of each region in the defect region set, including area, perimeter, compactness and shape factor, combined with defect type and location information, to construct a defect characteristic description matrix; Spatially correlate the defect characteristic description matrix with the key functional region map of the endoscope optical assembly, calculate the position sensitivity coefficient according to the distribution position of the defect in the functional region, and obtain the weighted defect map; Based on the weighted defect map, calculate the surface integrity index, which comprehensively considers the number, area, distribution density and position sensitivity of defects, and obtain a standardized value of 0 to 100 through weighted summation, the higher the value, the better the integrity; According to the surface integrity index and the spectral data, calculate the optical performance deviation value, establish the correlation between the deviation value and the defect parameters, determine the severity level of the defect through the decision tree model, and generate a comprehensive evaluation report containing defect type, location, size and severity.
[0053] Specifically, the defect sensitive feature set is constructed in the previous step, which contains the spatial and spectral characteristic information of the feature points on the surface of the endoscope optical assembly. The pre-trained classification model refers to the machine learning model trained in advance through known samples, which is used to map new feature data into predefined categories. In this method, an ensemble learning framework composed of random forest, support vector machine and gradient boosting decision tree is adopted. Random forest is an ensemble algorithm based on decision tree, which classifies by constructing multiple decision trees and taking the majority vote; support vector machine is an algorithm that finds the optimal classification hyperplane, which is particularly suitable for processing high-dimensional feature data; gradient boosting decision tree is an algorithm that improves the overall performance by iteratively training a series of weak learners. Ensemble learning method is a technology that combines multiple base classifiers to improve classification performance. In this method, a weighted voting strategy is used to integrate the results of the three classifiers. The data processing process first inputs the defect sensitive feature set into three base classifiers, each classifier independently gives the defect type prediction of each feature point, then combines the prediction results according to the weight of each classifier (determined by Bayesian optimization method), finally determines the defect type of each feature point, and generates a defect type mapping table. The defect type mapping table is a data structure that records the identifier of each feature point and the corresponding defect type, such as scratch, bubble, impurity, coating unevenness, etc.
[0054] Clustering analysis of neighboring defect feature points based on the defect type mapping table is an important step in identifying complete defect entities. Clustering analysis is an unsupervised learning method that aims to group data points such that points within the same group are similar to each other, while points between different groups are significantly different. In this method, a density-based clustering algorithm is used to cluster the defect feature points. Density-based clustering algorithms are based on density and can discover clusters of arbitrary shape, and can effectively handle noise. Common density-based clustering algorithms include DBSCAN (Density-Based Spatial Clustering of Applications with Noise). During data processing, two key parameters are first set: neighborhood radius ε and minimum point number MinPts. For each defect feature point, the number of points in its ε-neighborhood is calculated. If the number of points is not less than MinPts, the point is marked as a core point. Then, starting from any unvisited core point, recursively add all points (including other core points) in its ε-neighborhood to the same cluster until the cluster cannot be expanded. This density-based clustering method is particularly suitable for processing defect feature points on endoscopic optical components, as defects are usually characterized by high-density feature point groups, while non-defect areas have sparse feature points. When clustering, not only the spatial proximity of feature points is considered, but also the similarity of their feature vectors, ensuring that points in the same cluster are not only spatially close, but also similar in feature representation. After clustering, each cluster is identified as a defect entity, and all defect entities form a defect region set.
[0055] Calculating geometric characteristic parameters for each region in the defect region set is a basic step in constructing the defect characteristic description matrix. Geometric characteristic parameters are quantitative indicators that describe the shape and size characteristics of defect regions, including area, perimeter, compactness, and shape factor. Area refers to the number of pixels contained in the defect region, usually obtained by counting all pixel points within the region; perimeter refers to the length of the boundary of the defect region, calculated by counting the number of boundary pixels; compactness is an indicator that measures the circularity of the region shape, defined as (4π×area) / (perimeter squared), and the compactness of a perfect circle is 1, the more irregular the shape, the smaller the compactness; shape factor is another indicator that describes the shape complexity, usually defined as (perimeter squared) / area. During data processing, the boundary contour of each defect region is first identified, and then the above geometric characteristic parameters are calculated based on the contour. In addition to geometric characteristics, defect type and location information are also considered. The defect type comes from the previously generated defect type mapping table, and the location information includes the center coordinates of the defect region and the relative position on the endoscopic optical component. These information are integrated to construct the defect characteristic description matrix, which is a table format data structure, each row corresponds to a defect region, and each column corresponds to a characteristic parameter, fully describing the characteristics of each defect region.
[0056] The spatial correlation analysis of the defect characteristic description matrix with the key functional area map of the endoscope optical assembly is a key step in generating the weighted defect map. The key functional area map is a spatial distribution map representing the importance of different functional areas of the endoscope optical assembly, usually constructed by professional knowledge and experience. Spatial correlation analysis refers to superimposing the location of the defect area with the functional area map to evaluate the distribution of the defect in different functional areas. In the data processing process, first, the position information of the defect area is spatially registered with the functional area map to ensure that they are in the same coordinate system; then the positional relationship between each defect area and each functional area is analyzed, and the overlapping area or the shortest distance between the defect area and each functional area is calculated; finally, the position sensitivity coefficient of the defect is calculated according to the importance weight of the functional area. The position sensitivity coefficient is a numerical value reflecting the importance of the defect position, and the sensitivity coefficient is higher when the defect is located in the key functional area (such as the optical center area), and the sensitivity coefficient is lower when the defect is located in the non-key area (such as the edge area). By combining the information in the defect characteristic description matrix with the position sensitivity coefficient, a weighted defect map is generated, which not only reflects the existence and characteristics of the defect, but also considers the importance of the defect position.
[0057] The calculation of the surface integrity index based on the weighted defect map is a comprehensive step to evaluate the overall quality of the endoscope optical assembly. The surface integrity index is a comprehensive index that quantifies the overall integrity and quality level of the surface of the endoscope optical assembly. In the data processing process, first, consider the number of defects, count the number of defects in the weighted defect map; then consider the defect area factor, calculate the total area of all defect areas and its proportion in the component surface; then consider the defect distribution density, analyze the distribution of defects on the component surface, such as the degree of aggregation and uniformity; finally, consider the position sensitivity, weight the defects according to the position sensitivity coefficient of each defect. Integrate these factors together, calculate the surface integrity index by weighted summation, the formula can be expressed as: index = base score - defect quantity deduction - defect area deduction - distribution density deduction - position sensitivity deduction. The calculation result is normalized to map to the standardized numerical range of 0 to 100, where 0 represents complete unqualified, 100 represents complete defect-free, and the higher the value, the better the integrity. This comprehensive index considers multiple factors and can fully reflect the quality of the surface of the endoscope optical assembly.
[0058] The optical performance deviation value refers to the difference between the actual optical performance of the endoscope optical assembly and the ideal or standard performance. In the data processing process, first, the spectral data of the endoscope optical assembly, including the transmittance, dispersion curve and other optical parameters, are extracted from the original data set; then the spectral data are compared with the predetermined standard parameters to calculate the deviation of each index; then the relationship between the surface integrity index and the optical performance deviation is analyzed, and a mathematical model is established to describe the correlation between the two; finally, the severity level of the defect is determined according to the deviation value and other parameters through the decision tree model. The decision tree model is a tree-like decision support tool that classifies input data into different result categories through a series of conditional judgments. In this method, the inputs of the decision tree include the optical performance deviation value, the surface integrity index, the defect type and the defect characteristics, and the output is the classification of the severity level of the defect, such as "mild", "moderate", "severe" or "fatal". Based on these judgment results, a comprehensive evaluation report containing the defect type, location, size and severity is generated, providing a decision basis for the quality control and production improvement of the endoscope optical assembly.
[0059] The above describes the data analysis-based endoscope optical assembly quality detection method in the embodiments of the present application, and the following describes the data analysis-based endoscope optical assembly quality detection system in the embodiments of the present application. Please refer to Figure 2 One embodiment of the data analysis-based endoscope optical assembly quality detection system in the embodiments of the present application includes: A scanning module 201 is configured to scan the endoscope optical assembly with an alternating wavelength light source, synchronously collect dual-channel image data of reflected light and scattered light, and form an original data set; A partitioning module 202 is configured to perform image partitioning processing on the original data set by using an adaptive threshold segmentation algorithm, identify and extract edge regions and core functional areas, and generate a region feature map; An extraction module 203 is configured to extract multi-scale feature points from the region feature map by using an improved Gaussian-Laplacian difference algorithm, and construct a defect sensitive feature set in combination with spectral response curve characteristics; A calculation module 204 is configured to calculate the surface integrity index and the optical performance deviation value of the optical assembly based on the defect sensitive feature set, and determine the defect type and severity.
[0060] The above Figure 2 The data analysis-based endoscope optical assembly quality detection system in the embodiments of the present application is described in detail from the perspective of modular functional entities, and the data analysis-based endoscope optical assembly quality detection device in the embodiments of the present application is described in detail from the perspective of hardware processing.
[0061] Figure 3is a structural schematic view of an endoscope optical assembly quality detection device based on data analysis provided by an embodiment of the present application. The endoscope optical assembly quality detection device based on data analysis 300 can have great differences due to different configurations or performances, and can include one or more processors (central processing units, CPU) 310 (for example, one or more processors) and a memory 320, one or more storage media 330 (for example, one or more mass storage device ends) storing application programs 333 or data 332. The memory 320 and the storage medium 330 can be temporary storage or persistent storage. The programs stored in the storage medium 330 can include one or more modules (not shown in the figure), and each module can include a series of instruction operations in the endoscope optical assembly quality detection device based on data analysis 300. Further, the processor 310 can be configured to communicate with the storage medium 330 and execute a series of instruction operations in the storage medium 330 on the endoscope optical assembly quality detection device based on data analysis 300 to realize the steps of the above-mentioned endoscope optical assembly quality detection method based on data analysis.
[0062] The endoscope optical assembly quality detection device based on data analysis 300 can also include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input / output interfaces 360, and / or one or more operating systems 331, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art can understand that, Figure 3 The structure of the endoscope optical assembly quality detection device based on data analysis shown does not constitute a limitation on the endoscope optical assembly quality detection device based on data analysis provided by the present application, and can include more or fewer components than shown, or combine certain components, or different component arrangements.
[0063] The present application also provides a computer readable storage medium, which can be a non-volatile computer readable storage medium, or a volatile computer readable storage medium. The computer readable storage medium stores instructions, which, when executed on a computer, cause the computer to perform the steps of the endoscope optical assembly quality detection method based on data analysis.
[0064] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, system and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0065] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a data analysis-based endoscopic optical component quality inspection device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.
[0066] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for detecting the quality of endoscope optical components based on data analysis, characterized in that: The method comprises: Scan the endoscope optical components with an alternating wavelength light source, and synchronously collect dual-channel image data of reflected light and scattered light to form an original data set; The original data set is processed by an adaptive threshold segmentation algorithm to perform image partitioning, identify and extract edge areas and core functional areas, and generate a regional feature map; Applying an improved Gaussian-Laplace difference algorithm to the regional feature map to extract multi-scale feature points, and combining the spectral response curve characteristics to construct a defect sensitive feature set; The surface integrity index and optical performance deviation value of the optical component are calculated based on the defect sensitive feature set to determine the defect type and severity.
2. The method for detecting the quality of endoscope optical components based on data analysis according to claim 1, characterized in that: The alternating wavelength light source scanning of the endoscope optical component and the synchronous collection of reflected light and scattered light dual-channel image data to form an original data set include: Fix the endoscope optical assembly on a three-axis rotation mechanism, set the rotation angle interval to 15 degrees, and perform a full-range scan at each angle position to obtain spatial position data; Illuminating the endoscope optical components with narrowband light sources having wavelengths ranging from 350 nm to 800 nm with an interval of 5 nm, recording the optical response at each wavelength to obtain multi-band illumination data; The reflected light collection device is used to capture the intensity distribution of the forward reflected light on the surface of the endoscope optical component, and the scattered light collection device is used to record the scattered light intensity at a 45-degree scattering angle to form a dual-channel original image; Performing spatial registration on the dual-channel original images, using a feature point matching algorithm to determine the spatial correspondence between the images, and generating a registered image pair; Combining the registered image pair with the multi-band illumination data to construct a spectral-spatial joint feature matrix reflecting the optical properties of the component surface; Based on the spectral-spatial joint feature matrix, the ratio of the reflectivity to the scattering coefficient of each sampling point is calculated to form an original data set.
3. The method for detecting the quality of endoscope optical components based on data analysis according to claim 1, characterized in that: The method of performing image partitioning processing on the original data set through an adaptive threshold segmentation algorithm, identifying and extracting edge areas and core functional areas, and generating a regional feature map includes: Applying an adaptive histogram equalization algorithm to the original data set, dividing the image into 32×32 sub-blocks, and performing histogram equalization processing on each sub-block separately to obtain a preprocessed image with enhanced contrast; Calculating the Otsu multi-level threshold based on the pre-processed image, dividing the image grayscale value into four levels, corresponding to the non-functional area, edge transition area, core functional area and potential defect area, and generating a preliminary partitioning result; Applying morphological opening and closing operations to the preliminary partitioning results, using a circular structure element with a radius of 3 pixels, eliminating noise and smoothing the region boundaries to form a smooth partition map; Performing regional connectivity analysis on the smoothed partition map, marking connected regions with an area greater than 50 pixels as valid regions, and calculating the geometric center and boundary contour of each valid region to obtain a regional topological structure; The regional topological structure is registered with a preset standard template of the endoscope optical component, the regional boundaries are aligned through affine transformation, the precise positions of the edge area and the core functional area are identified, and a standardized partition map is obtained; A weight coefficient is assigned to each region according to the standardized zoning map, the weight of the core functional area is set to 1.0, and the weight of the edge area decreases linearly according to the distance from the center, thereby generating a weighted regional feature map.
4. The method for detecting the quality of endoscope optical components based on data analysis according to claim 1, wherein: The method of applying an improved Gaussian-Laplace difference algorithm to the regional feature map to extract multi-scale feature points and combining the spectral response curve features to construct a defect sensitive feature set includes: Applying Gaussian filters with different scale parameters to smooth the regional feature maps, with the scale parameters set to 1.0, 1.6, 2.0, 2.5 and 3.2 in sequence, to generate a 5-layer Gaussian pyramid image sequence; Performing pixel-level subtraction operations on two adjacent layers of images in the Gaussian pyramid image sequence, respectively calculating a first difference image as 1.6 layers minus 1.0 layers, a second difference image as 2.0 layers minus 1.6 layers, a third difference image as 2.5 layers minus 2.0 layers, and a fourth difference image as 3.2 layers minus 2.5 layers, to obtain a multi-scale difference image set; In each layer of the multi-scale difference image set, a 3×3×3 local extreme value detection is performed on each non-boundary pixel point, and points that meet both spatial extreme values and scale extreme values are marked as candidate feature points to form an initial feature point set; For each point in the initial feature point set, its sub-pixel coordinates are accurately located by a second-order Taylor expansion, and the principal curvature is calculated based on the eigenvalue ratio of the Hessian matrix, and unstable points with a curvature ratio greater than 10 are eliminated to obtain a stable feature point set; Extracting a spectral response curve at each stable characteristic point position from the original data set, calculating the first-order derivative and the second-order derivative of the curve, detecting the inflection point and the rate of change of the curve, and generating a spectral characteristic vector; For each point in the stable feature point set, its spatial features are combined with the corresponding spectral feature vector, and a 128-dimensional defect-sensitive feature descriptor is constructed through a feature fusion algorithm, and all feature descriptors are organized into a defect-sensitive feature set.
5. The method for detecting the quality of endoscope optical components based on data analysis according to claim 4, characterized in that: In each layer of the multi-scale difference image set, a 3×3×3 local extreme value detection is performed on each non-boundary pixel point, and points that meet both spatial extreme values and scale extreme values are marked as candidate feature points to form an initial feature point set, including: Performing boundary extension processing on each layer of the multi-scale difference image set, filling a 1-pixel wide boundary value around the image to ensure that edge pixels can also participate in the subsequent extreme value detection process, and obtaining a boundary-extended image; Extracting three adjacent layers from the boundary extended image to form a scale space block, each center point and its eight adjacent points in the same layer and 18 points corresponding to the upper and lower layers form a 3×3×3 detection window to form a local detection area; For each center point of the local detection area, calculate the grayscale value difference between it and the other 26 points in the window. When the grayscale value of the center point is greater than or less than all 26 points, mark it as a local extreme point, and obtain the position extreme value set; Substituting each point in the position extreme value set into a Taylor series expansion, calculating the precise offset of the extreme value point by derivation, and when the offset exceeds 0.5 pixel units in any direction, resampling and iteratively calculating along the offset direction until the offset converges to obtain a precise position point set; Calculating the principal curvature ratio for each point in the precise position point set, and screening out points with a curvature ratio less than 10 by solving the ratio of the eigenvalues of the Hessian matrix to form stable feature candidate points; The feature points are weightedly screened based on the weight values of the areas where the stable feature candidate points are located. The retention rate of the feature points in the core functional area is set to 100%, and the retention rate of the feature points in the edge area is linearly adjusted according to the weights to generate an initial feature point set.
6. The method for detecting the quality of endoscope optical components based on data analysis according to claim 4, characterized in that: For each point in the initial feature point set, its sub-pixel coordinates are accurately located by a second-order Taylor expansion, and the principal curvature is calculated based on the eigenvalue ratio of the Hessian matrix, and unstable points with a curvature ratio greater than 10 are eliminated to obtain a stable feature point set, including: Extracting the coordinate position and scale information of each point from the initial feature point set, and constructing an initial parameter table of feature points as input data for precise positioning; For each point in the feature point initial parameter table, a 5×5 neighborhood window is constructed on the differential image layer where the point is located, and the gradient and Hessian matrix elements within the neighborhood window are calculated to obtain a local structure description of the point; Applying a second-order Taylor expansion to each feature point based on the local structure description, and calculating the sub-pixel offset of the feature point in the three dimensions of x, y, and scale by solving a system of linear equations to obtain the precise position coordinates; The stability of the precise position coordinates is verified. When the offset in any dimension is greater than 1.5 or the convergence has not occurred after more than 5 iterations, the corresponding point is marked as an unstable point and removed from the feature set to form a stable position point set. Extracting the local Hessian matrix of each point from the position-stable point set, calculating the eigenvalue of the local Hessian matrix of each point and obtaining the principal curvature ratio, and marking the corresponding point as an edge response point and removing it when the ratio is greater than 10, thereby generating a structurally stable point set; A unique identifier is assigned to each point in the structural stable point set, and its precise coordinates, scale parameters, main directions and stability measurement values are recorded to construct a stable feature point set.
7. The method for detecting the quality of endoscope optical components based on data analysis according to claim 1, characterized in that: Calculating the surface integrity index and optical performance deviation value of the optical component based on the defect sensitive feature set and determining the defect type and severity includes: Input the defect-sensitive feature set into a pre-trained classification model, which is composed of a random forest, a support vector machine, and a gradient boosting decision tree. The defect type to which the feature points belong is identified through an ensemble learning method, and a defect type mapping table is generated. Based on the defect type mapping table, cluster analysis is performed on adjacent defect feature points, and a density clustering algorithm is used to classify points with close spatial positions and similar features as the same defect entity to obtain a defect area set; Calculating geometric characteristic parameters for each region in the defect region set, including area, perimeter, compactness, and shape factor, and constructing a defect characteristic description matrix based on defect type and location information; Performing spatial correlation analysis on the defect characteristic description matrix and the key functional area map of the endoscope optical component, calculating the position sensitivity coefficient according to the distribution position of the defects in the functional area, and obtaining a weighted defect map; Calculating a surface integrity index based on the weighted defect map. The integrity index comprehensively considers the number, area, distribution density, and location sensitivity of defects, and obtains a standardized value from 0 to 100 through weighted summation. A higher value indicates better integrity. The optical performance deviation value is calculated based on the surface integrity index and spectral data, and a correlation is established between the deviation value and the defect parameter. The severity level of the defect is determined through a decision tree model, and a comprehensive evaluation report including the defect type, location, size and severity is generated.
8. A system for quality inspection of endoscope optical components based on data analysis, characterized in that: For implementing the method for detecting the quality of an endoscope optical component based on data analysis according to any one of claims 1 to 7, the endoscope optical component quality detection system based on data analysis comprises: The scanning module is used to scan the optical components of the endoscope with an alternating wavelength light source, synchronously collect dual-channel image data of reflected light and scattered light, and form an original data set; A partitioning module is used to perform image partitioning processing on the original data set through an adaptive threshold segmentation algorithm, identify and extract edge areas and core functional areas, and generate a regional feature map; An extraction module, configured to apply an improved Gaussian-Laplace difference algorithm to the regional feature map to extract multi-scale feature points, and construct a defect sensitive feature set by combining the spectral response curve features; A calculation module is used to calculate the surface integrity index and optical performance deviation value of the optical component based on the defect sensitive feature set, and determine the defect type and severity.
9. An endoscope optical component quality inspection device based on data analysis, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the method for detecting the quality of an endoscopic optical component based on data analysis according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the processor is caused to perform the method for detecting the quality of an endoscopic optical component based on data analysis according to any one of claims 1 to 7.
Citation Information
Cited By
Method and system for detecting surface defects of refrigeration valve seat core
CN121213546A