Endoscope focusing method, device and equipment and computer readable storage medium

By controlling the movement of the endoscope's focusing motor and recording the number of steps and timestamps, acquiring image clarity, and fitting correlation curves, the problem of inaccurate focusing of endoscopes in complex environments was solved, achieving a higher precision focusing effect.

CN121603764APending Publication Date: 2026-03-03SHENZHEN CONCEMED MEDICAL TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511859939.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-10
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing endoscopic focusing methods struggle to guarantee focusing accuracy in complex working environments, especially when faced with shaking of living tissue inside the patient and changes in light intensity caused by automatic endoscope dimming.

Method used

By controlling the movement of the endoscope's focusing motor, the number of steps and timestamps are recorded, and target images are continuously acquired during the movement. Image sharpness is calculated, and a correlation curve between the number of steps and sharpness is fitted to determine the optimal focusing position.

Benefits of technology

This improves the accuracy of endoscopic focusing, avoids the impact of tissue peristalsis and changes in light on the focusing process, and enhances the stability and precision of focusing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121603764A_ABST
    Figure CN121603764A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of camera control, and discloses an endoscope focusing method, device and equipment and a computer readable storage medium. The method comprises the following steps: controlling a focusing motor in the endoscope to move, and recording each step number of the focusing motor and a completion timestamp corresponding to the step number; target images of the target object are continuously collected in the motion process of the focusing motor, and the definition and the collection timestamp corresponding to each target image are recorded; determining a target definition corresponding to each step number according to the completion timestamp and the collection timestamp, and determining a target step number according to the target definition; and controlling the moving target stepping number of the focusing motor so as to realize the focusing of the endoscope on the target object. According to the endoscope focusing device, definition evaluation is carried out by collecting images in the whole movement process of the focusing motor, focusing of the endoscope is achieved, dimming of the endoscope is avoided in the focusing process, the influence of illumination intensity changes of different sampling points caused by tissue peristalsis in the working environment is avoided, and the focusing accuracy of the endoscope is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of camera control technology, and in particular to an endoscope focusing method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] Medical endoscopes are important equipment for doctors to detect lesions inside patients' bodies. Endoscopes can acquire images of lesions in real time and display them to doctors. In order to obtain clear images, endoscopes need to be focused.

[0003] Current focusing methods primarily rely on optical defocusing models, which use sharpness values ​​from a few points to fit a defocusing model curve and calculate the optimal focus. However, in the endoscopic working environment, the living tissue inside the patient's body continuously vibrates or moves, and the endoscope's automatic dimming causes variations in light intensity at different sampling points, affecting image noise levels and interfering with sharpness assessment. Furthermore, the limited number of sampling points makes it difficult to guarantee the accuracy of existing focusing methods in the complex working scenarios of endoscopy. Summary of the Invention

[0004] In view of this, the purpose of this application is to overcome the shortcomings of the prior art and provide an endoscopic focusing method, the method comprising: Control the focusing motor in the endoscope to move, and record each step of the focusing motor and the completion timestamp corresponding to the step number; During the movement of the focusing motor, target images of the target object are continuously acquired, and the sharpness and acquisition timestamp of each target image are recorded. Based on the completion timestamp and the acquisition timestamp, determine the target sharpness corresponding to each step number, and determine the target step number based on the target sharpness; The focusing motor is controlled to move the target step number so that the endoscope can focus on the target object.

[0005] In one embodiment, the step of continuously acquiring target images of the target object during the movement of the focusing motor, and recording the sharpness and acquisition timestamp of each target image, includes: During the movement of the focusing motor, target images of the target object are continuously acquired, and the acquisition timestamp corresponding to each target image is recorded. For each target image, the target image is divided into a preset number of target sub-images according to a preset segmentation rule; The sharpness of each target sub-image is calculated based on a preset operator, and the sharpness of the target image is calculated based on the sharpness of each target sub-image.

[0006] In one embodiment, the step of determining the target sharpness corresponding to each step number based on the completion timestamp and the acquisition timestamp includes: For each target number of steps, the target collection timestamp is determined from the collection timestamps based on the completion timestamp of the target number of steps and the preset filtering rules. The clarity of the target image corresponding to the target acquisition timestamp is determined as the target clarity corresponding to the target step number.

[0007] In one embodiment, the step of determining the target collection timestamp from the collection timestamps based on the completion timestamp of the target number of steps and a preset filtering rule includes: The actual frame rate of the endoscope is obtained, and the time interval between every two frames of target images acquired by the endoscope is determined based on the actual frame rate. The target acquisition timestamp is determined from the acquisition timestamps based on the completion timestamp of the target number of steps and the time interval.

[0008] In one embodiment, the step of determining the target step number based on the target sharpness includes: Based on each step number and the target sharpness corresponding to each step number, a correlation curve between the step number and the sharpness is fitted and constructed; Based on the correlation change curve, the maximum resolution is determined, and the number of steps corresponding to the maximum resolution is determined as the target number of steps.

[0009] In one embodiment, prior to the step of fitting and constructing the correlation curve between the number of steps and sharpness, the following steps are included: The sharpness of each target is compared with a preset sharpness threshold; If the target sharpness is less than a preset sharpness threshold, then the target sharpness is discarded. If the target sharpness is not less than a preset sharpness threshold, then the target sharpness is retained; Based on the retained target sharpness and the corresponding number of steps, the step of fitting and constructing a correlation curve between the number of steps and the sharpness is performed.

[0010] In one embodiment, the step of controlling the focusing motor to move the target step number to achieve focusing of the endoscope on the target object includes: The focusing motor is controlled to move from a preset initial position to a preset final position by the target number of steps, so as to move the endoscope to the target focusing position, so as to achieve the endoscope focusing on the target object.

[0011] This application also provides an endoscope focusing device, the endoscope focusing device comprising: The first recording module is used to control the focusing motor in the endoscope to move and record each step of the focusing motor and the completion timestamp corresponding to the step number. The second recording module is used to continuously acquire target images of the target object during the movement of the focusing motor, and record the sharpness and acquisition timestamp of each target image. The determination module is used to determine the target sharpness corresponding to each step number based on the completion timestamp and the acquisition timestamp, and to determine the target step number based on the target sharpness; The focusing module is used to control the focusing motor to move the target step number so as to enable the endoscope to focus on the target object.

[0012] This application also provides an endoscope device, which includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the above-described endoscope focusing method.

[0013] This application also provides a computer-readable storage medium storing a computer program that, when run on a processor, executes the above-described endoscopic focusing method.

[0014] The embodiments of this application have the following beneficial effects: This application embodiment controls the focusing motor in the endoscope to move, and records each step number of the focusing motor and the corresponding completion timestamp; during the movement of the focusing motor, target images of the target object are continuously acquired, and the sharpness and acquisition timestamp of each target image are recorded; based on the completion timestamp and acquisition timestamp, the target sharpness corresponding to each step number is determined, and based on the target sharpness, the target step number is determined; the focusing motor is controlled to move the target step number to achieve endoscope focusing on the target object. By acquiring images during the entire movement of the focusing motor and evaluating the relationship between the step number and sharpness, endoscope focusing is achieved. During focusing, the endoscope does not automatically adjust the light, avoiding the influence of tissue peristalsis in the working environment of the endoscope causing changes in light intensity at different sampling points on the focusing process, thus improving the focusing accuracy of the endoscope. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and therefore should not be considered as a limitation on the scope of protection of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 A flowchart illustrating the first embodiment of the endoscope focusing method provided in this application; Figure 2 A flowchart illustrating a second embodiment of the endoscope focusing method provided in this application; Figure 3 A schematic flowchart of the third embodiment of the endoscopic focusing method provided in this application; Figure 4 A schematic flowchart of the fourth embodiment of the endoscopic focusing method provided in this application; Figure 5 This is a schematic diagram of the endoscope focusing device provided in this application. Detailed Implementation

[0017] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0018] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0019] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.

[0020] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0021] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.

[0022] It is understood that the method of this application is applied to an endoscope focusing system, which can be mounted in a medical endoscope device. For ease of description, the following embodiments use an endoscope focusing system as the execution subject.

[0023] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0024] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a first embodiment of the endoscopic focusing method provided in this application, the method comprising: Step S101: Control the focusing motor in the endoscope to move, and record each step number of the focusing motor and the completion timestamp corresponding to the step number.

[0025] In this embodiment, when the endoscope focusing system determines that focusing is required, it controls the focusing motor in the endoscope to move from a preset initial position to a preset termination position, and records the corresponding number of steps and the completion timestamp of the number of steps when the focusing motor completes one step.

[0026] It should be noted that focusing motors are typically used to drive the lens assembly or image sensor of an endoscope to move back and forth along the optical axis, thereby changing the object distance or image distance of the lens assembly or image sensor, and thus achieving focusing on targets at different distances. Because these motors are stepper motors or position actuators with digital control interfaces, their movement is not a continuous analog quantity, but rather driven by pulse signals from the controller. Each pulse received advances (or retreats) by a fixed unit displacement, which is called a "step". The focusing motor has a preset initial position and a preset ending position. The preset initial position is the position where the number of steps is 0, and the preset ending position is the position where the number of steps reaches its maximum.

[0027] In one embodiment, the endoscope focusing system controls the focusing motor to move from a preset initial position to a preset final position, moving a fixed unit displacement each time, i.e., one step at a time. The step count increases by 1 for each movement, and the completion timestamp corresponding to each step is recorded. Each step count and its corresponding completion timestamp are bound and stored in a preset structure descriptor, array, linked list, or circular buffer. For example, when the focusing motor reaches the preset final position, the corresponding step count is 100. When the focusing motor moves one step from the preset initial position, the step count is recorded as 1. Moving another step, the step count is recorded as 2, and so on, recording step counts from 1 to 100 and the corresponding completion timestamp for each step.

[0028] Step S102: During the movement of the focusing motor, target images of the target object are continuously acquired, and the sharpness and acquisition timestamp of each target image are recorded.

[0029] In this embodiment, when the endoscopic focusing system controls the movement of the focusing motor, it controls the endoscope to continuously capture the target image of the target object and records the sharpness and acquisition timestamp of the target image until the focusing motor moves to a preset termination position, thus obtaining the sharpness and acquisition timestamp of multiple target images. The sharpness and acquisition timestamp of each target image are bound and stored in a preset structure descriptor, array, linked list, or circular buffer.

[0030] Step S103: Determine the target sharpness corresponding to each step number based on the completion timestamp and the acquisition timestamp, and determine the target step number based on the target sharpness.

[0031] In this embodiment, after determining the number of steps of the focusing motor and the corresponding completion timestamp, as well as the sharpness and acquisition timestamp of each target image, the endoscopic focusing system pairs the completion timestamps and acquisition timestamps. The sharpness of the successfully paired acquisition timestamp is determined as the target sharpness corresponding to the number of steps at the completion timestamp. The endoscopic focusing system determines the target step number based on the target sharpness corresponding to each step number. The target sharpness is highest when the target step number is the smallest.

[0032] Step S104: Control the focusing motor to move the target step number so that the endoscope can focus on the target object.

[0033] In this embodiment, after determining the target step number, the endoscope focusing system controls the focusing motor to move the target step number so as to achieve endoscope focusing on the target object.

[0034] In one embodiment, the endoscope focusing system controls the focusing motor to move the target step number from a preset initial position to a preset final position, thereby changing the object distance of the endoscope's lens assembly or image sensor to the target object distance, so that the endoscope's lens assembly or image sensor is in the target focusing position, thereby enabling the endoscope to focus on the target object.

[0035] The endoscopic focusing system in this embodiment controls the movement of a focusing motor within the endoscope, recording each step number of the focusing motor and the corresponding completion timestamp. During the focusing motor's movement, it continuously acquires target images of the target object, recording the sharpness and acquisition timestamp for each image. Based on the completion and acquisition timestamps, it determines the target sharpness corresponding to each step number, and based on the target sharpness, determines the target step number. It controls the focusing motor to move the target step number to achieve endoscope focusing on the target object. By acquiring images throughout the focusing motor's movement and evaluating the relationship between the step number and sharpness, endoscope focusing is achieved. During focusing, the endoscope does not automatically adjust the light, avoiding the impact of tissue peristalsis causing changes in light intensity at different sampling points on the focusing process, thus improving the endoscope's focusing accuracy.

[0036] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the endoscopic focusing method provided in this application. The difference between the second embodiment and the first embodiment lies in the step of continuously acquiring target images of the target object during the movement of the focusing motor, and recording the sharpness and acquisition timestamp corresponding to each target image, including: Step S201: During the movement of the focusing motor, target images of the target object are continuously acquired, and the acquisition timestamp corresponding to each target image is recorded.

[0037] In this embodiment, the endoscope focusing system continuously acquires target images of the target object during the movement of the focusing motor, and records the acquisition timestamp corresponding to each target image.

[0038] Step S202: For each target image, the target image is divided into a preset number of target sub-images according to a preset segmentation rule.

[0039] In this embodiment, for each target image, the endoscope focusing system first preprocesses the target image, and then divides the preprocessed target image into a preset number of target sub-images according to a preset segmentation rule.

[0040] In one embodiment, the preprocessing involves converting the target image from a color image to a grayscale image, and then performing bilateral filtering on the grayscale image to remove noise while preserving image edge information as much as possible. Optionally, in addition to using bilateral filtering to remove noise and potentially preserve image edge information, other filters that can effectively remove noise while better preserving image edge information can also be used, such as guided filtering, nonlocal mean filtering, or adaptive Wiener filtering, etc., which are not limited here.

[0041] In one embodiment, the preset segmentation rule is determined based on actual application requirements and consideration of computational load. It may be to divide the target image into four regions, divide the image into more (e.g., a 3x3 grid) or fewer (e.g., two on the left and right) rectangular or non-rectangular regions; the division may also be uneven, for example, using a denser division in the central region of the image, etc., which is not limited here.

[0042] Step S203: Calculate the sharpness of each target sub-image based on a preset operator, and calculate the sharpness of the target image based on the sharpness of each target sub-image.

[0043] In this embodiment, for each target image, the endoscope focusing system calculates the sharpness of each target sub-image obtained by segmenting the target image based on a preset operator, and calculates the sharpness of the target image based on the sharpness of each target sub-image.

[0044] In one embodiment, the target image is segmented into four target sub-images. The endoscopic focusing system calculates the sharpness of each target sub-image based on Laplacian. The formula for calculating the sharpness of the target image is: S(pow / sum) = (S1...) 2 + S2 2 + S3 2 + S4 2S(pow / sum) / (S1 + S2 + S3 + S4), where S(pow / sum) is the sharpness of the target image, and S1, S2, S3, and S4 are the sharpness of each target sub-image. It should be noted that the formula for directly calculating the sharpness of the entire image is usually S(avg) = (S1 + S2 + S3 + S4) / 4; however, this application uses S(pow / sum) instead of S(avg) to account for situations where the target object is not in the center of the target image. This situation frequently occurs in endoscopic examinations; for example, a polyp on the intestinal wall may be located in the lower right corner of the image and cannot be adjusted to the center. The lower right corner corresponds to S4. When observing closely to the polyp, S4 increases, while S1, S2, and S3 decrease, and S(avg) may decrease, leading to the conclusion of decreased sharpness. This contradicts the actual trend of image change. S(pow / sum) accurately reflects this trend, helping to improve the accuracy of calculating the sharpness of the target image.

[0045] In one embodiment, depending on the actual situation, the endoscopic focusing system can use higher powers to calculate the sharpness of the target image, for example, S = (S1) 3 + S2 3 + S3 3 + S4 3 ) / (S1 2 + S2 2 + S3 2 + S4 2 This method emphasizes high-resolution areas and further improves the accuracy of calculating the sharpness of the target image.

[0046] The endoscopic focusing system of this embodiment divides each target image into a preset number of target sub-images according to a preset segmentation rule. It calculates the sharpness of each target sub-image based on a preset operator, and calculates the sharpness of the target image based on the sharpness of each target sub-image according to a specially designed image sharpness evaluation algorithm. This system can effectively handle situations where the target object is not in the center of the image, which is more in line with the actual application scenarios of endoscopes and improves the accuracy of sharpness evaluation of target images acquired by endoscopes.

[0047] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a third embodiment of the endoscopic focusing method provided in this application. The difference between the third embodiment and the first to second embodiments is that the step of determining the target sharpness corresponding to each step number based on the completion timestamp and the acquisition timestamp includes: Step S301: For each target number of steps, determine the target collection timestamp from the collection timestamps based on the completion timestamp of the target number of steps and the preset filtering rules.

[0048] In this embodiment, for each target number of steps, the endoscopic focusing system determines the target acquisition timestamp from the acquisition timestamps based on the completion timestamp of the target number of steps and a preset filtering rule. It is understood that in actual operation, there will be a certain time deviation between the completion timestamp and the acquisition timestamp; therefore, it is necessary to match a corresponding acquisition timestamp to each completion timestamp according to certain preset filtering rules.

[0049] It should be noted that the preset filtering rules can be determined according to the actual situation. Preferably, the time interval between every two frames of target images acquired by the endoscope can be determined based on the actual frame rate of the endoscope, and then the corresponding acquisition timestamp can be matched for each completion timestamp based on the time interval; alternatively, the corresponding acquisition timestamp can be matched for each completion timestamp based on the preset time interval; alternatively, a more accurate time offset model can be established to match the corresponding acquisition timestamp for each completion timestamp.

[0050] In one embodiment, the step of determining the target collection timestamp from the collection timestamps based on the completion timestamp of the target number of steps and a preset filtering rule includes: Step S3011: Obtain the actual frame rate of the endoscope, and determine the time interval between every two frames of target images acquired by the endoscope based on the actual frame rate.

[0051] In this embodiment, the endoscope focusing system acquires the actual frame rate of the endoscope and determines the time interval between every two frames of target images acquired by the endoscope based on the actual frame rate. For example, if the actual frame rate of the endoscope is 60fps, then the time interval between every two frames of target images acquired by the endoscope is 17 ms.

[0052] Step S3012: Determine the target acquisition timestamp from the acquisition timestamps based on the completion timestamp of the target number of steps and the time interval.

[0053] In this embodiment, the endoscope focusing system calculates the difference between the completion timestamp of the target step number and the time interval, and selects the acquisition timestamp that is the same as or has the smallest difference from all the acquisition timestamps to determine the target acquisition timestamp.

[0054] Step S302: Determine the clarity of the target image corresponding to the target acquisition timestamp as the target clarity corresponding to the target step number.

[0055] In this embodiment, for each target step number, the endoscope focusing system determines the sharpness of the target image corresponding to the target acquisition timestamp as the target sharpness corresponding to the target step number.

[0056] In this embodiment, the endoscopic focusing system, for each target step number, determines the target acquisition timestamp from the acquisition timestamps based on the completion timestamp of the target step number and preset filtering rules. The sharpness of the target image corresponding to the target acquisition timestamp is then determined as the target sharpness corresponding to the target step number. Based on the correlation between the step number of the focusing motor synchronized with the timestamp and the image sharpness, a complete focusing trajectory data sequence is constructed, which helps improve the efficiency of subsequent endoscopic focusing control.

[0057] Please refer to Figure 4 , Figure 4 This is a flowchart illustrating a fourth embodiment of the endoscopic focusing method provided in this application. The difference between the fourth embodiment and the first to third embodiments is that the step of determining the target step number based on the target sharpness includes: Step S401: Based on each step number and the target sharpness corresponding to each step number, fit and construct a correlation curve between the step number and the sharpness.

[0058] In this embodiment, the endoscopic focusing system fits and constructs a correlation curve between the number of steps and the target sharpness corresponding to each step. In one embodiment, the formula for constructing the correlation curve is: f(x) = a n-1 x n-1 + a n-2 x n-2 +...+ a2 x 2 +a1 x + a0; where x represents the step count and f(X) represents the sharpness. Substituting n sets of step counts and corresponding target sharpness data into the equations, we obtain n equations, from which a0 to a0 can be solved. n-1 These n unknowns can be used to obtain the curve showing the relationship between the number of steps and the resolution.

[0059] In one embodiment, prior to the step of fitting and constructing the correlation curve between the number of steps and sharpness, the following steps are included: Step S4011: Compare the sharpness of each target with a preset sharpness threshold.

[0060] Step S4012: If the target sharpness is less than a preset sharpness threshold, then the target sharpness is discarded.

[0061] Step S4013: If the target sharpness is not less than a preset sharpness threshold, then the target sharpness is retained.

[0062] Step S4014: Based on the retained target sharpness and the corresponding number of steps, perform the step of fitting and constructing a correlation curve between the number of steps and the sharpness.

[0063] In this embodiment, before fitting and constructing the correlation curve between the number of steps and sharpness, the endoscopic focusing system compares each target sharpness with a preset sharpness threshold. If the target sharpness is less than the preset sharpness threshold, it is discarded. If the target sharpness is not less than the preset sharpness threshold, it is retained. Based on the retained target sharpness and the corresponding number of steps, the step of fitting and constructing the correlation curve between the number of steps and sharpness is performed. It can be understood that for significantly lower sharpness, it can be clearly determined that the number of steps does not belong to the target number of steps. In this case, the endoscopic focusing system can discard the significantly lower sharpness, and based on the retained target sharpness and the corresponding number of steps, perform the step of fitting and constructing the correlation curve between the number of steps and sharpness, further improving the efficiency of constructing the correlation curve.

[0064] Step S402: Determine the maximum resolution based on the correlation change curve, and determine the number of steps corresponding to the maximum resolution as the target number of steps.

[0065] In this embodiment, the endoscope focusing system determines the maximum sharpness by analytically solving the correlation curve between the number of steps and the sharpness, and sets the derivative to zero. The number of steps corresponding to the maximum sharpness is then determined as the target number of steps.

[0066] The endoscopic focusing system in this embodiment fits and constructs a correlation curve between the number of steps and the target sharpness corresponding to each step. Based on the correlation curve, the maximum sharpness is determined, and the number of steps corresponding to the maximum sharpness is defined as the target number of steps. By using the correlation curve between the number of steps and the sharpness, the system models the overall trend of changes in sharpness driven by changes in the number of steps, improving noise resistance, reducing the probability of defocusing, and thus improving the accuracy and robustness of endoscopic focusing.

[0067] refer to Figure 5 , Figure 5 This is a schematic diagram of the endoscope focusing device provided in this application. The endoscope focusing device includes: The first recording module 10 is used to control the focusing motor in the endoscope to move and record each step of the focusing motor and the completion timestamp corresponding to the step.

[0068] The second recording module 20 is used to continuously acquire target images of the target object during the movement of the focusing motor, and record the sharpness and acquisition timestamp of each target image.

[0069] The determination module 30 is used to determine the target sharpness corresponding to each step number based on the completion timestamp and the acquisition timestamp, and to determine the target step number based on the target sharpness.

[0070] The focusing module 40 is used to control the focusing motor to move the target step number so as to enable the endoscope to focus on the target object.

[0071] It is understood that the endoscope focusing device in this embodiment corresponds to the endoscope focusing method in the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described again here.

[0072] This application also provides an endoscope device, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor, by running the computer program, causes the endoscope device to perform the above-described endoscope focusing method.

[0073] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.

[0074] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.

[0075] This application also provides a computer storage medium for storing the computer program used in the aforementioned endoscopic device. The computer storage medium can be a readable storage medium, a non-volatile storage medium, or a volatile storage medium. For example, the computer storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0077] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0078] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an endoscope device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0079] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. An endoscope focusing method, characterized in that, The method includes: Control the focusing motor in the endoscope to move, and record each step of the focusing motor and the completion timestamp corresponding to the step number; During the movement of the focusing motor, target images of the target object are continuously acquired, and the sharpness and acquisition timestamp of each target image are recorded. Based on the completion timestamp and the acquisition timestamp, determine the target sharpness corresponding to each step number, and determine the target step number based on the target sharpness; The focusing motor is controlled to move the target step number so that the endoscope can focus on the target object.

2. The endoscopic focusing method according to claim 1, characterized in that, The step of continuously acquiring target images of the target object during the movement of the focusing motor, and recording the sharpness and acquisition timestamp of each target image, includes: During the movement of the focusing motor, target images of the target object are continuously acquired, and the acquisition timestamp corresponding to each target image is recorded. For each target image, the target image is divided into a preset number of target sub-images according to a preset segmentation rule; The sharpness of each target sub-image is calculated based on a preset operator, and the sharpness of the target image is calculated based on the sharpness of each target sub-image.

3. The endoscopic focusing method according to claim 1, characterized in that, The step of determining the target sharpness corresponding to each step number based on the completion timestamp and the acquisition timestamp includes: For each target number of steps, the target collection timestamp is determined from the collection timestamps based on the completion timestamp of the target number of steps and the preset filtering rules. The clarity of the target image corresponding to the target acquisition timestamp is determined as the target clarity corresponding to the target step number.

4. The endoscopic focusing method according to claim 3, characterized in that, The step of determining the target collection timestamp from the collection timestamps based on the completion timestamp of the target number of steps and a preset filtering rule includes: The actual frame rate of the endoscope is obtained, and the time interval between every two frames of target images acquired by the endoscope is determined based on the actual frame rate. The target acquisition timestamp is determined from the acquisition timestamps based on the completion timestamp of the target number of steps and the time interval.

5. The endoscopic focusing method according to claim 1, characterized in that, The step of determining the target step number based on the target sharpness includes: Based on each step number and the target sharpness corresponding to each step number, a correlation curve between the step number and the sharpness is fitted and constructed; Based on the correlation change curve, the maximum resolution is determined, and the number of steps corresponding to the maximum resolution is determined as the target number of steps.

6. The endoscopic focusing method according to claim 5, characterized in that, Before the step of fitting and constructing the correlation curve between step count and sharpness, the following steps are included: The sharpness of each target is compared with a preset sharpness threshold; If the target sharpness is less than a preset sharpness threshold, then the target sharpness is discarded. If the target sharpness is not less than a preset sharpness threshold, then the target sharpness is retained; Based on the retained target sharpness and the corresponding number of steps, the step of fitting and constructing a correlation curve between the number of steps and the sharpness is performed.

7. The endoscopic focusing method according to any one of claims 1-6, characterized in that, The step of controlling the focusing motor to move the target step number to achieve focusing of the endoscope on the target object includes: The focusing motor is controlled to move from a preset initial position to a preset final position by the target number of steps, so as to move the endoscope to the target focusing position, so as to achieve the endoscope focusing on the target object.

8. An endoscope focusing device, characterized in that, The endoscope focusing device includes: The first recording module is used to control the focusing motor in the endoscope to move and record each step of the focusing motor and the completion timestamp corresponding to the step number. The second recording module is used to continuously acquire target images of the target object during the movement of the focusing motor, and record the sharpness and acquisition timestamp of each target image. The determination module is used to determine the target sharpness corresponding to each step number based on the completion timestamp and the acquisition timestamp, and to determine the target step number based on the target sharpness; The focusing module is used to control the focusing motor to move the target step number so that the endoscope can focus on the target object.

9. An endoscopic device, characterized in that, The endoscopic device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the endoscopic focusing method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a processor, executes the endoscope focusing method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Automatic focusing method

    CN101236289A

  • Lens automatic focusing method

    CN105163036A

  • Projector focusing method, projector focusing device and projector

    CN110996085A

  • Projector focusing test method, system and device and storage medium

    CN116614609A

  • Automatic focusing method and electronic device therewith

    CN1896859A