Endoscopic image correction method, system and computer storage medium
By analyzing the acceleration information sequence of the endoscope, calculating the image correction factor and correcting it, the problem of image direction changes caused by the endoscope rotation is solved, and an efficient and low-cost image correction effect is achieved.
Patent Information
- Application Number
- CN202210749787.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-28
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-06-28
AI Technical Summary
The endoscope causes changes in the direction of detection images during rotation, which increases the difficulty for medical workers to read images. In the prior art, the reliance on gyroscopes leads to large size, high power consumption and high cost, making it difficult to apply to the endoscope.
By analyzing the acceleration information sequence of the endoscope, calculating the image correction factor, and determining whether the current attitude is within the range of the acceleration detection dead zone, using different strategies for image correction to avoid using a gyroscope.
It realizes that the direction of the detected image is stably corrected without increasing the hardware configuration requirements, improves the output consistency and reading convenience of the image, reduces costs, and improves the correction accuracy.
Smart Images

Figure CN115115545B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical equipment technology, and in particular to an endoscope image correction method, system and computer storage medium. Background Art
[0002] The magnetically controlled capsule endoscopy system uses an external control magnet (for example, a permanent magnet or an electromagnet) or other external equipment to perform non-contact control over a long distance on a capsule endoscope that is swallowed into the body or placed in a cavity such as a simulated stomach or intestine. This allows the collection of certain parameters in the human body or cavity as intermediate results, thereby assisting in the examination of the digestive tract, assisting medical workers in the diagnosis and treatment of diseases, or assisting in simulation experiments.
[0003] Affected by its own motion, especially when it rotates along its own rotation axis, the direction of the detection image captured by the endoscope will also rotate, such as Figure 1 In the initial state, Figure 1 (a) For a certain detection object, the endoscope generates a detection image along the direction of "A up, B down"; when the endoscope rotates to the posture along "A down, B up", such as Figure 1 (b) For the same test object, the test image will still be generated along the direction of "A up, B down", causing the test object to be angularly deflected (inverted) in the subsequent test image. This will greatly increase the difficulty of medical workers in reading the test images, aggravate the adverse situation of test image jitter, and even cause medical workers to feel dizzy when reading the film.
[0004] One existing technology uses a gyroscope in the device to collect the angular velocity of the device around each axis at a high frequency to adjust the image, but the gyroscope is large in size, high in power consumption, and high in cost, making it difficult to apply to endoscope equipment. Based on this, how to provide an endoscope image correction method that has low requirements for sensors in the endoscope and can solve the problem of "spinning" detection images has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] One of the purposes of the present invention is to provide an endoscopic image correction method to solve the technical problems in the prior art that the detection image is difficult to read due to the rotation of the endoscope, and the correction method has high requirements on hardware configuration and is difficult to apply in endoscopes.
[0006] One of the objects of the present invention is to provide an endoscope image correction system.
[0007] One of the objects of the present invention is to provide a computer storage medium.
[0008] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides an endoscopic image correction method for correcting the direction of a detection image of an endoscope; the endoscopic image correction method comprises: acquiring a current detection image and an acceleration information sequence corresponding to the current detection image; calculating an image correction factor corresponding to the current detection image according to the acceleration information sequence to obtain a current correction factor, and determining whether the current posture information of the endoscope is included in the acceleration detection dead zone; if not, correcting the current detection image according to the current correction factor; if yes, correcting the current detection image according to a forward posture correction factor corresponding to the current posture of the endoscope.
[0009] As a further improvement of an embodiment of the present invention, the method specifically includes: generating a data information sequence based on the acceleration information sequence; wherein the data information sequence includes first direction data, second direction data and third direction data; calculating the current correction factor based on the first direction data and the second direction data; and judging whether the current posture information is included in the acceleration detection dead zone based on the third direction data.
[0010] As a further improvement of an embodiment of the present invention, the method specifically includes: according to a preset filtering window, performing mean filtering on the first acceleration sequence, the second acceleration sequence and the third acceleration sequence in the acceleration information sequence, respectively, to obtain the first direction data, the second direction data and the third direction data respectively, and generate the data information sequence.
[0011] As a further improvement of an embodiment of the present invention, the method specifically includes: fitting acceleration coordinate points based on the first direction data and the second direction data; performing a four-quadrant inverse tangent transformation on the acceleration coordinate points to obtain current spin angle data; and calculating the current correction factor based on the current spin angle data.
[0012] As a further improvement of an embodiment of the present invention, the method specifically includes: calculating the sum of the inverse of the current spin angle data and the preset angle offset data to obtain the current correction factor; wherein the angle offset data is used to define the direction of the observation angle.
[0013] As a further improvement of an embodiment of the present invention, the method specifically includes: calculating comprehensive speed data based on the first direction data, the second direction data and the third direction data; performing an inverse cosine transform based on the comprehensive speed data and the third direction data to obtain the angle data between the endoscope and the third direction in the current posture, and using the angle data as the current dead zone criterion value; if the current dead zone criterion value is less than a preset singular point value, it is determined that the current posture information is included in the acceleration detection dead zone range.
[0014] As a further improvement of an embodiment of the present invention, the method specifically includes: traversing the forward posture information that is temporally preceding the current posture of the endoscope, and determining whether to update the current correction factor; if the forward posture information contains dead zone posture information within the acceleration detection dead zone, extracting the first posture information that is temporally closest to the current posture information, calculating and updating the current correction factor based on the directional deflection amount corresponding to the first posture information.
[0015] As a further improvement of an embodiment of the present invention, the method specifically includes: searching forward with the current posture information as the starting point, and when the dead zone criterion value corresponding to the forward posture information is retrieved to be less than a preset singular point value, determining that there is dead zone posture information in the forward posture information that is included in the acceleration detection dead zone range; if the first posture information is included in the acceleration detection dead zone range, extracting and calculating the directional deflection amount based on the second correction factor corresponding to the second posture information of the endoscope and the first correction factor corresponding to the first posture information, and updating the current correction factor based on the directional deflection amount; wherein the second posture is the previous posture of the first posture in time.
[0016] As a further improvement of an embodiment of the present invention, the method also includes: if the first posture information is not included in the acceleration detection dead zone, then while the endoscope continues to adjust its posture, the current correction factor is always updated according to the directional deflection amount of the corresponding previous posture information until the previous posture information is included in the acceleration detection dead zone, or the current posture information is included in the acceleration detection dead zone.
[0017] As a further improvement of an embodiment of the present invention, the method specifically includes: calling a preset logistic regression function to optimize the current correction factor according to the current correction factor and a prior correction factor corresponding to the forward posture information.
[0018] As a further improvement of an embodiment of the present invention, the method specifically includes: calling the logistic regression function, and calculating an optimized buffer value based on the current correction factor and the prior correction factor; and using the sum of the optimized buffer value and the prior correction factor as the optimized current correction factor.
[0019] As a further improvement of an embodiment of the present invention, the logistic regression function is a sigmoid function.
[0020] As a further improvement of an embodiment of the present invention, the method specifically includes: calling a preset image rotation function, using the current image information and the current correction factor as parameters, respectively, to calculate and generate an intermediate correction image; extracting at least part of the intermediate correction image according to a preset mask to obtain a current correction image.
[0021] As a further improvement of an embodiment of the present invention, the method specifically includes: analyzing the size of the intermediate correction image, and setting the diameter of the preset mask according to the shorter side length of the intermediate correction image; aligning the geometric center of the preset mask and the intermediate correction image, traversing to obtain the pixel value difference set between the intermediate correction image and the preset mask, setting the pixel value in the pixel value difference set as the preset hidden value, and obtaining the current correction image.
[0022] As a further improvement of an embodiment of the present invention, the method specifically includes: obtaining a prior detection image and a prior correction image corresponding to a previous posture of the endoscope, and a current detection image and a current correction image corresponding to a current posture of the endoscope; calculating the detection discrimination of the prior detection image and the current detection image, and the correction discrimination of the prior correction image and the current correction image, and determining whether the correction discrimination is less than or equal to the detection discrimination; if less than or equal to, outputting the current correction image; if greater than, redetermining the current correction factor, and obtaining and outputting the redetermined current correction image.
[0023] To achieve one of the above-mentioned purposes of the invention, one embodiment of the present invention provides an endoscopic image correction system, comprising an endoscope, and a control device for at least correcting the direction of the detection image of the endoscope, wherein the control device is configured to execute the endoscopic image correction method described in any of the above-mentioned technical solutions.
[0024] To achieve one of the above-mentioned purposes of the invention, one embodiment of the present invention provides a computer storage medium on which an application is stored. When the application is executed, the steps of the endoscopic image correction method described in any of the above-mentioned technical solutions are implemented.
[0025] Compared with the prior art, the endoscopic image correction method provided by the present invention obtains the image correction factor by simply analyzing the acceleration information of the endoscope, and reuses the acceleration information to further determine whether the current posture of the endoscope belongs to the acceleration detection dead zone with a large deviation of the image correction factor, so as to adopt different strategies for image correction accordingly. In this way, the hardware only requires the endoscope to be able to obtain acceleration information, which can adapt to the configuration requirements of low power consumption, low cost and small volume of sensors in the endoscope, and can deal with the dead zone problem occurring in the acceleration detection process, get rid of the limitation of needing other sensors such as gyroscopes for assistance, and can improve the correction accuracy and effect on the basis of maximizing the cost-benefit ratio, so that the detected image is always output in a unified direction. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a structural schematic diagram of an endoscope, a detection object and a corresponding detection image in the prior art.
[0027] Figure 2 It is a schematic diagram of the structure of an endoscope in an endoscope image correction system in one embodiment of the present invention.
[0028] Figure 3 Schematic diagram of the steps of an endoscopic image correction method according to one embodiment of the present invention.
[0029] Figure 4 It is a schematic diagram of the state of an endoscope in a certain posture when executing an endoscopic image correction method in one embodiment of the present invention.
[0030] Figure 5 It is a schematic diagram of the state of the endoscope in another posture when executing the endoscopic image correction method in one embodiment of the present invention.
[0031] Figure 6 It is a schematic diagram of some steps of a specific embodiment of an endoscopic image correction method in one embodiment of the present invention.
[0032] Figure 7 It is a schematic diagram of the state of the endoscope in a changing posture when executing the endoscopic image correction method in another embodiment of the present invention.
[0033] Figure 8 It is a schematic diagram of an image acquired by an endoscope in a changing state when an endoscopic image correction method is executed in another embodiment of the present invention.
[0034] Fig. 9 It is a schematic diagram of some steps of an endoscopic image correction method in another embodiment of the present invention.
[0035] Fig.10It is a schematic diagram of another part of the steps of the endoscope image correction method in another embodiment of the present invention.
[0036] Fig.11 It is a schematic diagram of the coordination state between an endoscope in a changing state and an acceleration dead zone when an endoscopic image correction method is executed in another embodiment of the present invention.
[0037] Fig.12 It is a schematic diagram of images corresponding to different steps of executing the endoscopic image correction method in another embodiment of the present invention.
[0038] Fig.13 It is a schematic diagram of some steps of an endoscopic image correction method in another embodiment of the present invention.
[0039] Fig.14 It is a schematic diagram of some steps of an endoscopic image correction method in another embodiment of the present invention. DETAILED DESCRIPTION
[0040] The present invention will be described in detail below in conjunction with the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional changes made by a person skilled in the art based on these embodiments are all within the scope of protection of the present invention.
[0041] It should be noted that the term "comprises" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In addition, the terms "first", "second", "third", etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.
[0042] An embodiment of the present invention provides a computer storage medium having an application stored thereon. When the application is executed, an endoscopic image correction method is implemented. The current posture information of the endoscope is obtained by analyzing simple acceleration information, and a suitable image correction factor is calculated through corresponding judgment strategy and processing strategy to correct the detected image, thereby achieving the effect that the image is always output in a predetermined and appropriate direction without setting a gyroscope or obtaining additional gravity parameters.
[0043] The computer storage medium may be any available medium capable of storing and accessing data, or may be a storage device such as a server or a data center that includes one or more available media integrated therein. Available media may be magnetic media such as floppy disks, hard disks, magnetic tapes, etc., or optical media such as DVDs (Digital Video Discs), or semiconductor media such as SSDs (Solid State Disks).
[0044] One embodiment of the present invention provides an endoscope image correction system, comprising: Figure 2 The endoscope 100 shown, and a control device for at least correcting the direction of the detection image of the endoscope 100, specifically, the control device can be provided with the above-mentioned computer storage medium, or at least the control device is configured to execute an endoscope image correction method, by analyzing simple acceleration information, obtaining the current posture information of the endoscope 100, and calculating the appropriate image correction factor through the corresponding judgment strategy and processing strategy to correct the detection image, thereby achieving the effect that the image is always output along a predetermined and appropriate direction, without the need to set a gyroscope or obtain additional gravity parameters.
[0045] Specifically, as a part of the endoscopic image correction system and / or as an object of the endoscopic image correction method, the endoscope 100 includes a camera unit 11, an acceleration sensor 12, and a housing 10 for electronic components. The camera unit 11 includes at least a camera for collecting images, the acceleration sensor 12 is at least used to collect an acceleration information sequence representing the current motion state of the endoscope 100, and the housing 10 is preferably configured in a capsule or tablet shape that is easy for the user to swallow.
[0046] In an improved embodiment, the endoscope 100 does not necessarily exclude the provision of a gyroscope. On the contrary, the gyroscope can be used to implement other additional functions. At the structural level, the endoscope 100 can further include a positioning component 13 for collecting and analyzing the current actual position and posture of the endoscope 100. Specifically, the positioning component 13 can include a magnetic field sensor 131 and a gyroscope 132, which respectively collect magnetic field information and gravity field conditions to implement analysis of the above conditions. Of course, other necessary or additional components included in the endoscope 100, such as batteries, main control modules, communication modules, magnets, etc., can be configured by those skilled in the art under the guidance of the present invention, and will not be repeated here.
[0047] It is worth noting that Figure 2In the figure, three directions are defined with the endoscope 100 as a reference. In one embodiment, the width extension plane of the endoscope 100 may be defined to include a first direction X and a second direction Y that are perpendicular to each other, and the length extension direction of the endoscope 100 may be defined as a third direction Z. Of course, the rotation axis of the endoscope 100 for adjusting the pitch posture may also be defined to extend along the first direction X, the rotation axis of the endoscope 100 for adjusting the yaw or swing posture may extend along the second direction Y, and the rotation axis of the endoscope 100 for adjusting the roll or rotation posture may extend along the third direction Z. The description of the directions provided below may preferably adopt the above definition method, and of course other definition methods may also be adopted.
[0048] One embodiment of the present invention provides a Figure 3 The endoscopic image correction method shown is at least used to correct the direction of the detection image of the endoscope. The program or instruction corresponding to the method can be carried in the above-mentioned computer storage medium, and the method can also be carried in the above-mentioned endoscopic image correction system in the form of a program, instruction or other form to achieve the technical effect of endoscopic image correction. The endoscopic image correction method can specifically include the following steps.
[0049] Step 21, obtaining a current detection image and an acceleration information sequence corresponding to the current detection image.
[0050] Step 22, calculating the image correction factor corresponding to the current detection image according to the acceleration information sequence, obtaining the current correction factor, and determining whether the current posture information of the endoscope is included in the acceleration detection dead zone.
[0051] If not, jump to step 23A to correct the current detection image according to the current correction factor.
[0052] If yes, jump to step 23B to correct the current detection image according to the first correction factor corresponding to the forward posture of the current posture of the endoscope.
[0053] In this way, on the one hand, the acceleration information sequence can be used to confirm the image correction factor, and the direction of the detected image can be corrected to a state that is convenient for medical staff to observe, so as to prevent medical workers from dizziness when reading the film, and avoid the use of devices such as gyroscopes, which will occupy the volume of the endoscope, increase the power consumption and cost of the endoscope, and other problems. On the other hand, the acceleration information sequence can be reused to analyze and determine whether the posture information of the endoscope is included in the acceleration detection dead zone, and the judgment result can be used as a prerequisite and internal factor for determining the image correction factor. A simple acceleration information sequence (at the hardware level, it is a low-cost, low-energy consumption and small-volume acceleration sensor) can be used to achieve a good correction effect and avoid problems such as correction failure or poor accuracy.
[0054] Specifically, Figure 2 and Figure 4As shown, the movement of the endoscope 100 in the body or cavity can be decomposed into at least a first movement component that is tilted relative to the third direction Z, and a second movement component with the third direction Z as the rotation axis. The third direction Z is arranged parallel to the gravity direction as the initial state of the endoscope 100, and the first movement component will have a deflection angle relative to the gravity direction. The second motion component will generate a spin angle φ relative to the initial state in the third direction Z. It can be understood that the deflection angle The spin angle φ can be used to represent the pitch and yaw or swing posture of the endoscope 100, and the spin angle φ can be used to represent the roll or rotation posture of the endoscope 100. In addition, the movement of the endoscope 100 on the plane formed by the first direction X and the second direction Y can be defined as the third movement component.
[0055] As a supplementary explanation, the appearance of the acceleration detection dead zone is based on the limitation of the working principle of the acceleration sensor itself, which results in that when the endoscope 100 is at certain angles or postures, the acceleration sensor 12 cannot detect acceleration data sufficient to calculate the posture information, and there is a large noise, which makes the obtained acceleration data jump within a large range, thereby defining these angles and postures as acceleration detection dead zones, indicating that the confidence of the acceleration information sequence detected at this angle range or posture type is low, at least it cannot be used to calculate the image correction factor.
[0056] In one case, if Figure 2 , Figure 4 and Figure 5 As shown in FIG. 1 , when the third direction Z of the endoscope 100 is parallel to the direction of gravity, or is at a small angle to the direction of gravity, the acceleration data detection effect of the endoscope 100 is poor, so the deflection angle can be used to detect the acceleration data of the endoscope 100. As a criterion, define the deflection angle satisfy When , the endoscope 100 is in the acceleration detection dead zone DB, where τ or -τ can be defined as a singular point value. Correspondingly, it can be understood that the acceleration detection dead zone DB can be defined as the deflection angle region of [-τ, τ], or it can be defined as a region with a certain coverage range established with the singular center point SP as the center, wherein the singular center point SP is any point of the center of gravity of the endoscope 100 in the gravity direction, and when the third direction Z of the endoscope 100 intersects with the acceleration detection dead zone DB, it is considered that the current posture of the endoscope 100 falls into the acceleration detection dead zone DB, or the current posture information of the endoscope 100 is included in the range of the acceleration detection dead zone DB.
[0057] The forward posture of the endoscope represents the posture before the current posture corresponding to the current posture information, and the forward posture can be specifically defined as being before the current posture in time. In this way, the problem of poor image correction effect within the acceleration detection dead zone can be avoided, and the correction effect can be compensated to a certain extent by using the first correction factor to keep the overall correction effect balanced and stable.
[0058] The present invention provides a specific embodiment based on the above-mentioned implementation mode, such as Figure 3 and Figure 6 As shown, this specific embodiment includes the following steps.
[0059] Step 21, obtaining a current detection image and an acceleration information sequence corresponding to the current detection image.
[0060] Step 221, generating a data information sequence according to the acceleration information sequence.
[0061] Step 222: Calculate the current correction factor according to the first direction data and the second direction data.
[0062] Step 223: Determine whether the current posture information is within the acceleration detection dead zone according to the third direction data.
[0063] If not, jump to step 23A to correct the current detection image according to the current correction factor.
[0064] If yes, jump to step 23B to correct the current detection image according to the first correction factor corresponding to the forward posture of the current posture of the endoscope.
[0065] Wherein, the data information sequence includes first direction data, second direction data and third direction data. The first direction data may be acceleration data corresponding to the above-mentioned first direction X, the second direction data may be acceleration data corresponding to the above-mentioned second direction Y, and the third direction data may be acceleration data corresponding to the above-mentioned third direction Z. Thus, the first direction data and the second direction data may reflect the rotation of the endoscope with the third direction Z as the rotation axis, and the third direction data may reflect the deflection of the endoscope relative to the direction of gravity. Of course, the present invention does not exclude other definitions of the three directions, and the meanings of the other three direction data derived therefrom. For example, the gravity direction as the reference direction may be optionally defined by the operator as other directions other than the gravity direction, such as the magnetic field direction or other force field directions.
[0066] In this way, the current correction factor can be obtained based on part of the data in the data information sequence, and another part of the data in the data information sequence can be used to determine whether the current posture information is included in the acceleration detection dead range, thereby combining the two factors to jointly determine the most appropriate correction factor to correct the detection image of the endoscope, taking into account the beneficial effects of small data volume requirements, small amount of calculation and good correction effect.
[0067] Among them, step 222 and step 223 do not necessarily have an existing order relationship, and step 223 can be set between step 222 and step 221. The data information sequence and the acceleration information sequence can be interpreted differently, for example, the acceleration information sequence is operated or standardized to form other forms of data information sequences containing three types of direction data. Of course, in other embodiments, equivalent interpretations can also be made, so that step 221 can also be further interpreted as extracting and sorting the acceleration information sequence to obtain a data information sequence containing three types of direction data.
[0068] For the former, preferably, the data information sequence can be obtained by filtering the acceleration information sequence. Based on this, step 221 can be further refined to include: according to a preset filtering window, the first acceleration sequence, the second acceleration sequence and the third acceleration sequence in the acceleration information sequence are respectively subjected to mean filtering, and the first direction data, the second direction data and the third direction data are respectively obtained to generate the data information sequence. Specifically, for example, the first acceleration sequence is defined as a x (t), the step length of the filtering window is defined as ΔT, then the first direction data after filtering and representing the acceleration of the endoscope moving along the first direction is At least:
[0069]
[0070] For step 222, preferably, the following specific steps may be included.
[0071] Step 2221, fitting acceleration coordinate points according to the first direction data and the second direction data.
[0072] Step 2222, perform a four-quadrant inverse tangent transformation on the acceleration coordinate point to obtain current spin angle data.
[0073] Step 2223, calculate the current correction factor according to the current spin angle data.
[0074] In this way, a simple coordinate operation can be performed through the first direction data and the second direction data to obtain the spin angle data, and the rotation angle of the detection image relative to the normal observation viewing angle direction (or display direction) can be determined based on the spin angle data, so as to calculate the current correction factor corresponding to the current detection image, thereby achieving the technical effect of quickly, stably and efficiently correcting the viewing angle direction of the detection image.
[0075] For example, define the first direction data as Define the second direction data as The corresponding acceleration coordinate point is Thus, the current spin angle data φ can be configured to at least satisfy:
[0076]
[0077] In this way, a matching relationship can be established with the rectangular coordinate system based on the actual meaning represented by the first direction data and the second direction data, and the corresponding relationship between the matching relationship and the endoscope's spin angle can be used to calculate the spin angle of the endoscope when it is in the current posture. Thus, abstract and complex data can be calculated through simple and specific data, which saves calculation steps and improves the accuracy of spin angle estimation.
[0078] Normally, the spin angle itself characterizes the degree of rotation of the detection image caused by the endoscope rotating about the third direction Z as the rotation axis. In step 222 or the specific step 2223, the spin angle can be directly used as a correction factor to rotate the detection image to a "top to bottom" order or other convenient reading state. However, in some special cases, the viewing angle direction actually required by medical workers may be reverse or oblique. Based on this, step 2223 can preferably include the steps of: calculating the opposite of the current spin angle data and the sum of the preset angle offset data to obtain the current correction factor. Wherein, the angle offset data is used to define the direction of the viewing angle.
[0079] For example, define the original image as I, define the spin angle data as φ, and define the angle offset data as φ bias , define the rotation correction function as imageRotate(), then the image I′ after rotation correction can at least satisfy:
[0080] I′=imageRotate(I,-φ+φ bias ).
[0081] Among them, the angle offset data φ bias When it is 0, it indicates that the opposite number of the spin angle data is directly used as the current correction factor to correct the viewing angle direction of the detected image; the angle offset data φ biasWhen φ is 180 degrees, it indicates that the detected image is corrected in the direction opposite to the normal viewing angle. bias Adjust the orientation of the rectified detection image.
[0082] For step 223, preferably, the following specific steps may be included.
[0083] Step 2231, calculating comprehensive speed data according to the first direction data, the second direction data and the third direction data.
[0084] Step 2232, performing an inverse cosine transform based on the comprehensive speed data and the third direction data to obtain the angle data between the endoscope and the third direction in the current posture, and using the angle data as the current dead zone criterion value.
[0085] Step 2233: If the current dead zone criterion value is less than the preset singular point value, it is determined that the current posture information is included in the acceleration detection dead zone range.
[0086] In this way, the direction data in the data information sequence can be used to fit the angle data, that is, the deflection angle This improves the speed of knowing the current posture of the endoscope and reduces the amount of calculation in the process. At the same time, the angle data is used as a criterion to further determine the quantitative relationship between it and the singular point value set in the acceleration detection dead zone, so that the relationship between the endoscope and the acceleration detection dead zone can be quickly and efficiently determined to assist in the correction of the detection image.
[0087] It should be emphasized that the current posture information may specifically refer to the aforementioned spin angle φ, the deflection angle At least one of the first motion component, the second motion component or the third motion component may also specifically refer to the posture information of the posture formed by the endoscope under the action of at least one of the first motion component, the second motion component or the third motion component.
[0088] The comprehensive speed data represents the total acceleration data formed by integrating the acceleration of the endoscope in all directions. In this embodiment, the comprehensive speed data represents the total acceleration data formed by integrating the acceleration of the endoscope in the first direction, the second direction and the third direction. The object of the inverse cosine transform can be any data generated after calculating the comprehensive speed data and the third direction data that can represent the deflection amount of the endoscope relative to the gravity direction. Preferably, it can be the quotient between the third direction data and the comprehensive speed data, so as to normalize the third direction data for calculation.
[0089] Based on this, the comprehensive speed data is defined as a, and the third direction data is defined as The angle data (or the deflection angle), that is, the current dead zone criterion value At least:
[0090]
[0091] Due to the third-party data The absolute values of and the comprehensive velocity data a are taken as the quotient to be used as the object of the inverse cosine transform. Therefore, the condition for judging whether the current posture information is included in the acceleration detection dead zone can be simplified to judging the size between it and the positive value τ in the singular point value, that is, when When the current posture information is determined to be within the acceleration detection dead zone, the acceleration information sequence obtained by the endoscope in the current posture, at least the part used to calculate the correction factor, has a low confidence. Of course, when the object of the inverse cosine transform is not a non-negative value, the form of the singular point value can be adjusted accordingly to achieve the judgment of the inclusion relationship between the current posture information and the acceleration detection dead zone. Preferably, the singular point value τ can be 1 degree to 5 degrees, corresponding to Figure 5 It can be interpreted as
[0092] Continue as Figure 2 , Figure 7 and Figure 8 As shown, at the deflection angle During the adjustment process, there is a situation where the third direction Z of the endoscope rotates from one side of the reference line extending in the direction of gravity to the other side of the reference line, thereby scanning and obtaining a detection image located above or below the endoscope in the direction of gravity. Figure 7 In the process of moving from the first position 100A to the third position 100C via the second position 100B, at least part of the first marking point C, the second marking point D, the third marking point E, the fourth marking point F and the fifth marking point G are respectively used as detection objects, and corresponding detection images are obtained respectively. Figure 3 When the endoscope image correction method is shown, the image collected by the above process is as follows Figure 8 As shown in (a), it can be seen that in the image containing the second marker D, the third marker E and the fourth marker F, and in the image containing the third marker E, the fourth marker F and the fifth marker G, the order of the marker distribution and their actual position order are different. When the endoscope rotates from the posture information included in the acceleration detection dead zone to the posture information not included in the acceleration detection dead zone, the order jump will occur.
[0093] Based on this, by applying the technical solution provided in the previous article, it can actually be achieved that the order of the marking points or detection objects from top to bottom in the detection image is always consistent with the order of the marking points or detection objects from far to near relative to the earth, which can assist medical workers to stabilize the observation direction and keep it consistent with the gravity direction. However, in some special requirements, especially when medical workers need to manually control or control the pitch, yaw or swing posture of the endoscope according to a preset trajectory, medical workers need to obtain detection images above or behind the endoscope along the gravity direction according to their daily life habits, or need to scan and observe continuous marking points and detection objects. In this process, the order of the marking points and the detection objects themselves needs to be kept consistent with the human eye. That is, it is necessary to achieve the acquisition of the following Figure 8 In the detection image shown in (b), “third marking point E—fourth marking point F—fifth marking point G” is corrected from top to bottom to “fifth marking point G—fourth marking point F—third marking point E”.
[0094] Therefore, another embodiment of the present invention provides a Figure 3 and Fig. 9 The endoscopic image correction method shown may specifically include the following steps.
[0095] Step 21, obtaining a current detection image and an acceleration information sequence corresponding to the current detection image.
[0096] Step 22, calculating the image correction factor corresponding to the current detection image according to the acceleration information sequence, obtaining the current correction factor, and determining whether the current posture information of the endoscope is included in the acceleration detection dead zone.
[0097] If not, jump and implement the following steps in sequence:
[0098] Step 241A, traversing the forward posture information that is temporally prior to the current posture of the endoscope, and determining whether to update the current correction factor;
[0099] Step 242A, if there is dead zone posture information included in the acceleration detection dead zone in the forward posture information, extract the first posture information closest to the current posture information in time, calculate and update the current correction factor according to the direction deflection amount corresponding to the first posture information;
[0100] Step 23A, correcting the current detection image according to the current correction factor.
[0101] If yes, jump to step 23B to correct the current detection image according to the first correction factor corresponding to the forward posture of the current posture of the endoscope.
[0102] In this way, the direction deflection amount corresponding to the posture information can be obtained by analyzing the specified posture information in the forward posture information, and the correction factor can be updated according to the direction deflection amount, for example, Figure 7 As shown, the correction factor at the third position 100C matches the direction deflection of the correction factor at the second position 100B to obtain Figure 8 (b) is the configuration of the detection image observation viewing angle direction.
[0103] In detail, Fig.11 Taking the shown state as an example, the straight line in the third direction when the endoscope 100 is in the current posture is defined as the current reference line L0. Thus, in multiple forward postures before the current posture, the straight line in the third direction of the endoscope 100 corresponds to the first reference line L1, the second reference line L2, the third reference line L3 and the fourth reference line L4.
[0104] Continuing, it can be determined that the forward posture information corresponding to the second reference line L2 and the third reference line L3 is included in the acceleration detection dead zone range, and the forward posture information corresponding to the second reference line L2 and the third reference line L3 is determined to be the dead zone posture information. Fig.11 Capsule endoscopy in Figure 7 When the described motion process realizes the "head raising" action, the above-mentioned multiple reference lines are generated in the order of "fourth reference line L4-third reference line L3-second reference line L2-first reference line L1-current reference line L0", and the posture information corresponding to the first reference line L1 is the posture information closest in time to the current posture information. Therefore, the posture information corresponding to the first reference line L1 is determined to be the first posture information, the directional deflection of the first posture information is calculated, and the current correction factor is updated.
[0105] Of course, if the above action process is only between the first reference line L1 and the current reference line L0, it belongs to "there is no dead zone posture information included in the acceleration detection dead zone DB in the forward posture information". At this time, the current correction factor does not need to be updated, and the current detection image can be corrected directly according to the current correction factor.
[0106] For the convenience of the following description, the third reference line L3 is defined to extend along the gravity direction, and the fourth reference line L4 is defined to have a deflection angle relative to the third reference line L3. = is equal to the negative value -τ in the singular point value. Therefore, the intersection point of the third reference line L3 and the acceleration detection dead zone DB is the singular center point SP, and the acceleration detection dead zone DB has no intersection point with the fourth reference line L4.
[0107] The specific method for obtaining the first posture information and the deflection amount thereof may be to sort the forward posture information and then filter it, or to mark it in chronological order during the movement of the endoscope 100. The present invention provides a preferred specific embodiment, in which the above step 242A may specifically include the following steps:
[0108] Step 2421A, forward search is performed starting from the current posture information. When the dead zone criterion value corresponding to the forward posture information is retrieved to be less than the preset singular point value, it is determined that the forward posture information contains dead zone posture information within the acceleration detection dead zone range.
[0109] Step 2422A, if the first posture information is included in the acceleration detection dead zone, extract and calculate the directional deflection amount based on the second correction factor corresponding to the second posture information of the endoscope and the first correction factor corresponding to the first posture information, and update the current correction factor based on the directional deflection amount.
[0110] Among them, the second posture is the previous posture of the first posture in time. In this way, through forward retrieval and judgment of the dead zone criterion value, the first posture information corresponding to the current posture information can be retrieved more quickly; and considering that the confidence of the acceleration information sequence of the endoscope within the acceleration detection dead zone is low, after obtaining the first correction factor corresponding to the first posture information, the first correction factor corresponding to the first correction factor can be further obtained, that is, the second correction factor, and the two can be combined to jointly determine the direction deflection amount, so that a more accurate and satisfactory correction factor can be obtained. Figure 8 (b) The current correction factor in the viewing angle direction.
[0111] In detail, Fig.11 Taking the state shown in FIG. 1 as an example, when the current posture information corresponding to the current reference line L0 is used as the starting point for forward retrieval, the first reference line L1, the second reference line L2, and the third reference line L3 can be retrieved in sequence, thereby calculating the angle data or the deflection angle in sequence according to the acceleration information sequences corresponding to different reference lines. And the angle data or deflection angle By comparing the dead zone criterion value with the singular point value τ, a reference line and corresponding posture information satisfying the less than relationship can be finally retrieved, and it is determined that there is dead zone posture information within the acceleration detection dead zone DB in the forward posture information. For example, in this embodiment, the dead zone criterion value corresponding to the first reference line L1, the dead zone criterion value corresponding to the second reference line L2, or the dead zone criterion value corresponding to the third reference line L3 can be retrieved to meet the above conditions.
[0112] It can be seen that the first reference line L1 may be in two states: the first is that there is an intersection between the first reference line L1 and the acceleration detection dead zone DB, or the dead zone criterion value corresponding to the first reference line L1 is smaller than the singular point value, or the first posture information corresponding to the first reference line L1 is included in the acceleration detection dead zone range; the second is that there is no intersection between the first reference line L1 and the acceleration detection dead zone DB, or the dead zone criterion value corresponding to the first reference line L1 is greater than or equal to the singular point value, or the first posture information corresponding to the first reference line L1 is not included in the acceleration detection dead zone range.
[0113] For the former, the above technical solution of the present invention provides a technical solution for determining the direction deflection amount by combining the second posture information and the first posture information. As reflected in the figure, the direction deflection amount is calculated by combining the second correction factor corresponding to the second reference line L2 and the first correction factor corresponding to the first reference line L1 to keep the deflection matching process stable.
[0114] For the latter, as a supplement to the above-mentioned technical solution, or as an independent proposal of the above-mentioned technical solution, since the acceleration information sequence of the first posture information has a higher confidence, and the current posture information that is temporally located after the first posture information is also not included in the acceleration detection dead zone, the corresponding acceleration information sequence also has a higher confidence. Therefore, in the process of the endoscope continuing to adjust the posture, the directional deflection amount of the previous posture information corresponding to the real-time posture information can always be used to update the correction factor, thereby further simplifying the correction process and achieving better technical effects.
[0115] Based on the definition of the acceleration detection dead zone, two acceleration detection dead zones should be symmetrically arranged at the endoscope 100 with the direction perpendicular to the gravity direction as the symmetry axis, and correspondingly include two singular center points, that is, Fig.11 The first detection dead zone DB, the second detection dead zone DB', and the first center point SP and the second center point SP' are shown. Therefore, when the current reference line L0 is included in the second detection dead zone DB', or the posture information before the current posture information is included in the acceleration detection dead zone, the update of the current correction factor can be stopped. In other words, the direction deflection amount corresponding to the current correction factor can be reset to maintain the appropriate viewing angle direction while preventing the infinite accumulation of the direction deflection amount.
[0116] Based on this, step 242A may specifically include the following step 2423A: if the first posture information is not included in the acceleration detection dead zone, then in the process of the endoscope continuing to adjust the posture, the current correction factor is always updated according to the directional deflection amount of the corresponding previous posture information until the previous posture information is included in the acceleration detection dead zone, or the current posture information is included in the acceleration detection dead zone.
[0117] It is worth emphasizing that the above steps 2421A and 2422A and 2423A can be included in the same preferred embodiment, or can be used as two technical solutions to form the step 242A respectively. For the former, the endoscope 100 can continuously and dynamically adjust the viewing angle direction of the detection image during the rotation process, so that the viewing angle direction conforms to the general control logic.
[0118] Of course, no matter in the above two technical solutions or in the new technical solution formed by combining the two technical solutions, preferably, at least the first spin angle data in the first correction factor and the second spin angle data in the second correction factor are used for updating, and at least the current spin angle data in the current correction factor is updated. Then, the current spin angle data is defined as φ(t), the first spin angle data is φ(t-1), the second spin angle data is φ(t-2), the direction deflection amount corresponding to the current spin angle data φ(t) is Δφ(t), the direction deflection amount corresponding to the first spin angle data φ(t-1) is Δφ(t-1), and the direction deflection amount corresponding to the second spin angle data φ(t-2) is Δφ(t-2), then the updated current spin angle data φ′(t) at least satisfies:
[0119] φ′(t)=φ(t)+Δφ(t);
[0120] The directional deflection Δφ(t) corresponding to the current spin angle data φ(t) at least satisfies:
[0121]
[0122] in, is the current deflection angle or current dead zone criterion value corresponding to the current spin angle data φ(t), is the first deflection angle or the first dead zone criterion value corresponding to the first spin angle data φ(t-1). Similarly, the updated first spin angle data φ′(t-1) at least satisfies:
[0123] φ'(t-1)=φ(t-1)+Δφ(t-1);
[0124] Furthermore, the direction deflection amount Δφ(t-1) corresponding to the first spin angle data φ(t-1) at least satisfies:
[0125]
[0126] The iterative calculation is performed to obtain a solution. In one embodiment, the forward iterative calculation process stops when the fourth posture information corresponding to the fourth reference line L4 is calculated.
[0127] In this other embodiment, corresponding to Figure 3 Some detailed steps may be included between step 22 and step 23B to improve the overall smoothness of the endoscope calibration result and prevent the "jelly effect" or obvious jamming during the normal calibration process. Figure 3 and Fig.10 As shown, the endoscopic image correction method may specifically include the following steps.
[0128] Step 21, obtaining a current detection image and an acceleration information sequence corresponding to the current detection image.
[0129] Step 22, calculating the image correction factor corresponding to the current detection image according to the acceleration information sequence, obtaining the current correction factor, and determining whether the current posture information of the endoscope is included in the acceleration detection dead zone.
[0130] If not, jump to step 23A to correct the current detection image according to the current correction factor.
[0131] If yes, jump to the following steps:
[0132] Step 24B, calling a preset logistic regression function to optimize the current correction factor according to the current correction factor and a previous correction factor corresponding to the forward posture information;
[0133] Step 23B, correcting the current detection image according to the first correction factor corresponding to the forward posture of the current posture of the endoscope.
[0134] In this way, the prior correction factor can at least be used as a parameter of the logistic regression function to further optimize the current correction factor. Since the prior correction factor and the current correction factor are fused, the correction process can be more consistent as a whole, and the correction process will not produce instantaneous mutations and jello effects, thereby making the corrected detection image look better.
[0135] Although step 24B is set between step 23B and step 22 above, it is understandable that the above step 24B and its derivative steps can be set at any position provided by the present invention to achieve the corresponding technical effect. In a preferred embodiment, step 24B can also be set between step 242A and step 23A, so as to compensate for the error in step 242A caused by estimating the current correction factor due to the current posture information being included in the acceleration detection dead zone.
[0136] On the one hand, preferably, the logistic regression function is a sigmoid function, which can utilize its unique S-shaped distribution to make the changes between the correction factors of different postures smoother.
[0137] On the other hand, in a preferred embodiment, step 24B may further include the following steps:
[0138] Step 241B, calling the logistic regression function, and calculating the optimized buffer value according to the current correction factor and the previous correction factor.
[0139] Step 242B, taking the sum of the optimized buffer value and the previous correction factor as the optimized current correction factor.
[0140] Preferably, the above optimization process is implemented at least according to the previous spin angle data in the previous correction factor and the current spin angle data in the current correction factor. Then, the previous spin angle data is defined as φ(ti), the current spin angle data is defined as φ(t), and the logistic regression function is defined as f(). Then, the optimized current spin angle data (hereinafter referred to as optimized spin angle data) is At least:
[0141]
[0142] That is, the difference between the current spin angle data φ(t) in the current correction factor and the previous spin angle data φ(ti) in the previous correction factor is used as the parameter of the logistic regression function to calculate the optimized buffer value f(φ(t)-φ(ti)), and then the sum of the optimized buffer value f(φ(t)-φ(ti)) and the previous spin angle data φ(ti) in the previous correction factor is used as the optimized spin angle data in the optimized current correction factor.
[0143] Furthermore, the forward attitude information may specifically be the previous attitude information, and thus the first spin angle data may be the previous spin angle data φ(t-1) corresponding to the previous attitude information, which can enhance the continuity of the current correction factor at the level of adjacent spin angle data.
[0144] Based on this, the difference between the current spin angle φ(t) and the previous spin angle data φ(t-1) is defined as Δφ, and the corresponding generated optimized buffer value f(Δφ) can at least satisfy:
[0145]
[0146] Among them, a, b, and c are constants.
[0147] Furthermore, under normal circumstances, the detection image of the endoscope should be as follows Fig.12 As shown in (a), the output is in a rectangular or other set shape along the preset viewing angle direction. When there is a second movement component in the movement process of the endoscope, the viewing angle direction will be offset, and the endoscope will produce a deviation in the rotation angle φ, resulting in the appearance of Fig.12 (b) The situation shown in FIG. After implementing the endoscope calibration method of the present invention, it is possible to Fig.12 (c) shows the intermediate state, and the final correction is Fig.12 (d) shows the correct viewing angle direction. At this time, uneven black edges will appear due to the cutting based on the correction of the spin angle φ, resulting in poor overall display effect of the detected image. Therefore, another embodiment of the present invention provides an endoscope image correction method, such as Figure 3 , Fig.12 and Fig.13 As shown, the following steps can be used to solve the above technical problems and improve the overall display effect of the detection image.
[0148] Step 21, obtaining a current detection image and an acceleration information sequence corresponding to the current detection image.
[0149] Step 22, calculating the image correction factor corresponding to the current detection image according to the acceleration information sequence, obtaining the current correction factor, and determining whether the current posture information of the endoscope is included in the acceleration detection dead zone.
[0150] If not, jump and execute the following steps in sequence:
[0151] Step 231A, calling a preset image rotation function, using the current image information and the current correction factor as parameters, to calculate and generate an intermediate correction image;
[0152] Step 232A: extract at least a portion of the intermediate corrected image according to a preset mask to obtain a current corrected image.
[0153] If yes, jump to step 23B to correct the current detection image according to the first correction factor corresponding to the forward posture of the current posture of the endoscope.
[0154] The preset mask may be Fig.12As shown in (e), the edges are selectively hidden or shielded, and the middle part is retained to display the graphic template. The intermediate correction image and the current correction image can correspond to each other as follows Fig.12 (d) and Fig.12 (f) The step of "extracting according to a preset mask..." may be to selectively extract some pixels in the intermediate correction image and reorganize them to generate the current correction image, or to stack the preset mask and the intermediate correction image to form the current correction image.
[0155] In a preferred embodiment, the step 232A may further include the following steps.
[0156] Step 2321A, analyzing the size of the intermediate correction image, and setting the diameter of the preset mask according to the shorter side length of the intermediate correction image.
[0157] Step 2322A, align the geometric centers of the preset mask and the intermediate corrected image, traverse to obtain the pixel value difference set between the intermediate corrected image and the preset mask, set the pixel values in the pixel value difference set as preset hidden values, and obtain the current corrected image.
[0158] In this way, Fig.12 The intermediate corrected image shown in (d) and including the uneven black edges is formed according to the correction of the preset mask as shown in FIG. Fig.12 (f) shows the current corrected image, which has a uniform black border, and can bring better visual perception to medical workers. In addition, since the size of the preset mask is set according to the size of the intermediate corrected image, it can cope with a variety of image detection environments.
[0159] The "pixel value difference set" represents the set of pixels that exist in the pixel value set of the intermediate correction image but do not exist in the pixel value set of the preset mask. The preset hidden value can be 0, that is, the difference part is also set to black, and is consistent with other black edge parts, and finally forms the following Fig.12 (f) shows the current corrected image. It can be understood that when the edge of the image display effect in the intermediate corrected image 12 (d) is not displayed in black, the value of the preset hidden value can be adjusted to make the difference part consistent with the color of the edge, so as to achieve the hidden effect and improve the overall image perception.
[0160] Continuing, the extraction of the shorter side length can conveniently assist the endoscope calibration method to generate a mask of appropriate size to prevent the visible range in the final generated image from still having an irregular shape. Among them, it can be understood that the diameter refers to the diameter of the inscribed circle in the preset mask, and the size of the preset mask can be consistent with the intermediate correction image. Therefore, the inscribed circle in the preset mask can be consistent with the inscribed circle of the intermediate correction image in size. When the intermediate correction image is a rectangle, the inscribed circle can be a circle with the width of the rectangle (i.e., the shorter side length) as the diameter. Adaptive adjustment for other shapes is a prior art and will not be elaborated here.
[0161] In another embodiment of the present invention, an endoscope calibration method is provided, which can perform active verification before outputting the calibrated image, and select whether to output directly or after adjustment. Figure 3 and Fig.14 As shown, the method specifically includes the following steps.
[0162] Step 21, obtaining a current detection image and an acceleration information sequence corresponding to the current detection image.
[0163] Step 22, calculating the image correction factor corresponding to the current detection image according to the acceleration information sequence, obtaining the current correction factor, and determining whether the current posture information of the endoscope is included in the acceleration detection dead zone.
[0164] If not, jump to step 23A to correct the current detection image according to the current correction factor.
[0165] If yes, jump to step 23B to correct the current detection image according to the first correction factor corresponding to the forward posture of the current posture of the endoscope.
[0166] Step 31 , acquiring a previous detection image and a previous correction image corresponding to a previous posture of the endoscope, and a current detection image and a current correction image corresponding to a current posture of the endoscope.
[0167] Step 32, calculating the detection discrimination between the first detection image and the current detection image, and the correction discrimination between the first correction image and the current correction image, and determining whether the correction discrimination is less than or equal to the detection discrimination.
[0168] If yes, jump to step 33A to output the current corrected image.
[0169] If not, jump to step 33B to redetermine the current correction factor, obtain and output the redetermined current correction image.
[0170] In this way, the similarity or distinction between adjacent images before and after correction can be calculated. Taking into account the smaller movement amplitude at adjacent moments, the correspondingly smaller difference in picture content in the better case, thus, it can be used as a basis for judging the quality of the current correction effect, and selectively re-determine, update or optimize the correction factor to achieve better results.
[0171] Specifically, Definition I i is the pixel value of at least a part of the area in the current detection image, preferably, at least the pixel value of the circular part after mask processing; Definition I i-1 First, the pixel value of at least a part of the image is detected, preferably, at least the pixel value of the circular part after the mask processing. Based on this, the detection discrimination mse(I i ,I i-1 ) at least:
[0172]
[0173] Wherein, M is used to calculate the detection discrimination mse(I i ,I i-1 ), in this embodiment, the number of pixels located in at least a portion of the current detection image is equal to the number of pixels located in at least a portion of the previous detection image, and both are M. (x, y) are the corresponding position coordinates in the corresponding image. In addition, although the mean square error function (Mean Square Error) mse() is used in this embodiment to calculate the discrimination between the two, it will be appreciated by those skilled in the art that in other embodiments, other methods such as structural similarity index metric (SSIM) can also be used to complete a calculation process similar to the discrimination index. Of course, in order to adapt to the correction process of the above-mentioned viewing angle direction, it is preferably avoided to use a similarity calculation method with rotation invariance.
[0174] Define the pixel value I of the current detection image i , the pixel value of the current corrected image obtained by executing step 21 to step 23A or step 23B is I′ i , defined according to the pixel value I of the first monitored image i-1 , the pixel value of the first corrected image obtained by executing step 21 to step 23A or step 23B is I′ i-1 , then the correction discrimination mse(I′ i ,I′ i-1 ) at least meets
[0175]
[0176] Based on this, if mse(I′ i ,I′ i-1 )≤mse(I i ,I i-1 ), then the current corrected image is output (that is, the pixel value I′ of the current corrected image is output i ), if mse(I′ i ,I′ i-1 )>mse(I i ,I i-1 ), then, the current correction factor is re-determined, and the current corrected image corresponding to the re-determined correction factor is obtained and output.
[0177] The step of re-determining the current correction factor may be a step of updating and optimizing the correction factor by any of the above methods, or may be a step of weighted fusion of the current correction factor and the prior correction factor corresponding to the prior correction image, so as to obtain a re-determined and appropriate current correction factor to increase the visual coherence of the image. For example, in one embodiment, the current correction factor may be re-determined based on at least the current spin angle in the current correction factor and the prior spin angle in the prior correction factor.
[0178] Specifically, define the current spin angle as φ i , the first spin angle is φ i-1 , then the updated spin angle At least:
[0179]
[0180] Among them, η is a weight value, ranging from 0 to 1, preferably, it can be 0.5. At the same time, the above-mentioned inspection step can be performed before each output of the corrected image, or a special judgment logic can be set as a prerequisite for performing the above-mentioned steps. For example, in one embodiment, before step 31, the following steps may be included: obtaining and calculating the detection discrimination of the first detection image and the current detection image, and determining whether the detection discrimination is less than or equal to the preset discrimination threshold; if so, jump to step 31; if not, calculate and output the current corrected image.
[0181] It is worth noting that the method for correcting the detection image of an endoscope provided by the present invention mainly focuses on the correction at the output display level. When the method is carried out in a scenario where the action of the endoscope is controlled by a control device or other magnetic control equipment, the implementation of the action control is still based on the endoscope detection image data before the observation angle correction. This point should be known to those skilled in the art.
[0182] In summary, the endoscopic image correction method provided by the present invention calculates the image correction factor by simply analyzing the acceleration information of the endoscope, and reuses the acceleration information to further determine whether the current posture of the endoscope belongs to the acceleration detection dead zone with a large deviation of the image correction factor, so as to adopt different strategies for image correction accordingly. In this way, the hardware only requires the endoscope to be able to obtain acceleration information, which can adapt to the configuration requirements of low power consumption, low cost and small volume of sensors in the endoscope, and can deal with the dead zone problem occurring in the acceleration detection process, get rid of the limitation of needing other sensors such as gyroscopes for assistance, and can improve the correction accuracy and effect on the basis of maximizing the cost-benefit ratio, so that the detected image is always output in a unified direction.
[0183] It should be understood that although this specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
[0184] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. An endoscope image correction method, used to correct the direction of an endoscope detection image; The endoscopic image correction method comprises: Acquire a current detection image and an acceleration information sequence corresponding to the current detection image; Calculating an image correction factor corresponding to the current detection image according to the acceleration information sequence to obtain a current correction factor, and determining whether the current posture information of the endoscope is included in the acceleration detection dead zone; If not, correcting the current detection image according to the current correction factor; If so, correcting the current detection image according to a first correction factor corresponding to the forward posture of the current posture of the endoscope; The method specifically comprises: Generate a data information sequence according to the acceleration information sequence; wherein the data information sequence includes first direction data, second direction data and third direction data; Calculating the current correction factor according to the first direction data and the second direction data; Determining, according to the third orientation data, whether the current posture information is included in the acceleration detection dead zone; The method specifically comprises: Fitting acceleration coordinate points according to the first direction data and the second direction data; Performing a four-quadrant inverse tangent transformation on the acceleration coordinate point to obtain current spin angle data; Calculating the current correction factor according to the current spin angle data; The method specifically comprises: Calculating comprehensive speed data according to the first direction data, the second direction data and the third direction data; Performing an inverse cosine transform according to the comprehensive speed data and the third direction data to obtain angle data between the endoscope and the third direction in the current posture, and using the angle data as a current dead zone criterion value; If the current dead zone criterion value is less than the preset singular point value, it is determined that the current posture information is included in the acceleration detection dead zone range.
2. The endoscopic image correction method according to claim 1, characterized in that: The method specifically comprises: According to a preset filtering window, mean filtering is performed on the first acceleration sequence, the second acceleration sequence and the third acceleration sequence in the acceleration information sequence, respectively, to obtain the first direction data, the second direction data and the third direction data respectively, and to generate the data information sequence.
3. The endoscopic image correction method according to claim 1, characterized in that: The method specifically comprises: The current correction factor is obtained by calculating the sum of the opposite number of the current spin angle data and the preset angle offset data; wherein the angle offset data is used to define the direction of the observation angle.
4. The endoscopic image correction method according to claim 1, characterized in that: The method specifically comprises: Traversing forward posture information that is temporally preceding the current posture of the endoscope, and determining whether to update the current correction factor; If the forward posture information contains dead zone posture information within the acceleration detection dead zone, the first posture information closest to the current posture information in time is extracted, and the current correction factor is updated according to the direction deflection amount corresponding to the first posture information.
5. The endoscopic image correction method according to claim 4, characterized in that: The method specifically comprises: Taking the current posture information as a starting point, searching forward, when the dead zone criterion value corresponding to the forward posture information is found to be less than a preset singular point value, determining that there is dead zone posture information within the acceleration detection dead zone in the forward posture information; If the first posture information is included in the acceleration detection dead zone, the second correction factor corresponding to the second posture information of the endoscope and the first correction factor corresponding to the first posture information are extracted and calculated to obtain the directional deflection amount, and the current correction factor is updated according to the directional deflection amount; wherein the second posture is the previous posture of the first posture in time.
6. The endoscopic image correction method according to claim 4, characterized in that: The method further comprises: If the first posture information is not included in the acceleration detection dead zone, then while the endoscope continues to adjust its posture, the current correction factor is always updated according to the directional deflection amount of the corresponding previous posture information until the previous posture information is included in the acceleration detection dead zone, or the current posture information is included in the acceleration detection dead zone.
7. The endoscopic image correction method according to claim 1, characterized in that: The method specifically comprises: A preset logistic regression function is called to optimize the current correction factor according to the current correction factor and a previous correction factor corresponding to the forward posture information.
8. The endoscopic image correction method according to claim 7, characterized in that: The method specifically comprises: Calling the logistic regression function to calculate an optimized buffer value according to the current correction factor and the previous correction factor; The sum of the optimized buffer value and the first correction factor is used as the optimized current correction factor.
9. The endoscopic image correction method according to claim 7, characterized in that: The logistic regression function is a sigmoid function.
10. The endoscopic image correction method according to claim 1, characterized in that: The method specifically comprises: Calling a preset image rotation function, using the current image information and the current correction factor as parameters, respectively, to calculate and generate an intermediate correction image; At least a portion of the intermediate corrected image is extracted according to a preset mask to obtain a current corrected image.
11. The endoscopic image correction method according to claim 10, characterized in that: The method specifically comprises: Analyzing the size of the intermediate correction image, and setting the diameter of the preset mask according to the shorter side length of the intermediate correction image; The geometric centers of the preset mask and the intermediate corrected image are aligned, a pixel value difference set between the intermediate corrected image and the preset mask is obtained by traversing, and pixel values in the pixel value difference set are set as preset hidden values to obtain the current corrected image.
12. The endoscopic image correction method according to claim 1, characterized in that: The method specifically comprises: Acquire a previous detection image and a previous correction image corresponding to a previous posture of the endoscope, and a current detection image and a current correction image corresponding to a current posture of the endoscope; Calculating the detection discrimination between the first detection image and the current detection image, and the correction discrimination between the first correction image and the current correction image, and determining whether the correction discrimination is less than or equal to the detection discrimination; If it is less than or equal to, output the current corrected image; If it is greater than, the current correction factor is redetermined, and a redetermined current correction image is obtained and output.
13. An endoscope image correction system, characterized in that: It comprises an endoscope and a control device at least for correcting the direction of the detection image of the endoscope, wherein the control device is configured to execute the endoscope image correction method according to any one of claims 1 to 12.
14. A computer storage medium having an application program stored thereon, characterized in that: When the application is executed, the steps of the endoscopic image correction method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Diagnostic device for digestive ducts and method and system for adjusting viewing angle of display image of capsule endoscope
CN107361722A
Attitude adaptive correction method for IMU system
CN112729348A