Endoscope focus control method and system
Through the coarse-then-fine focus control method, combined with the movement compensation and sharpness evaluation function of the zoom lens, the problem of difficulty in focusing the endoscope after zooming is solved, achieving fast and accurate focusing and high-definition images, and reducing user costs. operational burden.
Patent Information
- Application Number
- CN202210318823.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-29
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2042-03-29
AI Technical Summary
When the endoscope is zoomed in or out for observation, the problem of focusing difficulty or focusing failure cannot be effectively solved, resulting in low image clarity and increasing the user's operational burden.
Using the method of first coarse focusing and then fine focusing, the image to be zoomed is obtained through the camera optical system, the moving distance of the zoom lens is calculated according to the zoom magnification, and compensation is driven, and then the fine focus mode is entered, and the sharp focus position is determined using the sharpness evaluation function. Precisely adjust the zoom lens.
It achieves fast and accurate focusing after zooming, improves focusing accuracy and image clarity, reduces manual operation burden, and realizes automatic focusing.
Smart Images

Figure CN114859544B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of endoscope imaging, and in particular to an endoscope focus control method and system. Background Art
[0002] Conventionally, endoscope devices are widely used that irradiate tissues in a body cavity with illumination light and perform diagnosis and treatment using image signals generated based on reflected light.
[0003] An endoscope optical system is generally designed to have a wide depth of field and panoramic focus, so that an image focused from the far point to the near point of the object can be obtained during normal observation.
[0004] However, since the depth of field becomes shallower during magnified observation, the frequency of out-of-focus increases. In order for the user to observe the subject in the focused endoscopic image, the user needs to perform a focusing operation manually, which is a great burden. Summary of the invention
[0005] The object of the present invention is to provide an endoscope focus control method to solve the problem of difficulty in focusing or failure in focusing during zooming in / out observation and to improve image clarity.
[0006] In order to solve the above technical problems, the present invention proposes the following technical solutions:
[0007] The present application relates to an endoscope focus control method, which is characterized by comprising:
[0008] Coarse focus mode: the image to be zoomed is acquired through the camera optical system;
[0009] Performing a scaling operation on a region of interest in the image to be scaled;
[0010] Get the zoom ratio S for the zoom operation;
[0011] According to the zoom magnification S, obtaining the magnification change distance g(s) of the zoom lens in the endoscope system, where g(s) is proportional to S;
[0012] Obtaining a moving distance d=K*g(s) of the zoom lens, where K is a coefficient;
[0013] The moving distance d is compensated, and the zoom lens is driven to move and focus, and then enters the fine focus mode:
[0014] Fine focus mode: fine-tuning the zoom lens to obtain multiple images at multiple different positions within a distance threshold range;
[0015] determining a sharp focus position based on the multiple images;
[0016] The zoom lens is driven to move to the clear focus position.
[0017] In some embodiments of the present application, the compensation lens in the endoscope system is linked to the zoom lens, and the moving distance of the compensation lens compensates for the moving distance d.
[0018] In some embodiments of the present application, determining a clear focus position according to the multiple images is specifically as follows:
[0019] Use the clarity evaluation function to obtain the clarity at different positions;
[0020] Fitting various clarity data and obtaining a clarity data curve;
[0021] The target position corresponding to the maximum point of the clarity data curve is obtained as the clear focus position.
[0022] In some embodiments of the present application, the Sobel gradient function is used as the clarity evaluation function.
[0023] In some embodiments of the present application, the region of interest is a region manually set by a user or automatically set.
[0024] In some embodiments of the present application, the zooming operation adopts a scroll wheel operation zooming or a point touch operation zooming.
[0025] The present application also relates to an endoscope focus control system, characterized in that it includes:
[0026] An image acquisition unit, which is used to acquire a coarsely focused image to be zoomed and a plurality of finely focused images through a camera optical system, wherein the finely focused images are acquired when the coarse focusing is completed;
[0027] An image scaling unit, used for scaling a region of interest in the image to be scaled;
[0028] A magnification acquisition unit, which is used to acquire a zoom magnification S for performing a zoom operation;
[0029] A distance acquisition unit, which acquires the magnification change distance g(s) of the zoom lens in the endoscope system according to the zoom magnification S, and acquires the moving distance d=K*g(s) of the zoom lens, wherein g(s) is proportional to S and K is a coefficient;
[0030] A distance compensation unit, which compensates for the moving distance d;
[0031] A focus position determination unit, configured to determine a clear focus position based on the plurality of fine focus images;
[0032] A focus control unit performs coarse focus control and fine focus control on the driving of the zoom lens.
[0033] In some embodiments of the present application, the endoscope focus control system further includes:
[0034] A compensation value determination unit is used to determine the moving distance of the compensation lens, and to compensate for the moving distance d, wherein the compensation lens in the endoscope system is linked with the zoom lens.
[0035] The endoscope focus control method and control system provided by the present application have the following advantages and beneficial effects:
[0036] (1) It can solve the problem of difficulty in focusing or failure in focusing after zooming;
[0037] (2) The method of coarse focusing first and fine focusing later is adopted, which ignores the focusing operations that may exist during the image zooming process, and can achieve fast and accurate focusing;
[0038] (3) Compensating for the moving distance of the zoom lens to ensure high-precision coarse focusing of the zoom lens, and then performing fine focusing to improve focusing accuracy;
[0039] (4) After zooming, there is no need for manual focus, and automatic focus is achieved, which reduces the manual burden and improves the user experience.
[0040] After reading the specific embodiments of the present invention in conjunction with the accompanying drawings, other features and advantages of the present invention will become more clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief introduction is given below to the drawings required for use in the embodiments of the present invention or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0042] Figure 1 A flow chart of the endoscope focus control method proposed by the present invention;
[0043] Figure 2 The images obtained before and after the endoscope focus control method proposed by the present invention is adopted are shown. DETAILED DESCRIPTION
[0044] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0045] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In the description of the present invention, it should be understood that the orientation or position relationship indicated by the terms "center", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. is based on the orientation or position relationship shown in the accompanying drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0046] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0047] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0048] In order to solve the problem that it is difficult to focus or fails to focus after zooming the image, the focus is automatically achieved and the image clarity is improved.
[0049] Combination Figure 1 , and combined with the endoscope focus control system, the endoscope focus control method is specifically described.
[0050] The endoscope focus control method in the present application includes a coarse focus mode and a fine focus mode, which is implemented by first coarse focus and then fine focus, as described in detail as follows.
[0051] Coarse focus mode
[0052] S1: Acquire the image to be zoomed through the camera optical system.
[0053] The camera optical system of the present application is an optical measurement and photography system that comes with the endoscope.
[0054] In the present application, the imaging optical system includes at least a zoom lens and a compensation lens arranged in parallel.
[0055] The movement of the zoom lens realizes the reflection and refraction of the light of the object to bring the object closer or farther away, that is, to realize its zoom function.
[0056] The compensation lens is used to maintain linkage with the zoom lens during the zooming process, and the focus position during the zooming process is moved by adjusting the position of the compensation lens.
[0057] When the focus object position is controlled by driving the zoom lens, the compensation lens will also move with the zoom lens, so that when the focus object position is changed and the zoom lens magnification changes at the same time, the movement distance of the zoom lens is compensated to make the image clear.
[0058] After the endoscope product is finalized, its imaging optical system is also finalized, and therefore, the compensation relationship between the compensation lens and the moving distance of the zoom lens is also determined.
[0059] The compensation relationship can be obtained based on product testing, and different compensation relationships may exist for endoscopes with different structures.
[0060] That is to say, when the moving distance of the zoom lens is known, the moving distance of the compensation lens can be determined based on the compensation relationship to achieve compensation for the moving distance of the zoom lens.
[0061] In this part, the image acquired is a coarse focus image, which is achieved by using the image acquisition unit.
[0062] S2: Perform a zoom operation on the region of interest in the image to be zoomed.
[0063] In this step S2, it is necessary to first obtain the region of interest.
[0064] The zooming of the region of interest is performed with the center of the region of interest as the zooming center.
[0065] The region of interest may be set manually, automatically, or by default.
[0066] The manually set region of interest may be a region of interest in an image found by a user, and the region may be defined by the coordinates of the upper left corner of the matrix and the length and width of the matrix, wherein the center point of the matrix region is the zoom center.
[0067] It can also be a circular area set by the user, which is determined by the center point and the radius value, and the center point is the zoom center.
[0068] The automatically set region of interest may be, for example, a lesion region identified and located using image detection technology, wherein the center point of the lesion region is the zoom center.
[0069] Among them, the technology for identifying and locating lesions can be implemented using existing technologies.
[0070] If the user does not set the region of interest, the full-size image of the image to be zoomed is used by default, wherein the center of the full-size image is the zoom center.
[0071] In this part, the image scaling operation is implemented by using the image scaling unit.
[0072] S3: Obtain the zoom factor S for the zoom operation.
[0073] In this application, by default, the full-size image of the image to be scaled is used for scaling.
[0074] When zooming in and out on the center of the current image, the current zoom ratio depends on external input, such as a wheel operation zoom or a point touch zoom operation, and is converted into a zoom ratio S.
[0075] The conversion to the zoom ratio S through external input belongs to the prior art. For example, in case of mouse wheel operation, the number of wheel rotations is converted into the zoom ratio S. For example, in point touch operation, the zoom ratio S is determined by the ratio of the distance between two fingers.
[0076] In this section, the zoom factor S is acquired by the factor acquisition unit.
[0077] S4: According to the zoom factor S, obtain the magnification change distance g(s) of the zoom lens in the endoscope system, where g(s) is proportional to S.
[0078] According to the zoom ratio S, the focus lens is driven to move to adjust the zoom ratio, thereby changing the focus object position.
[0079] According to known techniques, the zoom factor s of the zoom lens can be derived as follows.
[0080] According to the basic imaging formula of the lens: 1 / f=1 / u+1 / v, where f is the focal length, which is positive for convex and negative for concave; u is the object distance; v is the image distance, which is positive for real and negative for imaginary.
[0081] The zoom factor of the focusing lens is s=v / u =(vf) / f=v / f-1.
[0082] Therefore, it can be seen that the zoom factor s is linearly proportional to the position of the image.
[0083] The position of the image is consistent with the magnification change distance g(s), so the zoom factor s is proportional to the magnification change distance g(s).
[0084] Assuming that the distances before and after point touch magnification are d1 and d2, the zoom ratio S = (d2-d1) / d1.
[0085] Assuming that the distance the zoom lens moves back and forth is g1 and g2, the zoom factor s = (g2-g1) / g1.
[0086] To achieve focusing, the zoom ratio S and the zoom factor s need to be proportional, preferably, S=s.
[0087] Therefore, the magnification change distance g(s) is proportional to the zoom factor S, that is, it can be expressed as g(s)=m*S or S=m*g(s), where m is a natural number.
[0088] Preferably, m=1, ie g(s)=S.
[0089] In this part, the above acquisition process is performed by the distance acquisition unit.
[0090] S5: Obtain the moving distance d=K*g(s) of the zoom lens, where K is a coefficient.
[0091] As the moving distance of the zoom lens changes, the zoom factor s will change in proportion to the zoom ratio S to change the focus position of the object. Therefore, in order to meet various zoom factors s, a correction coefficient K is added to the magnification change distance g(s) in S3.
[0092] In this way, the moving distance of the zoom lens is obtained as d=K*g(s).
[0093] In this application, K=1 is selected, that is, d=g(s).
[0094] S6: Compensate the moving distance d.
[0095] As described in step S1, a compensation lens is provided to compensate for the moving distance d of the zoom lens, so that when the zoom lens changes the focus position of the object due to movement, a clear image is ensured.
[0096] For example, the compensation relationship determined in advance may be a curve fitted according to data (the moving distance of the zoom lens and the moving distance of the compensation lens).
[0097] The curve may have the moving distance of the zoom lens as the horizontal axis and the moving distance of the compensation lens as the vertical axis.
[0098] Therefore, the moving distance of the compensation lens can be determined according to the compensation relationship and the moving distance of the zoom lens, that is, the compensation value a x .
[0099] According to the compensation value a x Compensate and correct the moving distance d, and obtain the compensated moving distance d':
[0100] d'=a x+ d=a x + K*g(s).
[0101] In this part, the compensation for the moving distance of the zoom lens is performed by the distance compensation unit.
[0102] Specifically, the compensation value determination unit determines the moving distance of the compensation lens (ie, the compensation value a). x ), which is used to compensate for the moving distance and ensure the accuracy of the moving position, so as to make the image clear.
[0103] S7: Drive the zoom lens to move and focus, completing the coarse focus mode.
[0104] Thus, the zoom lens is driven and controlled to move a distance d', and thus the coarse focus mode is completed and the coarse focus control is realized.
[0105] During this process, the camera can be quickly positioned near the final zoom position, avoiding repeated focusing during the zooming process.
[0106] Driving the zoom lens to move is achieved by the focus control unit, and the focus object position is controlled by driving the zoom lens to move.
[0107] After the S7 is finished, enter fine focus mode.
[0108] Due to the calculation error of the zoom ratio S, the image may not be in the best clarity focus position after the coarse focus mode is completed. It is necessary to enter the fine focus mode on the basis of the above to achieve fine focus and make the image clearer.
[0109] Fine focus mode
[0110] S8: Fine-adjust the zoom lens to obtain multiple images at multiple different positions within the distance threshold range.
[0111] Set a certain distance threshold range.
[0112] By fine-tuning the zoom lens, multiple images of the endoscope objective at different positions are acquired.
[0113] The method of acquiring the image is the same as the method of acquiring the image in S1 above.
[0114] The multiple images acquired in this part are fine focus images, and are also acquired by the image acquisition unit in the fine focus mode.
[0115] S9: Determine the clear focus position based on multiple images.
[0116] For multiple images, the different positions and sharpness of each image are used to determine the sharp focus position.
[0117] The specific method is as follows.
[0118] S91: Obtain the clarity at different positions using a clarity evaluation function.
[0119] In practical applications, image clarity can be calculated using various clarity evaluation functions, such as energy gradient function, Sobel gradient function, Brenner gradient function, Roberts gradient function, variance function, Lpalace gradient function, and information entropy function. The more commonly used ones are energy gradient, variance function, and entropy function.
[0120] In the present application, the Sobel gradient function is used as the clarity evaluation function d(f).
[0121]
[0122] Where x and y represent the x-axis and y-axis of the two-dimensional image f(x,y) (at the current zoom factor s), and d(f) represents the integral of the Sobel operator in the x-direction and the y-direction, respectively.
[0123] Of course, the Sobel operator can also be used to extract the gradient value S(x, y) in the horizontal x direction and vertical y direction of the image, and the gradient value is squared. .
[0124] Among them, fx and fy are the first-order Sobel operator convolutions of the two-dimensional image f(x,y) in the x direction and y direction respectively.
[0125] S92: Fitting each clarity data and obtaining a clarity data curve.
[0126] In S91 , multiple sharpnesses of different images at different positions are acquired.
[0127] According to multiple groups of data at different positions and corresponding clarity, a clarity data curve is obtained by fitting.
[0128] This curve reflects the image clarity of images captured at various focus positions. It can be considered that the horizontal axis represents the position and the vertical axis represents the clarity.
[0129] The above fitting method is completed by using existing data fitting methods, such as the least squares method.
[0130] S93: Obtain the target position corresponding to the maximum value point of the clarity data curve.
[0131] The maximum point of the data curve is obtained, and the position corresponding to the maximum point is the target position (ie, the clear focus position).
[0132] In S9 , the process from S91 to S93 is implemented by the focus position determination unit, thereby determining a clear focus position.
[0133] S10: driving the zoom lens to move to a clear focus position, completing a fine focus mode.
[0134] At this point, the fine focus mode is completed and fine focus control is achieved.
[0135] In this part, driving the zoom lens to move is also achieved by the focus control unit, and the focus object position is controlled by driving the zoom lens to move.
[0136] This application adopts the method of coarse focusing first and then fine focusing, ignoring the focusing operations that may exist during the image zooming process, and can achieve fast and accurate focusing.
[0137] See also Figure 2 , which shows images acquired before and after adopting the endoscope focus control method proposed in the present application.
[0138] Figure 2 These are images of the lower opening of the stomach collected through an endoscope.
[0139] Figure 2 (a) is a blurred image obtained in a static state when the endoscope focus control method is not used; Figure 2 (b) is a focused image obtained in a static state when the endoscope focus control method is used. After comparison, it is obvious that the advantage of using the present invention can significantly improve the image clarity.
[0140] Figure 2 (c) is a blurred image obtained when the endoscope and the target are in relative motion without using the endoscope focus control method; Figure 2 (d) is a focused image obtained when the endoscope and the target are in relative motion when the endoscope focus control method is used. After comparison, it is obvious that the advantage of using the present invention can significantly improve the image clarity.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for controlling endoscope focus, characterized in that: include: Coarse focus mode: the image to be zoomed is acquired through the camera optical system; Performing a scaling operation on a region of interest in the image to be scaled; Get the zoom ratio S for the zoom operation; According to the zoom magnification S, obtaining the magnification change distance g(s) of the zoom lens in the endoscope system, where g(s) is proportional to S; Obtaining a moving distance d=K*g(s) of the zoom lens, where K is a correction coefficient and K≥1; According to the pre-determined compensation relationship and the moving distance of the zoom lens, the moving distance a of the compensation lens is determined. x , wherein the pre-determined compensation relationship refers to the relationship between the moving distance of the zoom lens and the moving distance of the compensation lens; Using a x Compensate the moving distance d to obtain the compensated moving distance d': d'=a x +d=a x +K*g(s); The zoom lens is driven to move a distance d' and then enters a fine focus mode: Fine focus mode: fine-tuning the zoom lens to obtain multiple images at multiple different positions within a distance threshold range; determining a sharp focus position based on the multiple images; Driving the zoom lens to move to the clear focus position; Wherein, the compensation lens in the endoscope system is linked with the zoom lens.
2. The endoscope focus control method according to claim 1, characterized in that: Determine a clear focus position according to the multiple images, specifically: Use the clarity evaluation function to obtain the clarity at different positions; Fitting various clarity data and obtaining a clarity data curve; The target position corresponding to the maximum value point of the clarity data curve is obtained as the clear focus position.
3. The endoscope focus control method according to claim 2, characterized in that: The Sobel gradient function is used as the clarity evaluation function.
4. The endoscope focus control method according to claim 1, characterized in that: The region of interest is a region set manually or automatically by a user.
5. The endoscope focus control method according to claim 1, characterized in that: The zooming operation adopts a roller operation zooming or a point touch operation zooming.
6. An endoscope focus control system, characterized in that: include: An image acquisition unit, which is used to acquire a coarsely focused image to be zoomed and a plurality of finely focused images through a camera optical system, wherein the finely focused images are acquired when the coarse focusing is completed; An image scaling unit, used for scaling a region of interest in the image to be scaled; A magnification acquisition unit, which is used to acquire a zoom magnification S for performing a zoom operation; A distance acquisition unit, which acquires the magnification change distance g(s) of the zoom lens in the endoscope system according to the zoom magnification S, and acquires the moving distance d=K*g(s) of the zoom lens, wherein g(s) is proportional to S, K is a correction coefficient and K≥1; The distance compensation unit determines the moving distance a of the compensation lens according to the pre-determined compensation relationship and the moving distance of the zoom lens. x ; Using a x Compensate the moving distance d to obtain the compensated moving distance d': d'=a x +d=a x +K*g(s); A focus position determination unit, configured to determine a clear focus position based on the plurality of fine focus images; A focus control unit, which performs coarse focus control and fine focus control on the driving of the zoom lens, and in the coarse focus control, drives the zoom lens to move a distance d'; The pre-determined compensation relationship refers to the relationship between the moving distance of the zoom lens and the moving distance of the compensation lens.
7. The endoscope focus control system according to claim 6, characterized in that: Also includes: A compensation value determination unit is used to determine the moving distance of the compensation lens in the endoscope system, and to compensate for the moving distance d, wherein the compensation lens is linked to the zoom lens.
