Endoscope automatic focusing method and system and endoscope
By establishing the mapping relationship between exposure parameters and autozoom adjustment parameters, the endoscope's full autofocus is realized, which solves the problems of cumbersome manual focus and low autofocus accuracy, and improves the operation efficiency and focus accuracy of the endoscope.
Patent Information
- Application Number
- CN202411306820.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-11-08
AI Technical Summary
The existing optical lens focusing method of medical endoscopes is manual focus, which is cumbersome to operate; automatic focus algorithms such as range measurement method and image method have problems such as high hardware design requirements, increased cost, slow focus speed and low accuracy.
By pre-establishing the mapping relationship between the exposure parameters and the autozoom adjustment parameters, obtaining the current autozoom adjustment parameters based on the exposure parameters to be queried, and controlling the zoom power component to achieve automatic focus. The entire process does not require manual operation, which improves the focus accuracy.
Fully automatic focus is realized, the problem of cumbersome manual focus operation is solved, and the accuracy of focus position is improved, avoiding the problems of slow focus speed and low accuracy in the prior art.
Smart Images

Figure CN118921547A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of medical devices, and in particular to an endoscope auto-focusing method, system and endoscope. Background Art
[0002] At present, in the medical endoscope industry, the commonly used optical mirror focusing method is manual focusing, that is, controlling the fine adjustment of the lens by rotating the knob. However, this method requires doctors to control the endoscope with one hand and adjust the knob with the other hand, which is cumbersome to operate. Based on this, some automatic focusing algorithms have emerged. The principle is to control the forward and backward movement of the lens by rotating a micro motor to achieve focusing. The difficulty of the automatic focusing algorithm mainly includes two parts: first, how to determine the rotation direction of the motor; second, how to control the motor to rotate to the optimal position.
[0003] In the current research field of autofocus algorithms, the main algorithm implementations include ranging methods and image methods. The ranging method is to measure the distance through a laser rangefinder, and calculate the distance between the lens and the CMOS (Complementary Metal-Oxide-Semiconductor) sensor based on the measured distance to complete the focusing process. However, ranging requires the installation of an additional ranging device, which has high requirements for hardware design, and the installation of an additional ranging device will increase costs. The image method is to determine the best focus position by evaluating the clarity of images of different focal lengths in the same scene. The image method usually further includes a global search method, a hill climbing method, etc., but the focusing speed is slow and the focus position is inaccurate. Summary of the invention
[0004] In view of the problems in the prior art, the purpose of the present application is to provide an endoscope autofocus method, system and endoscope to solve the problem of cumbersome manual focusing operation and improve the focus position accuracy of the autofocus algorithm.
[0005] The present application provides an endoscope automatic focusing method, comprising:
[0006] Get the exposure parameters to be queried;
[0007] Based on a preset mapping relationship between automatic zoom adjustment parameters and exposure parameters, obtaining a current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried;
[0008] The zoom power component is controlled based on the current automatic zoom adjustment parameter.
[0009] In some embodiments, the exposure parameter includes an exposure amount, and the exposure amount is equal to the product of the exposure time and the exposure gain;
[0010] The zoom power component is a motor, and the automatic zoom adjustment parameter includes a rotation angle and a rotation direction of the motor, or the automatic zoom adjustment parameter includes a rotation angle of the motor, and the positive and negative rotation angles represent different rotation directions.
[0011] In some embodiments, before obtaining the current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried based on the preset mapping relationship between the automatic zoom adjustment parameter and the exposure parameter, the method further includes pre-establishing the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter by using the following steps:
[0012] Calibrate a first mapping relationship between the distance between the endoscope lens position and the photographed target position and the exposure parameter;
[0013] Calibrate a second mapping relationship between the distance between the endoscope lens position and the photographed target position and the automatic zoom adjustment parameter;
[0014] A mapping relationship between automatic zoom adjustment parameters and exposure parameters is established based on the first mapping relationship and the second mapping relationship.
[0015] In some embodiments, the first mapping relationship between the distance between the lens position of the endoscope and the position of the photographed target and the exposure parameter is calibrated, comprising the following steps:
[0016] The lens position and the position of the photographed target are adjusted to different distances, and corresponding to each distance, the exposure parameters corresponding to each distance are read respectively, and a first mapping relationship between the lens position of the endoscope and the distance of the photographed target position and the exposure parameters is established.
[0017] In some embodiments, the calibration of the second mapping relationship between the distance between the endoscope lens position and the photographed target position and the automatic zoom adjustment parameter comprises the following steps:
[0018] sequentially setting a plurality of automatic zoom adjustment parameters of the zoom power component, adjusting the position of the photographed target until the focus is completed after the zoom power component adjusts the lens position according to each automatic zoom adjustment parameter, and recording the distance between the lens position and the position of the photographed target when the focus is completed;
[0019] Based on the distance between the lens position and the photographed target position when focusing is completed after the zoom power component adjusts the lens position according to each automatic zoom adjustment parameter, a second mapping relationship between the distance between the lens position of the endoscope and the photographed target position and the automatic zoom adjustment parameter is established.
[0020] In some embodiments, the step of obtaining the exposure parameter to be queried comprises the following steps:
[0021] Get the current light source position and current exposure parameters;
[0022] According to a preset exposure parameter conversion algorithm, and according to the current light source position, the current exposure parameter is converted to the exposure parameter to be queried under the specified light source position.
[0023] In some embodiments, the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter is a mapping relationship between the automatic zoom adjustment parameter and the exposure parameter under a specified light source gear position;
[0024] The method of converting the current light source gear to the exposure parameter to be queried under the specified light source gear according to the preset light source gear conversion algorithm and the current exposure parameter comprises the following steps:
[0025] According to the preset mapping relationship between the light source position and the exposure parameter conversion coefficient, the current exposure parameter conversion coefficient corresponding to the current light source position is queried, and the exposure parameter conversion coefficient corresponding to each light source position is used to convert the exposure parameter of each light source position into the exposure parameter of the specified light source position;
[0026] The exposure parameter to be queried is calculated according to the current exposure parameter and the current exposure parameter conversion coefficient.
[0027] In some embodiments, before querying the current exposure parameter conversion coefficient corresponding to the current light source position according to the preset mapping relationship between the light source position and the exposure parameter conversion coefficient, the mapping relationship between the light source position and the exposure parameter conversion coefficient is pre-established by taking the following steps:
[0028] For each non-specified light source position, while keeping the distance between the lens position and the photographed target position unchanged, respectively obtain the exposure parameters when shooting with the non-specified light source position and the exposure parameters when shooting with the designated light source position, and calculate the exposure parameter conversion coefficient corresponding to the non-specified light source position;
[0029] Based on the exposure parameter conversion coefficients corresponding to the non-designated light source positions, a mapping relationship between the light source position and the exposure parameter conversion coefficient is established.
[0030] The embodiment of the present application further provides an endoscope automatic focusing system for implementing the endoscope automatic focusing method, the system comprising:
[0031] A parameter acquisition module is used to obtain the exposure parameters to be queried;
[0032] A parameter query module, used for obtaining the current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried based on a preset mapping relationship between the automatic zoom adjustment parameter and the exposure parameter;
[0033] A zoom control module is used to control the zoom power component based on the current automatic zoom adjustment parameter.
[0034] An embodiment of the present application also provides an endoscope, including a lens, an optical sensor, a light source, a zoom power component and a controller, wherein the controller is used to implement the endoscope automatic focusing method.
[0035] The endoscope autofocus method, system and endoscope provided by the present application have the following advantages:
[0036] By adopting the present application, a mapping relationship between exposure parameters and automatic zoom adjustment parameters is pre-established, the current automatic zoom adjustment parameters are obtained according to the exposure parameters to be queried, and the movement of the zoom power component is controlled based on the current automatic zoom adjustment parameters to achieve automatic focusing. The entire process can be performed fully automatically without the need for manual operation by the user, which not only solves the problem of cumbersome operation of manual zoom, but also has high focusing accuracy, and solves the problem of inaccurate focus position caused by zoom algorithms based on global search method, hill climbing method and other zoom algorithms in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings.
[0038] Figure 1 is a flow chart of an endoscope autofocus method according to an embodiment of the present application;
[0039] Figure 2(a) to Figure 2(c) It is a schematic diagram of the lens imaging of an endoscope;
[0040] Figure 3 is a flow chart of obtaining exposure parameters to be queried according to an embodiment of the present application;
[0041] Figure 4 It is a structural block diagram of an endoscope autofocus system according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] The example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in a variety of forms and should not be construed as being limited to the embodiments set forth herein; on the contrary, these embodiments are provided so that the present application will be comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated descriptions will be omitted. "Or" and "or" in the specification may both mean "and" or "or". Although the terms "upper", "lower", "between", etc. may be used in this specification to describe different exemplary features and elements of the present application, these terms are used herein only for convenience, such as according to the directions of the examples described in the accompanying drawings. Nothing in this specification should be construed as requiring a specific three-dimensional direction of the structure to fall within the scope of the present application. Although "first" or "second" etc. are used in this specification to represent certain features, they are only used to represent the function, and are not used as a limitation on the number and importance of specific features.
[0043] In order to solve the technical problems of the prior art, the present application provides an endoscope autofocus method, an endoscope autofocus system and an endoscope. The endoscope includes a lens, an optical sensor, a light source, a zoom power component and a controller. The optical sensor is, for example, a CMOS sensor, and the zoom power component is, for example, a motor, which is used to control the forward and backward movement of the lens. The controller includes an endoscope autofocus module for implementing the endoscope autofocus method. The controller may also include an automatic exposure module for calculating the exposure parameters during shooting according to a preset automatic exposure algorithm. The controller may also include a light source control module for calculating the light source position during shooting according to a preset light source control algorithm. The endoscope autofocus module is configured to read the exposure parameters from the automatic exposure module, and may also read the light source position from the light source control module. In the present application, "target" refers to the shooting target of the endoscope, and the following description is made by taking the target to be shot as an object as an example.
[0044] like Figure 1 As shown, the present application provides an endoscope automatic focusing method, comprising the following steps:
[0045] S100: Obtaining exposure parameters to be queried;
[0046] In this embodiment, the exposure parameters include an exposure amount E, and the exposure amount E is equal to the product of the exposure time T and the exposure gain G, that is, E=T*G;
[0047] S200: Based on a preset mapping relationship between automatic zoom adjustment parameters and exposure parameters, obtaining a current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried;
[0048] S300: controlling a zoom power component based on the current automatic zoom adjustment parameter;
[0049] In this embodiment, the zoom power component is a motor, and the motor is used to drive the lens of the endoscope to move forward and backward to achieve lens zoom; the automatic zoom adjustment parameter includes the rotation angle of the motor and the rotation direction of the motor, or the rotation angle can be used as a parameter to represent the automatic zoom adjustment parameter, and the positive and negative values of the rotation angle represent different rotation directions of the motor, for example, when the rotation angle is positive, it means that the motor rotates forward, and when the rotation angle is negative, it means that the motor rotates reversely;
[0050] Taking the automatic zoom adjustment parameter as the rotation angle as an example, the zoom power component is controlled based on the current automatic zoom adjustment parameter, specifically, the controller generates a control instruction of the motor based on the rotation angle and sends it to the motor, so that the lens moves forward and backward through the motor.
[0051] By adopting the endoscope automatic focusing method of the present application, a mapping relationship between exposure parameters and automatic zoom adjustment parameters is pre-established, the current automatic zoom adjustment parameters are obtained according to the exposure parameters to be queried, and the movement of the zoom power component is controlled based on the current automatic zoom adjustment parameters to achieve automatic focusing. The whole process can be fully automatic without manual operation by the user, which can not only solve the cumbersome operation problem of manual zoom, but also has high focusing accuracy, and solves the problem of inaccurate focus position caused by zoom algorithms such as global search method and hill climbing method in the prior art. In this embodiment, the endoscope automatic focusing method can be deployed in the controller of the endoscope. However, the present application is not limited to this. In other embodiments, the endoscope automatic focusing method can also be deployed in a separate control device, which includes a processor and a memory, and the memory stores a computer program, and the computer program is executed by the processor to implement the steps of the endoscope automatic focusing method. The endoscope automatic focusing method can also be implemented by a computer storage medium, and the storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the endoscope automatic focusing method.
[0052] In this embodiment, before step S200, the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter (such as exposure E) is also pre-established. In the automatic exposure algorithm, without considering the influence of the light source gear factor, for any position in the space, when the distance D between the position and the lens position remains unchanged, the exposure parameter of the endoscope when shooting the target at the position is uniquely determined. Therefore, when the exposure parameter is determined, the distance D between the lens position and the position of the photographed target is also determined. Therefore, the mapping relationship between the exposure parameter and the distance D can be determined.
[0053] In the process of automatic zooming, the lens is driven to move forward and backward by a zoom power component (such as a motor) to achieve automatic focusing of the lens. According to the principle of the automatic zooming process, the automatic zoom adjustment parameters of the zoom power component (such as the rotation angle of the motor) correspond to a unique lens position in space. According to the principle of optical imaging, for a lens position determined in space, there is a unique target position to be photographed, so that the image formed on the optical sensor after the target at this position passes through the lens at a determined position is the clearest. That is, when the endoscope completes focusing, the corresponding relationship between the automatic zoom adjustment parameters and the lens position is uniquely determined, and the distance D between the lens position and the target position in space is also uniquely determined. Therefore, the mapping relationship between the automatic zoom adjustment parameters and the distance D can be determined.
[0054] Since there is a definite mapping relationship between the exposure parameters and the distance D, there is a definite mapping relationship between the automatic zoom adjustment parameters and the distance D, and with the distance D as the intermediate quantity, the mapping relationship between the exposure parameters and the automatic zoom adjustment parameters can be determined, that is, the distance between the position of the photographed target and the lens position at this time can be predicted based on the exposure parameters, and then the automatic zoom adjustment parameters can be predicted based on the distance, and the zoom power component is controlled based on the automatic zoom adjustment parameters to drive the lens to move forward and backward to achieve focusing.
[0055] Specifically, in this embodiment, before step S200, the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter is pre-established by adopting the following steps:
[0056] Calibrate a first mapping relationship between the distance between the endoscope lens position and the photographed target position and the exposure parameter;
[0057] Calibrate a second mapping relationship between the distance between the endoscope lens position and the photographed target position and the automatic zoom adjustment parameter;
[0058] A mapping relationship between automatic zoom adjustment parameters and exposure parameters is established based on the first mapping relationship and the second mapping relationship.
[0059] In this embodiment, the first mapping relationship between the distance between the lens position of the endoscope and the photographed target position and the exposure parameter is calibrated, comprising the following steps:
[0060] The lens position and the position of the photographed target are adjusted to different distances, and corresponding to each distance, the exposure parameters corresponding to each distance are read respectively, and a first mapping relationship between the distance between the lens position of the endoscope and the position of the photographed target and the exposure parameter is established. Taking the exposure parameter as the exposure amount E as an example, the first mapping relationship shown in the following Table 1 can be established.
[0061] Table 1 The first mapping relationship between the distance D between the endoscope lens and the photographed object and the exposure E
[0062] distance D11 D12 D13 … D1K … D1N Exposure E1 E2 E3 … EK … EN
[0063] Wherein, N represents the number of distance samples during calibration. During the calibration process, a photographed object can be used, and the distance between the position of the photographed object and the lens position can be adjusted to D11, D12, D13...D1N in sequence, and photographed at each distance and read the exposure time and exposure gain during photographing, and the exposure amount E can be calculated, that is, the exposure amount E1 when the distance between the position of the photographed object and the lens position is D11, the exposure amount E2 when the distance is D12, the exposure amount E3 when the distance is D13... and then the first mapping relationship shown in Table 1 above can be established.
[0064] Figure 2(a) to Figure 2(c) Schematic diagram of endoscope lens imaging. As shown in FIG2(a), the rightmost end indicates the position of the CMOS sensor, and the photographed object is imaged on the CMOS sensor through the lens. When the lens is at position B, there is a distance D between the position A of the object and the position B of the lens. At this time, the object at position A is imaged most clearly on the CMOS sensor through the lens at position B, which means that the focus is completed. As shown in FIG2(b), when the object remains at position A and the lens moves from position B to position B', the image of the object on the CMOS sensor is not a point, but an area, indicating that the image of the object on the CMOS sensor through the lens at position B' after the movement is not clear. As shown in FIG2(c), for the lens at position B', the image of the object at position A is not clear, so the object is moved from position A to position A', and it is found that the image of the object at position A' becomes a point on the CMOS sensor through the lens at position B', that is, the image of the object at position A' through the lens at position B' is clear.
[0065] In this embodiment, the second mapping relationship between the distance between the lens position of the endoscope and the photographed target position and the automatic zoom adjustment parameter is calibrated, comprising the following steps:
[0066] sequentially setting a plurality of automatic zoom adjustment parameters of the zoom power component, adjusting the position of the photographed target until the focus is completed after the zoom power component adjusts the lens position according to each automatic zoom adjustment parameter, and recording the distance between the lens position and the position of the photographed target when the focus is completed;
[0067] Based on the distance between the lens position and the position of the photographed target when the focusing is completed after the zoom power component adjusts the lens position according to each automatic zoom adjustment parameter, a second mapping relationship between the distance between the endoscope lens position and the photographed target position and the automatic zoom adjustment parameter is established. Taking the automatic zoom adjustment parameter as the rotation angle of the motor as an example, a second mapping relationship between the distance D between the endoscope lens and the photographed target and the motor rotation angle Rotation as shown in Table 2 below can be established.
[0068] Table 2 The second mapping relationship between the distance D between the endoscope lens and the photographed object and the motor rotation angle Rotation
[0069] distance D21 D22 D23 … D2K … D2N angle Rota_1 Rota_2 Rota_2 … Rota_K … Rota_N
[0070] Where N is the number of distance samples during calibration. Assume that the motor's rotation angle range is [-Rota_Max,Rota_Max].
[0071] During the calibration process, a photographed object can be placed in front of the lens. Control instructions of different rotation angles Rota_1, Rota_2, Rota_3...Rota_N are sent to the zoom power assembly in sequence. After the zoom power assembly adjusts the lens position according to the control instructions, it adjusts the object position so that the object is clearly imaged on the CMOS sensor through the lens, that is, the focus is completed, and the distances D21, D22, D23...D2N between the position of the photographed object and the lens position when the focus is completed are recorded, so that the second mapping relationship shown in Table 2 above can be established. Among them, the distance D21 corresponds to the rotation angle Rota_1, that is, after the zoom power assembly rotates the angle Rota_1, the zoom power assembly drives the lens to the lens position corresponding to Rota_1. At this time, the distance between the object position and the lens position is D21, and the image is clear, that is, the distance D21 is the optimal imaging distance corresponding to the rotation angle Rota_1. In the application, the motor is rotated from -Rota_Max with a certain step length Rota_i. After each movement of the lens, the object position is adjusted so that the distance between the object position and the lens position changes until the object image is clear, and the optimal imaging distance at this time is recorded.
[0072] When calibrating the first mapping relationship and the second mapping relationship, each distance value D11, D12, D13...D1N in the first mapping relationship preferably corresponds one-to-one with each distance value D21, D22, D23...D2N in the second mapping relationship, so that the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter can be established directly according to the first mapping relationship and the second mapping relationship. The calibration of the above-mentioned first mapping relationship and the calibration of the second mapping relationship can be performed separately or simultaneously. For example, in the case where each distance value in the first mapping relationship corresponds one-to-one with each distance value in the second mapping relationship, the mapping relationship shown in Table 3 below can be established based on Tables 1 and 2 above. In the case where each distance value in the first mapping relationship does not correspond one-to-one with each distance value in the second mapping relationship, the rotation angle corresponding to each distance value in the first mapping relationship can also be calculated by interpolating Table 2.
[0073] Table 3 Mapping relationship between exposure E and motor rotation angle Rotation
[0074] Exposure E1 E2 E3 … EK … EN Rotation Angle Rota_1 Rota_2 Rota_2 … Rota_K … Rota_N
[0075] Based on the mapping relationship shown in Table 3 above, for any position in the space, the angle of rotation of the motor can be determined by its exposure, and the lens can be quickly driven by the motor to move to the corresponding position to achieve automatic focus. No manual adjustment or complex algorithm processing is required, and the focusing speed is faster and the focusing accuracy is high.
[0076] In the above scheme, when calibrating the first mapping relationship, the influence of different light source positions is not taken into account. In the step S100, the exposure parameter to be queried is obtained, that is, the current exposure parameter of the endoscope lens is obtained, and it is used as the exposure parameter to be queried, and the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter can be directly queried to obtain the current automatic zoom adjustment parameter corresponding to the current exposure parameter.
[0077] When the light source position is adjustable, changes in the light source position will lead to changes in the exposure parameters. That is, when the light source position is different, for the same position in space, when shooting a target at that position, the exposure parameter is no longer a fixed value. Changes in the light source position will lead to changes in the light output of the light source, which in turn affects the value of the exposure parameter. Specifically, when other conditions remain unchanged, the light output of the light source is inversely proportional to the exposure parameter. When the light output of the light source is greater, the exposure parameter is smaller. Conversely, when the light output of the light source is smaller, the exposure parameter is larger. Therefore, changes in the light source position will change the first mapping relationship between the distance and the exposure parameter, and cause the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter to change. In order to solve this problem, the influence of the light source position is further considered. When calibrating the first mapping relationship, keep it at a specified light source position for calibration. Before using the above step S200 to query the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter, the current exposure parameter is first equivalently processed according to the current light source position, and is processed into the exposure parameter corresponding to the specified light source position used when calibrating the first mapping relationship, as the exposure parameter to be queried, and then the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter is queried based on the equivalent exposure parameter to be queried (as shown in the above Table 3).
[0078] like Figure 3 As shown, specifically, in step S100, obtaining the exposure parameter to be queried includes the following steps:
[0079] S110: Obtain the current light source position and current exposure parameters;
[0080] S120: According to a preset exposure parameter conversion algorithm, according to the current light source position, the current exposure parameter is converted to an exposure parameter to be queried under a specified light source position. The input of the exposure parameter conversion algorithm is the light source position and the exposure parameter before conversion, and the output is the exposure parameter after conversion. The current light source position and the current exposure parameter are used as inputs of the exposure parameter conversion algorithm to obtain the exposure parameter after conversion of vinegar as the exposure parameter to be queried.
[0081] In this embodiment, the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter is the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter under the specified light source gear. The exposure parameter conversion algorithm in step S120 further includes:
[0082] S121: querying the current exposure parameter conversion coefficient corresponding to the current light source gear according to a preset mapping relationship between the light source gear and the exposure parameter conversion coefficient, wherein the exposure parameter conversion coefficient corresponding to each light source gear is used to convert the exposure parameter of each light source gear into the exposure parameter corresponding to the specified light source gear;
[0083] S122: Calculate the exposure parameter to be queried according to the current exposure parameter and the current exposure parameter conversion coefficient.
[0084] In this embodiment, the step S121: before querying the current exposure parameter conversion coefficient according to the preset mapping relationship between the light source position and the exposure parameter conversion coefficient, further includes calibrating the mapping relationship between the light source position and the exposure parameter conversion coefficient by using the following steps:
[0085] For each non-specified light source position, while keeping the distance between the lens position and the photographed target position unchanged, respectively obtain the exposure parameters when shooting with the non-specified light source position and the exposure parameters when shooting with the designated light source position, and calculate the exposure parameter conversion coefficient corresponding to the non-specified light source position; the non-specified light source position here refers to other optional light source positions except the designated light source position;
[0086] Based on the exposure parameter conversion coefficients corresponding to the non-designated light source positions, a mapping relationship between the light source position and the exposure parameter conversion coefficient is established.
[0087] In this embodiment, the endoscope has a total of 15 light source gears, and the maximum gear (15 gear) is used as the designated light source gear for example, and the process of establishing the mapping relationship between the light source gear and the exposure parameter conversion coefficient is specifically described. In the above-mentioned process of calibrating the first mapping relationship between the distance and the exposure parameter, the light source gear is always set at 15 gear. That is, the first mapping relationship obtained is the first mapping relationship between the distance and the exposure parameter at 15 gears. Degree represents the light source gear, and α represents the exposure parameter conversion coefficient. For the entire endoscope, for a photographed target position in space, the distance between the photographed target position and the lens is D. When D remains unchanged, the light output of the light source * exposure time * exposure gain is a fixed value, and L represents the luminous flux, that is, L*T*G is stable and unchanged. The specific steps for calibrating the mapping relationship between the light source gear and the exposure parameter conversion coefficient are as follows:
[0088] Set the light source position to 15, and when the distance between the lens and the object is D, obtain the exposure time T15 and exposure gain G15, the exposure parameter is T15*G15, and the light output of the light source at this time is set to L15. Set the light source position to H (1≤H<15), keep the distance D unchanged, obtain the exposure time TH and exposure gain GH, the exposure parameter is TH*GH, and the light output of the light source at this time is set to LH, and the exposure parameter conversion coefficient at this time is αH.
[0089] Since the distance D between the lens and the object being photographed remains unchanged, the light output of the light source * exposure time * exposure gain is a constant value, so the following relationship exists:
[0090] T15*G15*L15=TH*GH*LH
[0091] T15 * G15 = (TH *GH) * αH (Formula 1)
[0092]
[0093] Therefore, under the premise that the distance D remains unchanged, based on the exposure parameters of 15th block and H block, by calculating The value of the exposure parameter conversion coefficient αH corresponding to the H gear can be calculated, so that the mapping relationship between the light source gear and the exposure parameter conversion coefficient as shown in Table 4 below can be established.
[0094] Table 4 Mapping relationship between light source position and exposure parameter conversion coefficient
[0095] Light source position 1 2 3 … H … M Exposure parameter conversion factor α1 α2 α3 … αH … αM
[0096] M is the maximum value of the light source gear. In the step S130, the exposure parameter to be queried is calculated according to the current exposure parameter and the current exposure parameter conversion coefficient, that is, the current exposure parameter is multiplied by the current exposure parameter conversion coefficient, that is, the current exposure parameter is equivalent to the exposure parameter to be queried under the specified light source gear, for example, the current exposure parameter of gear H is equivalent to the exposure parameter to be queried after being converted to gear 15, which is E15=EH*αH.
[0097] The above implementation manner is described by taking the designated light source gear as the maximum gear as an example. In other implementation manners, other gears may be selected as the designated light source gear, for example, an intermediate gear is selected as the designated light source gear, and the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter is calibrated under the designated light source gear, and the exposure parameter conversion coefficient of different light source gears relative to the designated light source gear is calculated based on the exposure parameters obtained by switching different light source gears at the same distance D.
[0098] In the above embodiments, the first mapping relationship, the second mapping relationship, the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter, and the mapping relationship between the light source position and the exposure parameter conversion coefficient are exemplarily represented as discrete data tables. In other embodiments, at least one of the above mapping relationships can be represented in the form of a mapping function y=f(x), for example, the first mapping relationship is represented as E=f1(D), or D=f1(E). The second mapping relationship is represented as Rotation=f2(D) or D=f2(Rotation). The mapping relationship between the automatic zoom adjustment parameter and the exposure parameter is represented as Rotation=f3(E). The mapping relationship between the light source position and the exposure parameter conversion coefficient is represented as α=f4(degree). Each function f1(), f2(), f3(), f4() can be a linear fitting function or a nonlinear fitting function, respectively.
[0099] like Figure 4 As shown, the embodiment of the present application also provides an endoscope automatic focusing system for implementing the endoscope automatic focusing method, and the system includes:
[0100] The parameter acquisition module M100 is used to obtain the exposure parameters to be queried;
[0101] The parameter query module M200 is used to obtain the current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried based on the preset mapping relationship between the automatic zoom adjustment parameter and the exposure parameter;
[0102] The zoom control module M300 is used to control the zoom power component based on the current automatic zoom adjustment parameters.
[0103] By adopting the endoscope autofocus system of the present application, a mapping relationship between exposure parameters and automatic zoom adjustment parameters is pre-established, the mapping relationship between the pre-established exposure parameters and the automatic zoom adjustment parameters is obtained through the mapping module M100, the current automatic zoom adjustment parameters are obtained according to the exposure parameters to be queried through the query module M200, and the movement of the zoom power component is controlled based on the current automatic zoom adjustment parameters through the zoom control module M300 to achieve automatic focusing. The whole process can be fully automatic without manual operation by the user, which can not only solve the cumbersome operation problem of manual zoom, but also has high focusing accuracy, and solves the problem of inaccurate focus position caused by zoom algorithms such as global search method and hill climbing method in the prior art. The endoscope autofocus system can be deployed in the controller of the endoscope, or in a separate control device.
[0104] The above content is a further detailed description of the present application in combination with specific preferred implementation methods, and it cannot be determined that the specific implementation of the present application is limited to these descriptions. For ordinary technicians in the technical field to which the present application belongs, several simple deductions or substitutions can be made without departing from the concept of the present application, which should be deemed to fall within the scope of protection of the present application.
Claims
1. An endoscope automatic focusing method, characterized in that: include: Get the exposure parameters to be queried; Based on a preset mapping relationship between automatic zoom adjustment parameters and exposure parameters, obtaining a current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried; The zoom power component is controlled based on the current automatic zoom adjustment parameter.
2. The endoscope automatic focusing method according to claim 1, characterized in that: The exposure parameters include exposure amount, which is equal to the product of exposure time and exposure gain; The zoom power component is a motor, and the automatic zoom adjustment parameter includes a rotation angle and a rotation direction of the motor, or the automatic zoom adjustment parameter includes a rotation angle of the motor, and the positive and negative rotation angles represent different rotation directions.
3. The endoscope automatic focusing method according to claim 1, characterized in that: Before obtaining the current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried based on the preset mapping relationship between the automatic zoom adjustment parameter and the exposure parameter, the method further includes pre-establishing the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter by using the following steps: Calibrate a first mapping relationship between the distance between the endoscope lens position and the photographed target position and the exposure parameter; Calibrate a second mapping relationship between the distance between the endoscope lens position and the photographed target position and the automatic zoom adjustment parameter; A mapping relationship between automatic zoom adjustment parameters and exposure parameters is established based on the first mapping relationship and the second mapping relationship.
4. The endoscope automatic focusing method according to claim 3, characterized in that: The first mapping relationship between the distance between the lens position of the endoscope and the photographed target position and the exposure parameter is calibrated, comprising the following steps: The lens position and the position of the photographed target are adjusted to different distances, and corresponding to each distance, the exposure parameters corresponding to each distance are read respectively, and a first mapping relationship between the lens position of the endoscope and the distance of the photographed target position and the exposure parameters is established.
5. The endoscope automatic focusing method according to claim 3, characterized in that: The second mapping relationship between the distance between the lens position of the endoscope and the photographed target position and the automatic zoom adjustment parameter is calibrated, comprising the following steps: sequentially setting a plurality of automatic zoom adjustment parameters of the zoom power component, adjusting the position of the photographed target until the focus is completed after the zoom power component adjusts the lens position according to each automatic zoom adjustment parameter, and recording the distance between the lens position and the position of the photographed target when the focus is completed; Based on the distance between the lens position and the photographed target position when focusing is completed after the zoom power component adjusts the lens position according to each automatic zoom adjustment parameter, a second mapping relationship between the distance between the lens position of the endoscope and the photographed target position and the automatic zoom adjustment parameter is established.
6. The endoscope auto-focusing method according to claim 1, characterized in that: The step of obtaining the exposure parameter to be queried comprises the following steps: Get the current light source position and current exposure parameters; According to a preset exposure parameter conversion algorithm, and according to the current light source position, the current exposure parameter is converted to the exposure parameter to be queried under the specified light source position.
7. The endoscope automatic focusing method according to claim 6, characterized in that: The mapping relationship between the automatic zoom adjustment parameter and the exposure parameter is the mapping relationship between the automatic zoom adjustment parameter and the exposure parameter under the specified light source gear position; The method of converting the current light source gear to the exposure parameter to be queried under the specified light source gear according to the preset light source gear conversion algorithm and the current exposure parameter comprises the following steps: According to the preset mapping relationship between the light source position and the exposure parameter conversion coefficient, the current exposure parameter conversion coefficient corresponding to the current light source position is queried, and the exposure parameter conversion coefficient corresponding to each light source position is used to convert the exposure parameter of each light source position into the exposure parameter of the specified light source position; The exposure parameter to be queried is calculated according to the current exposure parameter and the current exposure parameter conversion coefficient.
8. The endoscope automatic focusing method according to claim 7, characterized in that: Before querying the current exposure parameter conversion coefficient corresponding to the current light source position according to the preset mapping relationship between the light source position and the exposure parameter conversion coefficient, the method further includes pre-establishing the mapping relationship between the light source position and the exposure parameter conversion coefficient by using the following steps: For each non-specified light source position, while keeping the distance between the lens position and the photographed target position unchanged, respectively obtain the exposure parameters when shooting with the non-specified light source position and the exposure parameters when shooting with the designated light source position, and calculate the exposure parameter conversion coefficient corresponding to the non-specified light source position; Based on the exposure parameter conversion coefficients corresponding to the non-designated light source positions, a mapping relationship between the light source position and the exposure parameter conversion coefficient is established.
9. An endoscope automatic focusing system, characterized in that: For implementing the endoscope autofocus method according to any one of claims 1 to 8, the system comprises: A parameter acquisition module is used to obtain the exposure parameters to be queried; A parameter query module, used for obtaining the current automatic zoom adjustment parameter corresponding to the exposure parameter to be queried based on a preset mapping relationship between the automatic zoom adjustment parameter and the exposure parameter; A zoom control module is used to control the zoom power component based on the current automatic zoom adjustment parameter.
10. An endoscope, characterized in that: The invention comprises a lens, an optical sensor, a light source, a zoom power component and a controller, wherein the controller is used to implement the endoscope automatic focusing method according to any one of claims 1 to 8.
