Dynamic self-adaptive method based on endoscope lens replacement

By using a dynamic adaptive method, the imaging model after the endoscope lens is replaced is monitored and adjusted in real time, which solves the problem of imaging distortion caused by individual lens differences, achieves efficient and stable image output, and improves the automation and robustness of the system.

CN122053947APending Publication Date: 2026-05-15SHENZHEN COANTEC AUTOMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610120612.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-28
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing industrial endoscope systems suffer from image model disconnection from the actual lens after lens replacement, resulting in image distortion and low efficiency. Furthermore, the parameter switching method, which relies on manual intervention, cannot cope with individual lens differences, affecting image quality and system robustness.

Method used

A dynamic adaptive method based on endoscope lens replacement is adopted. A closed-loop control architecture is formed by lens assembly, image acquisition unit, lens replacement detection module, parameter acquisition module, imaging model dynamic construction module, image processing module and feedback adjustment module. The lens replacement event is monitored in real time, the imaging model is dynamically acquired and constructed, and the image processing parameters are adaptively adjusted to ensure image quality.

Benefits of technology

It achieves fully automatic, high-precision, and continuous adaptive adjustment of the imaging system after lens replacement, outputting stable, consistent, and high-fidelity detection images, thereby improving the system's automation level and engineering practicality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122053947A_ABST
    Figure CN122053947A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of endoscopes, and particularly relates to a dynamic self-adaption method based on endoscope lens replacement, which comprises a lens assembly, an image acquisition unit, a lens replacement detection module, a lens parameter acquisition module, an imaging model dynamic construction module, an image processing module, a feedback adjustment module and a display and output module. All the modules are connected with one another through standardized data interfaces to form a closed-loop control framework. The method is suitable for an industrial endoscope system provided with a replaceable lens module, is especially suitable for production line rapid switching, unattended operation or remote operation scenes, and is characterized in that individual differences of lenses are included in a system self-adaptive control closed loop, and dynamic accurate matching of imaging links is achieved through double mechanisms of physical parameter driving and image quality feedback.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of endoscopy technology, specifically a dynamic adaptive method based on endoscopy lens replacement. Background Technology

[0002] Industrial endoscopes, as key imaging devices in modern non-destructive testing systems, are widely used in high-reliability fields such as aerospace, energy and power, and precision manufacturing. Their core function is to acquire high-fidelity images of internal structures in real time by penetrating narrow or enclosed spaces through miniature optical lenses. With the continuous improvement of industrial automation and intelligence, more stringent requirements are being placed on endoscope systems in terms of multi-condition adaptability, imaging consistency, and operational efficiency. Especially in scenarios where production lines rapidly switch between inspection tasks, it is often necessary to frequently change lens modules with different focal lengths or field of view to match diverse observation needs ranging from macroscopic overviews to microscopic details. Against this backdrop, ensuring the rapid response and stable output of the imaging system after lens replacement has become a key factor restricting the performance improvement of industrial endoscopes. To address the aforementioned needs, existing technologies generally employ a strategy of pre-set parameter libraries combined with manual intervention. Specifically, during the factory or initial deployment phase, the system pre-completes a complete camera calibration process for each selectable lens model, obtaining its corresponding intrinsic parameter matrix, distortion coefficients, and associated image processing parameters (such as brightness equalization curves, contrast mapping functions, sharpening intensity, etc.), and stores these parameters in a local database with the lens identifier as an index. When a user changes lenses, they need to manually select the model of the currently used lens through the human-computer interaction interface. The system then loads the corresponding parameter set to complete the configuration of the imaging link. In early application scenarios, this solution did alleviate the imaging distortion problem caused by lens differences to a certain extent. Its design logic is clear and its implementation path is well-defined, which effectively supported the initial practical application of multi-lens endoscope systems.

[0003] With the continuous acceleration of industrial testing and the exponential increase in the requirements for image quality stability, the aforementioned static parameter switching mechanism that relies on manual intervention has revealed an irreconcilable structural contradiction at the principle level. This solution treats lens characteristics as a completely static and a priori ideal object, ignoring dynamic factors such as individual lens differences, assembly tolerances, temperature drift, and even slight changes in optical performance caused by long-term use during actual use. Even if the user accurately selects the lens model, the system still loads the typical or average parameters of that model, rather than the actual imaging characteristics of the current physical lens. This one-size-fits-all parameter matching method is inherently unable to cope with the manufacturing discreteness between individual lenses, resulting in an inherent deviation between the imaging model and the actual optical path; Subsequent image processing modules perform distortion correction and enhancement operations based on this inaccurate model, which easily introduces secondary artifacts, edge blurring, or geometric distortion, severely weakening the usability of the image and the reliability of the detection results. In high-speed production line environments, operators are required to perform manual selection or even recalibration after each lens change, which not only significantly prolongs downtime but also further reduces the robustness of the system due to the risk of human error. Even if some systems attempt to introduce a unified post-processing enhancement algorithm to avoid the parameter missing problem, such methods lack specific adaptation to the optical characteristics of specific lenses and often amplify noise or introduce non-physical distortions while improving local contrast, thus exacerbating the instability of the imaging results.

[0004] Therefore, a dynamic adaptive method based on endoscope lens replacement is proposed to address the above problems. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by providing a dynamic adaptive method based on endoscope lens replacement, thereby solving the technical problems mentioned in the background art.

[0006] To address the above technical issues, the following technical solution is adopted: A dynamic adaptive method based on endoscope lens replacement, comprising a lens assembly, an image acquisition unit, a lens replacement detection module, a lens parameter acquisition module, an imaging model dynamic construction module, an image processing module, a feedback adjustment module, and a display and output module; each module is interconnected through a standardized data interface to form a closed-loop control architecture; The system comprises several components: a lens assembly integrating a non-volatile storage medium to store the lens's unique identification information and corresponding optical characteristic parameters; an image acquisition unit including an image sensor and signal conditioning circuitry to capture raw optical images and convert them into digital image signals; a lens replacement detection module to monitor the lens interface's electrical status, physical connection signals, or image feature changes in real time to determine if a lens replacement event has occurred; a lens parameter acquisition module to read the identification information from the non-volatile storage medium of the currently installed lens and obtain key optical parameters such as focal length, field of view, and distortion coefficient based on a parameter database pre-stored in the system's main control unit; a dynamic imaging model construction module based on the pinhole imaging principle, combining the acquired lens parameters to calculate the camera's intrinsic parameter matrix in real time and construct a geometric distortion correction model suitable for the current lens; an image processing module dynamically configuring distortion correction algorithms, brightness equalization curves, contrast mapping functions, and sharpening intensity parameters according to the constructed imaging model to process the raw image in real time; a feedback adjustment module to quantitatively evaluate the quality indicators of the processed image and trigger a parameter iteration correction mechanism when the indicators deviate from a preset threshold range; and a display and output module to output the final processing results to a human-machine interface or an external control system.

[0007] The specific implementation steps of this invention are as follows: The first step is lens replacement detection. The lens replacement detection module continuously monitors the on / off status of electrical contacts at the lens interface, the integrity of communication handshake signals, and the initial image features output by the image acquisition unit. When a change in the physical connection status of the lens interface is detected, or a significant shift in the image feature statistics is detected, it is determined that a lens replacement event has occurred. The system immediately pauses the current image processing flow and starts the lens recognition and parameter loading program.

[0008] The second step is to obtain lens characteristic parameters. The lens parameter acquisition module accesses the non-volatile storage medium of the lens assembly through the serial communication interface built into it and reads the lens unique identification code stored therein. This identifier code serves as an index for querying the preset lens parameter database in the system's main control unit, thereby obtaining the focal length, field of view, radial distortion coefficient, tangential distortion coefficient, principal point offset, and recommended image processing parameter set that strictly correspond to the current lens. All parameters are stored in a structured data format and are verified through a validation mechanism to ensure read integrity and consistency.

[0009] The third step is to dynamically construct the imaging model. The imaging model dynamic construction module receives optical parameters from the lens parameter acquisition module, calculates the pixel scale factor based on the standard pinhole camera model using the focal length and the physical size of the image sensor, and generates a complete camera intrinsic parameter matrix by combining the principal point offset. Meanwhile, a high-order polynomial distortion correction model is constructed based on the obtained distortion coefficients. This model can accurately compensate for barrel distortion, pincushion distortion and tangential distortion in the image. The constructed imaging model is then loaded into the geometric correction unit of the image processing module as a reference for subsequent image processing; The fourth step is to adaptively adjust the image processing parameters. The image processing module dynamically configures the operating parameters of each processing sub-module within it according to the characteristics of the current imaging model. Specifically, the distortion correction submodule calls the constructed distortion correction model to perform pixel remapping on the original image; the brightness equalization submodule loads the corresponding non-uniform illumination compensation curve based on the lens's light throughput characteristics and field of view distribution; the contrast enhancement submodule adjusts the local contrast gain according to the relationship between focal length and depth of field; and the sharpening submodule sets the edge enhancement intensity based on the lens's modulation transfer function characteristics. All processing parameters are strictly bound to the physical characteristics of the current lens to ensure that the image enhancement process is optically reasonable and physically consistent.

[0010] The fifth step is feedback adjustment and dynamic correction. The feedback adjustment module performs real-time quality assessment on the image output by the image processing module, calculating sharpness, brightness uniformity, and geometric consistency indices. Sharpness index is quantified by gradient amplitude statistics or frequency domain energy distribution; brightness uniformity index is evaluated by the brightness variance of image partitions; geometric consistency index is determined by the corner position deviation of the detection standard test pattern. When any indicator exceeds the preset threshold range, the feedback adjustment module generates a correction command, triggering the parameter fine-tuning mechanism of the imaging model dynamic construction module and the image processing module. This mechanism employs an incremental optimization strategy, which iteratively updates the distortion coefficient, sharpening intensity, or brightness compensation curve in small steps without interrupting image output, until the image quality index returns to the acceptable range.

[0011] In a typical application scenario where the lens switches from a short focal length to a long focal length, the system recalculates the field of view based on the read focal length parameters and updates the projection parameters in the imaging model simultaneously. The image processing module dynamically adjusts the image cropping ratio accordingly to maintain the spatial resolution consistency of the output image and avoid redundant invalid areas caused by the reduction of the field of view. Meanwhile, taking into account the shallow depth of field of telephoto lenses, the system automatically increases the edge enhancement intensity of the sharpening submodule, and combines the continuous monitoring of sharpness indicators by the feedback adjustment module to achieve intelligent compensation for out-of-focus blurry areas.

[0012] The complete technology chain from lens physical state perception, dynamic generation of imaging model, adaptive configuration of image processing parameters to closed-loop feedback of image quality. This link completely eliminates the reliance on manual calibration and manual parameter selection, and realizes fully automatic, high-precision, and continuous adaptive adjustment of the imaging system after lens replacement; After each lens change, the system can build a unique imaging model based on the actual physical characteristics of the current lens, and continuously optimize the processing parameters through an image quality feedback mechanism during operation, thereby ensuring that stable, consistent, and high-fidelity detection images can be output under various working conditions.

[0013] The non-volatile storage medium in the lens assembly is an EEPROM or Flash memory, which communicates with the main control unit via an I2C or SPI bus. The stored content includes the lens model, serial number, factory calibration parameters, and a usage count counter. The lens replacement detection module monitors lens insertion and removal events via GPIO interrupts or UART state machines, and performs dual verification using an image feature mutation detection algorithm to eliminate false triggers. The imaging model dynamic construction module uses a combination of table lookup and interpolation to accelerate the generation of intrinsic parameter matrices, ensuring that model switching is completed within milliseconds. The image processing module is deployed in a dedicated image signal processor, supporting multi-channel parallel pipelined processing to ensure real-time requirements. The evaluation algorithm of the feedback adjustment module has been hardware-accelerated and optimized, enabling the calculation of all quality indicators to be completed within a single frame image processing cycle.

[0014] This invention is applicable to industrial endoscope systems equipped with interchangeable lens modules, and is particularly suitable for scenarios involving rapid production line changeover, unattended operation, or remote operation. Its core innovation lies in incorporating individual lens differences into the system's adaptive control closed loop, achieving dynamic and precise matching of the imaging link through a dual mechanism of physical parameter driving and image quality feedback. This solution not only resolves the fundamental contradiction of the disconnect between the imaging model and the actual lens in traditional technology, but also significantly improves the system's automation level and engineering practicality. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] In the attached diagram: Figure 1 This is a schematic diagram of the overall system architecture of a dynamic adaptive method based on endoscope lens replacement according to the present invention.

[0017] Figure 2 This is a logical diagram illustrating the lens replacement detection and parameter acquisition process in this invention.

[0018] Figure 3 This is a schematic diagram illustrating the principle of dynamic construction of the imaging model and adaptive adjustment of image processing parameters in this invention.

[0019] Figure 4 This is a flowchart illustrating the closed-loop control process of the feedback adjustment module in this invention for image quality assessment and parameter iterative correction. Detailed Implementation

[0020] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0021] Specific implementation examples are given below.

[0022] Please see Figures 1-4 This invention provides a dynamic adaptive method based on endoscope lens replacement. The system comprises a lens assembly, an image acquisition unit, a lens replacement detection module, a lens parameter acquisition module, an imaging model dynamic construction module, an image processing module, a feedback adjustment module, and a display and output module. All modules are interconnected through standardized data interfaces to form a closed-loop control architecture. The lens assembly is a detachable optical module with integrated non-volatile storage media, which uses EEPROM or Flash memory and communicates with the main control unit via I2C or SPI bus. The stored content includes the lens model, serial number, factory calibration parameters, and a usage counter. The factory calibration parameters cover focal length, field of view, radial distortion coefficient, tangential distortion coefficient, principal point offset, and a recommended set of image processing parameters. The image acquisition unit includes a CMOS or CCD image sensor and signal conditioning circuitry, used to capture raw optical images and convert them into digital image signals. The output format is RAW or YUV, with a frame rate of no less than 30fps and a resolution of no less than 1920×1080.

[0023] The lens replacement detection module is deployed in the main control unit and continuously monitors the on / off status of electrical contacts at the lens interface and the integrity of communication handshake signals through GPIO interrupts or UART state machines. Meanwhile, the module also analyzes the initial image features output by the image acquisition unit in real time, including image gradient distribution, frequency domain energy spectrum and local contrast statistics. When a change in the physical connection status of the lens interface is detected, and the image feature statistics deviate from the historical average by more than a preset threshold within three consecutive frames (for example, the rate of change of the standard deviation of the gradient magnitude is greater than 15%), it is determined that a lens replacement event has occurred. At this point, the system immediately pauses the current image processing flow and triggers the lens recognition and parameter loading program.

[0024] The lens replacement detection employs a dual verification mechanism: physical insertion and removal actions are determined by hardware signals, and software confirmation is performed by an image feature mutation algorithm. This mechanism effectively eliminates false triggers caused by vibration, electromagnetic interference, or brief communication interruptions, ensuring that the system only initiates the adaptive process when a real lens is replaced.

[0025] After receiving the lens replacement event signal, the lens parameter acquisition module accesses the non-volatile storage medium of the lens assembly through the built-in serial communication interface and reads the lens's unique identification code stored therein. This identifier is a 16-digit hexadecimal string and is globally unique. The system's main control unit has a pre-installed structured lens parameter database, which is organized in key-value pairs. The key is a unique identifier for the lens, and the value is a JSON object containing the aforementioned optical parameters and recommended image processing parameters. The lens parameter acquisition module uses this identifier as an index to query the database and obtain all parameters that strictly correspond to the current lens. All parameters are verified using CRC32 during transmission to ensure data integrity and consistency. If the verification fails or there is no corresponding entry in the database, the system enters safe mode, enables the default general parameter set, and records the fault log for subsequent maintenance.

[0026] The imaging model dynamic construction module receives optical parameters from the lens parameter acquisition module and constructs a geometric imaging model suitable for the current lens based on the standard pinhole camera model. Specifically, this module first calculates the pixel scale factors sx and sy based on the focal length f and the physical dimensions of the image sensor (the width Ws and height Hs of the photosensitive area): ; Wpixel and Hpixel represent the horizontal and vertical pixel counts of the image sensor, respectively. Subsequently, by combining the principal point offsets (cx, cy), the complete camera intrinsic parameter matrix K is generated: ; Meanwhile, based on the obtained radial distortion coefficients k1, k2, k3 and tangential distortion coefficients p1, p2, a high-order polynomial distortion correction model is constructed. This model describes the mapping relationship between the ideal distortion-free point (x, y) and the actual observed point (xd, yd): ; in = + ; This model can accurately compensate for barrel distortion, pincushion distortion and tangential distortion in images; The constructed intrinsic parameter matrix K and distortion correction model are then loaded into the geometric correction unit of the image processing module as a reference for subsequent image processing.

[0027] Furthermore, the imaging model dynamic construction module uses a combination of table lookup and interpolation to accelerate model generation; For commonly used lens types, the system pre-stores intrinsic parameter matrix templates; for new lenses, the results are calculated and cached upon initial loading. This strategy ensures model switching is completed within milliseconds, meeting industrial real-time requirements.

[0028] The image processing module is deployed in a dedicated image signal processor (ISP) and supports multi-channel parallel pipeline processing. Based on the characteristics of the current imaging model, the module dynamically configures the operating parameters of each processing sub-module. The distortion correction sub-module calls the constructed distortion correction model to perform pixel remapping on the original image. This process uses a bilinear interpolation algorithm to control computational complexity while ensuring accuracy. The brightness equalization submodule loads the corresponding non-uniform illumination compensation curve based on the lens's light throughput characteristics and field of view distribution; This curve is a one-dimensional lookup table (LUT), whose input is the radial distance of the pixel position and output is a gain factor used to compensate for uneven brightness caused by the attenuation of illumination at the lens edges. The contrast enhancement submodule adjusts the local contrast gain according to the relationship between focal length and depth of field; Specifically, the system establishes the focal length With local contrast gain coefficient mapping function This function is obtained through offline calibration, ensuring consistency in visual perception at different focal lengths; The sharpening submodule sets the edge enhancement intensity based on the modulation transfer function (MTF) characteristics of the lens. The MTF data is also stored in the lens parameter library. The system selects the corresponding sharpening kernel weight accordingly to avoid over-enhancement that introduces noise or under-enhancement that leads to loss of detail.

[0029] In one specific embodiment, when the lens switches from a short focal length (e.g., f=2.8mm) to a long focal length (e.g., f=8.0mm), the system performs the following operations: First, the field of view θ is recalculated based on the new focal length, using the formula θ = 2arctan(Ws / (2f)). Then, the imaging model dynamic construction module updates the focal length term in the intrinsic parameter matrix and adjusts the distortion model parameters. The image processing module dynamically adjusts the image cropping ratio accordingly, aligns the center of the cropping area with the principal point, and determines the size according to the scaling ratio of the field of view, so as to maintain the spatial resolution consistency of the output image and avoid redundant invalid areas caused by the reduction of the field of view. Meanwhile, taking into account the shallow depth of field of telephoto lenses, the system automatically increases the edge enhancement intensity of the sharpening submodule and loads a corresponding MTF-optimized sharpening kernel. The brightness equalization submodule switches to a compensation curve suitable for small field of view, which has lower gain in the center area and smoother edge attenuation.

[0030] The feedback adjustment module performs real-time quality assessment on the image output by the image processing module. This module is deployed in the coprocessor on the same chip as the ISP, and its assessment algorithm has been hardware-accelerated and optimized. It can complete all index calculations within a single frame image processing cycle. The sharpness index is quantified by calculating the root mean square (RMS) value of the image gradient magnitude using the Sobel operator. ; Where N is the total number of pixels in the image, and ∇I is the gradient magnitude. The brightness uniformity index is calculated by dividing the image into a nine-grid area and calculating the standard deviation of the average brightness of each area. ; in For the first Average brightness of the area This represents the global average brightness. The geometric consistency index is achieved by introducing a standard test pattern (such as a checkerboard or dot array) into the detection scene, extracting corner positions using a feature point detection algorithm, and calculating the mean Euclidean distance between the corner points and their ideal projected positions. ; Where M is the number of effective corner points; When any indicator exceeds the preset threshold range (for example, or The feedback adjustment module generates correction instructions, triggering the parameter iterative correction mechanism.

[0031] This mechanism employs an incremental optimization strategy. Taking distortion coefficient correction as an example, the system in the current... Apply small perturbations to the basis Reconstruct the distortion model and process the test images to calculate new distortion models. ; If the new metric is better, the perturbation is accepted and iteration continues; otherwise, adjustments are made in the opposite direction. Similarly, the sharpening intensity and brightness compensation curves are also optimized univariately using gradient descent or the golden section method. All correction processes are performed in the background without interrupting the main image output stream, ensuring continuous system operation. The correction step size is constrained by the convergence speed and stability, and is usually set to one-thousandth to one ten-thousandth of the parameter range.

[0032] The display and output module receives the final processed image and outputs it to the human-machine interface or external control system via HDMI or USB 3.0 interface. This module supports multiple encoding formats (such as H.264 and JPEG) and multiple resolution scaling to meet the display needs of different terminal devices.

[0033] In one specific embodiment, the system described in this invention is used, with lens A (f=3.5mm, field of view 78°) and lens B (f=6.0mm, field of view 45°). The system is initially installed with lens A to acquire images from a standard test card. Subsequently, the image was manually switched to lens B. The system automatically detected the switch, read the parameters of lens B, constructed a new imaging model, and adjusted the image processing parameters. The entire adaptive process took 87 milliseconds. The processed image had a sharpness index of 0.28, a brightness uniformity index of 0.05, and a geometric consistency index of 0.8 pixels.

[0034] In the comparative example, a traditional industrial endoscope system was used, where lens replacement relied on manual calibration. After replacing lens B, the operator did not recalibrate, and the system still used the parameters of lens A for processing. The resulting image exhibited obvious pincushion distortion, blurred edges, overexposure in the center and darkness around the edges, a sharpness index of only 0.12, a brightness uniformity index as high as 0.19, and a geometric consistency index of 3.5 pixels.

[0035] The table below summarizes the key performance indicators of the embodiments and comparative examples: Indicator Categories Example Comparative example (traditional system) Adaptive response time 87ms Human intervention, >300s Sharpness index 0.28 0.12 Brightness uniformity index 0.05 0.19 Geometric consistency index (pixels) 0.8 3.5 Imaging stability (after 10 consecutive replacements) Standard deviation < 0.02 Standard deviation > 0.15 Data shows that the present invention can achieve high-quality imaging without manual intervention after lens replacement, with all indicators significantly better than traditional solutions, and has excellent repeatability and stability.

[0036] As a preferred embodiment of the present invention, the system supports rapid scene switching between multiple cameras; In production line inspection, a wide-angle lens, a macro lens, and a telephoto lens are sequentially installed on the same endoscope main unit for large-area scanning, small defect identification, and long-distance observation, respectively. After each replacement, the system can complete adaptive adjustments within hundreds of milliseconds, ensuring that the output images maintain a consistent visual style and geometric accuracy, greatly improving inspection efficiency and reliability.

[0037] Furthermore, the system's main control unit periodically reads the usage counter in the lens assembly and, in conjunction with the cumulative working time, predicts the lens performance degradation trend; When optical parameter drift is detected to exceed the tolerance (e.g., the distortion coefficient change rate is greater than 5%), the system can issue an early warning to prompt the user to perform maintenance or replacement, thus realizing predictive maintenance function.

[0038] In summary, this invention incorporates individual lens differences into the system's adaptive control closed loop, utilizing a dual mechanism of physical parameter driving and image quality feedback to achieve dynamic and precise matching of the imaging link. After each lens change, the system constructs a dedicated imaging model based on the actual physical characteristics of the current lens, and continuously optimizes processing parameters during operation through the image quality feedback mechanism, thereby ensuring the output of stable, consistent, and high-fidelity detection images under various operating conditions. This solution completely eliminates reliance on manual calibration and parameter selection, significantly improving the automation level, engineering practicality, and long-term operational reliability of industrial endoscope systems.

[0039] In the description of this invention, it should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions provided in this disclosure can be achieved, and no limitation is imposed herein.

[0040] The above description is merely a preferred embodiment of the present invention and does not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A dynamic adaptive method based on endoscope lens changing, characterized in that, Includes the following steps: The system monitors the electrical connection status of the lens interface and the initial image features output by the image acquisition unit. When a change in the physical connection status of the lens is detected and the image feature statistics deviate from the historical average by more than a preset threshold in multiple consecutive frames, it is determined that a lens replacement event has occurred. In response to the lens replacement event, the lens unique identifier is read from the non-volatile storage medium built into the currently installed lens, and the preset parameter database is queried based on the identifier to obtain the corresponding focal length, field of view, radial distortion coefficient, tangential distortion coefficient, principal point offset and recommended image processing parameter set; The camera intrinsic parameter matrix is ​​constructed based on the focal length, physical size of the image sensor, and principal point offset, and a high-order polynomial distortion correction model is constructed by combining the radial distortion coefficient and the tangential distortion coefficient. The operating parameters of the distortion correction, brightness equalization, contrast enhancement, and sharpening sub-modules in the image processing module are dynamically configured according to the constructed imaging model. The processed image is quantitatively evaluated in real time for sharpness, brightness uniformity and geometric consistency. If any index exceeds the preset threshold range, the parameter iterative correction mechanism is triggered to update the distortion coefficient, sharpening intensity or brightness compensation curve in small steps without interrupting the image output.

2. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The lens's unique identifier is a 16-digit hexadecimal string, stored in the EEPROM or Flash memory integrated into the lens assembly, and communicates with the main control unit via I2C or SPI bus.

3. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The image feature statistics include the standard deviation of image gradient magnitude, frequency domain energy spectrum distribution, or local contrast statistics.

4. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The camera intrinsic parameter matrix The construction formula is: ; in, Focal length and These are the horizontal and vertical pixel scale factors, respectively. and This is the offset of the main point.

5. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The high-order polynomial distortion correction model describes the ideal distortion-free point through the following mapping relationship. Compared with actual observation points Correspondence between them: ; in , , , The radial distortion coefficient is... , denoted as the tangential distortion coefficient.

6. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The one-dimensional lookup table loaded by the brightness equalization submodule outputs a gain factor based on the radial distance of the pixel position to compensate for the uneven brightness caused by the attenuation of illumination at the edge of the lens.

7. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The contrast enhancement submodule is based on the focal length. Call the pre-calibrated mapping function Determine the local contrast gain coefficient To maintain consistent visual perception at different focal lengths.

8. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The sharpening submodule selects the corresponding sharpening kernel weight based on the modulation transfer function characteristics of the lens, avoiding excessive enhancement that introduces noise or under-enhancement that leads to loss of detail.

9. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The geometric consistency index is quantified by detecting the corner position deviation of the standard test pattern, and the calculation formula is as follows: ; Where M is the number of effective corner points. and These are the observed and ideal projection positions, respectively.

10. The dynamic adaptive method based on endoscope lens replacement according to claim 1, characterized in that: The parameter iterative correction mechanism adopts an incremental optimization strategy, which applies a small perturbation to the distortion coefficient, sharpening intensity, or brightness compensation curve. It decides whether to accept the perturbation based on the direction of change of the image quality index, and uses one-thousandth to one-ten-thousandth of the parameter range as the correction step size.