A method and system for real-time image distortion correction in digestive endoscopy
By analyzing the gradient values and optical flow detection of digestive endoscopy images, the effects of digestive cavity peristalsis and contents are dynamically corrected, solving the problem of poor image distortion correction effect during digestive endoscopy and achieving more efficient real-time distortion correction.
Patent Information
- Application Number
- CN202610537323.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-22
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2046-04-22
AI Technical Summary
During the actual image acquisition process of digestive endoscopy, the continuous peristalsis of the digestive cavity and the interference of contents make it difficult for traditional static distortion correction templates to adapt to the real-time changing environment, resulting in poor real-time image distortion correction effect during digestive endoscopy.
By acquiring the current endoscopic image and its consecutive frames during digestive endoscopy, the gradient value of each pixel and the degree of influence of the contents are analyzed. Tangential distortion is determined by combining optical flow detection. A dynamic distortion correction method is adopted to quantify the influence of digestive cavity peristalsis and contents on the image and perform real-time distortion correction.
It effectively improves the distortion correction effect of real-time images during digestive endoscopy, adapts to the dynamic deformation of the digestive cavity and interference from contents, and improves the stability and accuracy of image distortion correction.
Smart Images

Figure CN122391037B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image correction technology, specifically to a method and system for real-time image distortion correction during gastrointestinal endoscopy. Background Technology
[0002] Due to optical equipment and other system factors, gastrointestinal endoscopic imaging systems may exhibit geometric distortion. To correct this distortion, image reconstruction techniques can be used to restore the distorted image to a near-realistic state. This typically involves geometric transformation of the image based on the intrinsic and extrinsic parameter models of the gastrointestinal endoscopic equipment, utilizing known optical distortion characteristics for correction.
[0003] To correct distortion in real-time images during gastrointestinal endoscopy, current techniques typically use static calibration templates. However, the continuous peristalsis of the digestive tract and the presence of contents (such as food residue and air bubbles) during actual image acquisition in gastrointestinal endoscopy cause unstable image distortion. Traditional static distortion correction templates are ill-suited to the changing real-time environment. In other words, static calibration methods cannot address the dynamic distortion problems caused by peristalsis and content interference during gastrointestinal endoscopy, resulting in poor distortion correction performance for real-time images during gastrointestinal endoscopy. Summary of the Invention
[0004] To address the aforementioned technical problem of poor real-time image distortion correction performance during gastrointestinal endoscopy, the present invention aims to provide a method and system for real-time image distortion correction during gastrointestinal endoscopy. The specific technical solution adopted is as follows: One embodiment of the present invention provides a method for real-time image distortion correction during gastrointestinal endoscopy, the method comprising the following steps: Acquire the current endoscopic image during a digestive endoscopy, and acquire several consecutive real-time endoscopic images preceding the current endoscopic image; Based on the gradient value of each pixel in the current endoscopic image, the degree of influence of the contents on each pixel in the current endoscopic image is determined; the degree of influence of the contents is at least used to characterize the obviousness of the bubble image features possessed by the pixel; Based on the positional changes of the same key point in the current endoscopic image and the several frames of real-time endoscopic images, determine the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristalsis rate; Distortion correction is performed on the current endoscopic image based on the degree of influence of the contents on each pixel in the current endoscopic image and the tangential distortion at the current gastrointestinal peristalsis rate.
[0005] Further, determining the degree of influence of contents on each pixel in the current endoscopic image based on the gradient value of each pixel in the current endoscopic image includes: Determine the gradient value of each pixel in the current endoscopic image; Based on the gradient value of each pixel, determine the gradient value fitting curve of the line connecting each pixel and its first minimum point; The degree of influence of the contents of each pixel is determined based on the curvature characteristics of the curve fitted to the gradient value corresponding to each pixel and the gradient value of each pixel within a preset neighborhood.
[0006] Further, determining the gradient value fitting curve of the line connecting each pixel to its first minimum point based on the gradient value of each pixel includes: For each pixel, if the gradient value of the pixel is the smallest in the preset neighborhood, then the pixel is taken as the first minimum point, and several first minimum points are obtained in the current endoscopic image. Connect each pixel to the nearest first minimum point to obtain the connection line for each pixel; Curve fitting analysis is performed based on the gradient values on the line connecting each pixel to obtain the gradient value fitting curve of the line connecting each pixel to its first minimum point.
[0007] Further, determining the degree of influence of the contents of each pixel based on the curvature characteristics of the curve fitted to the gradient value corresponding to each pixel and the gradient value of each pixel within a preset neighborhood range includes: For each pixel, the first derivative curve of the gradient value fitting curve corresponding to the pixel is obtained, and then the average slope value of the first derivative curve is calculated; the average slope value is used to characterize the texture change features when the pixel is close to the center of the content. The average gradient of a pixel within a preset neighborhood is calculated based on the gradient value of each pixel within that neighborhood; the average gradient is used to characterize at least the degree of barrel distortion within the preset neighborhood of the pixel. The average slope value and the average gradient value are fused to obtain the degree of influence of the contents of the pixel.
[0008] Further, determining the tangential distortion of each pixel in the current endoscopic image at the current digestive tract peristalsis rate based on the positional changes of the same key point in the current endoscopic image and the several frames of real-time endoscopic images includes: Acquire key points in the current endoscopic image and several frames of real-time endoscopic images, and record them as folds in the digestive tract; Optical flow field data in each frame of endoscopic image is obtained by optical flow detection. The positional change of each fold point in each frame of endoscopic image is determined and recorded as deformation. Curve fitting is performed on each deformation of the same fold point to obtain the deformation fitting curve. Based on the deformation fitting curve of each fold point, determine the peristaltic rate characterization value of the current digestive tract and the tangential distortion factor of each pixel point; The peristaltic rate characterization value and the tangential distortion factor of each pixel are fused to determine the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristaltic rate.
[0009] Furthermore, based on the deformation fitting curve for each fold point, the current peristaltic rate characterization value of the digestive tract is determined, including: Based on the deformation fitting curve of each fold point, select a number of creeping points from all fold points; Obtain the first distance value between each peristaltic point and the center of the digestive tract, and perform curve fitting on the intercept of the deformation fitting curve of each peristaltic point according to the numerical order of the first distance value to obtain the intercept fitting curve; Determine the second distance value between each first maximum point and its adjacent second minimum point on the intercept fitting curve, and perform curve fitting on all the second distance values to obtain the distance fitting curve; Calculate the absolute value of the average slope of the distance fitting curve, normalize the absolute value of the average slope, and obtain the current peristaltic rate characterization value of the digestive tract.
[0010] Furthermore, the step of selecting several creeping points from all wrinkled points based on the deformation fitting curve of each wrinkled point includes: For each fold point, obtain the first and second deformation variables of each second maximum point on the deformation fitting curve of the fold point; the first deformation variable is the deformation variable of the midpoint between the second maximum point and its nearest third minimum point, and the second deformation variable is the average value of all deformation variables between the second maximum point and its nearest third minimum point; The creep characteristic value of the fold point is determined based on the degree of similarity between the first and second deformation variables of each second maximum point; Several peristaltic points were selected based on the peristaltic characteristic value of each fold point.
[0011] Further, determining the creep characteristic value of the fold point based on the similarity between the first and second deformation variables of each of the second maximum points includes: Calculate the ratio of the first shape variable and the second shape variable at the same second maximum point, and then calculate the difference between the ratio and 1 to obtain the difference value for each second maximum point; The average of the difference values of all the second maximum points is obtained, and the average of the difference values is normalized by negative correlation to obtain a normalized value. The normalized value is determined as the creep characteristic value of the fold point.
[0012] Furthermore, based on the deformation fitting curve of each wrinkle point, the tangential distortion factor of each pixel is determined, including: Obtain the deformation difference between each second maximum point and its nearest third minimum point on the deformation fitting curve of the peristaltic point, and then calculate the average value of all the deformation differences as the peristaltic contraction index value of the peristaltic point; Based on the first distance value between each peristaltic point and the center of the digestive tract, cluster analysis is performed on all peristaltic points to obtain each peristaltic point cluster; Based on the difference between the peristaltic contraction index value of each peristaltic point and the peristaltic contraction index value of the peristaltic point cluster to which each peristaltic point belongs, the tangential distortion factor of the peristaltic point to which each pixel belongs is determined.
[0013] Another embodiment of the present invention provides a real-time image distortion correction system for digestive endoscopy, including a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement a real-time image distortion correction method for digestive endoscopy.
[0014] The present invention has the following beneficial effects: This invention provides a method and system for real-time image distortion correction during gastrointestinal endoscopy. By determining the degree of influence of contents and tangential distortion, it overcomes the shortcomings of traditional static distortion correction templates, which are difficult to adapt to real-time changing environments, and effectively improves the distortion correction effect of real-time images during gastrointestinal endoscopy. Based on the gradient value of each pixel in the current endoscopic image, the degree of influence of contents in the current endoscopic image is determined. This is used to quantify the influence of contents in the digestive cavity on the endoscopic image during actual image acquisition. By determining the degree of influence of contents, distortion correction is made applicable to the dynamic deformation problem caused by contents interference during gastrointestinal endoscopy, thus improving the image distortion correction effect. Based on the positional changes of the same key point in the current endoscopic image and several frames of real-time endoscopic images, the tangential distortion of each pixel in the current endoscopic image at the current gastrointestinal peristalsis rate is determined. This is used to quantify the influence of continuous peristalsis of the digestive cavity on the endoscopic image during actual image acquisition. By determining the tangential distortion, distortion correction is made applicable to the dynamic deformation problem caused by peristalsis of the digestive cavity during gastrointestinal endoscopy. Attached Figure Description
[0015] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 A flowchart illustrating a real-time image distortion correction method during gastrointestinal endoscopy, as provided in one embodiment of the present invention; Figure 2 This is a flowchart of step S2 in an embodiment of the present invention; Figure 3 This is a flowchart of step S3 in an embodiment of the present invention. Detailed Implementation
[0017] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the specific implementation methods, structures, features, and effects of the technical solution proposed according to the present invention are described in detail below with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. All data and information collected in this application have been obtained with full consent.
[0019] The application scenarios targeted by this invention can be: Current methods for distortion correction in digestive endoscopy images employ static calibration plates. However, unlike static calibration plates, the surfaces of digestive organs are non-planar and dynamically deformable. When the endoscope lens forms a non-perpendicular angle with the mucosal surface, real-time tangential distortion may occur. In such cases, traditional radial distortion correction models are completely ineffective. Furthermore, the flexibility of tissue surfaces leads to continuous changes in distortion patterns, resulting in poor real-time image distortion correction performance in current digestive endoscopy procedures.
[0020] To ensure the effectiveness of real-time image distortion correction during gastrointestinal endoscopy, one embodiment of the present invention provides a method for real-time image distortion correction during gastrointestinal endoscopy, such as... Figure 1 As shown, it includes the following steps: S1, acquire the current endoscopic image during digestive endoscopy, and acquire several consecutive real-time endoscopic images preceding the current endoscopic image.
[0021] Here, the current endoscopic image is the intraoperative image of the digestive endoscopy at the current moment, while the real-time endoscopic image is each frame of the intraoperative digestive endoscopy within the current time period other than the current moment, which is used to analyze the continuous peristaltic characteristics of the digestive cavity during the current time period. The current time period can be set to 1 minute, and the implementer can set it according to the specific actual situation without specific limitations.
[0022] As an exemplary implementation, real-time acquisition of intraoperative images during gastrointestinal endoscopy includes: In the dual-channel synchronous acquisition system, the main channel records six-degree-of-freedom pose in real time using an electromagnetic tracking endoscope, while the secondary channel acquires micron-level topological changes on the mucosal surface using a confocal microscopic endoscope. Simultaneously, a biodegradable fluorescently labeled grid is implanted within the phantom intestine, and a spatial coordinate system is established synchronously via external X-ray fluoroscopy. The spacing of the fluorescently labeled grid can be set to 0.2 mm.
[0023] Under strictly controlled lighting conditions, a known precise geometric pattern is fixed on a flat, rigid calibration plate. Then, the endoscope is systematically manipulated so that its tip faces or tilts toward the target at different orientations, distances, rotation angles, and insertion depths. At the same time, the endoscope's video acquisition system continuously or stepwise captures and synchronously stores real-time digestive endoscopy images of the target filling or partially filling the field of view without any in-machine processing, ensuring that the acquired digestive endoscopy images cover the entire edge and central area of the field of view.
[0024] The acquisition frequency of images during gastrointestinal endoscopy can be set to 30 frames per second; illumination conditions refer to the simulated endoscope light source environment; the front end refers to the lens; different orientations cover typical pitch and yaw angles; different distances cover the working distance range of the endoscope, such as 2mm to 50mm from the target surface; different rotation angles are usually rotated at 30° or 45° intervals along the endoscope axis; different insertion depths are used to simulate the actual propulsion state within the tube; the video acquisition system usually refers to a video acquisition card, which uses lossless or high-quality compression formats, such as PNG (Portable Network Graphic) or lossless TIFF (Tag Image File Format) / BMP (Bitmap) sequences, when storing images during gastrointestinal endoscopy.
[0025] Thus, this embodiment has obtained the current endoscopic image and several frames of real-time endoscopic images, which can be used to analyze the real-time bubble situation and the distortion caused by gastrointestinal peristalsis during the digestive endoscopy acquisition process.
[0026] S2, determine the degree of influence of the contents of each pixel in the current endoscopic image based on the gradient value of each pixel in the current endoscopic image.
[0027] During endoscopic examinations, some air bubbles may remain in the digestive tract. The curved surface of these bubbles refracts light, causing barrel distortion in localized areas of the endoscopic image. Since this barrel distortion changes continuously as the bubbles move, it can lead to errors during distortion correction. Therefore, bubble analysis is necessary based on the distortion changes in different locations within the current endoscopic image. Barrel distortion refers to the distortion of straight lines in the image, manifesting as a beaded chain appearance formed by the arrangement of air bubbles.
[0028] Here, the degree of influence of contents is used to characterize at least the degree of obviousness of the bubble image features of the pixel. The greater the degree of influence of contents, the greater the influence of bubbles in the digestive tract on the pixels in the current endoscopic image. The more closely the local area of the pixel conforms to the barrel distortion features caused by bubbles in the digestive tract, the greater the degree of image distortion correction of the current endoscopic image.
[0029] As an exemplary implementation, step S2 described above can be achieved through... Figure 2 The steps shown are to be implemented as follows: S21, Determine the gradient value of each pixel in the current endoscopic image.
[0030] In one embodiment, the gradient value of each pixel is calculated based on the grayscale value of each pixel in the current endoscopic image.
[0031] S22, based on the gradient value of each pixel, determine the gradient value fitting curve of the line connecting each pixel and its first minimum point.
[0032] Here, the first minimum point refers to the point where the gradient value of a pixel is the smallest within its preset neighborhood, which is used to characterize the bubble center; the gradient value fitting curve is used to analyze the texture changes of a pixel as it approaches the bubble center.
[0033] As an exemplary implementation, for each pixel, the gradient value fitting curve for that pixel is obtained, including: The first step is to take the pixel as the first minimum point if the gradient value of the pixel is the smallest in the preset neighborhood, and then obtain several first minimum points in the current endoscopic image.
[0034] In one embodiment, the preset neighborhood range can be an eight-neighborhood. Gradient values of a pixel and each pixel within its eight neighborhoods are obtained to form a gradient value sequence. If the gradient value of a pixel is the smallest in the gradient value sequence, then the pixel is taken as the first minimum point. Similarly, several first minimum points are obtained in the current endoscopic image.
[0035] The first minimum point can be characterized as the bubble center for the following reasons: Bubbles are usually round or elliptical. Due to light refraction, the bubble edge forms a dark ring structure with drastic grayscale changes, corresponding to a high gradient value region. Inside the bubble, the gas is uniformly distributed, with gradual or even constant grayscale changes, corresponding to a gradient value close to zero. Therefore, the contrast between the deep edges and bright center of the bubble makes the bubble center a local gradient minimum point. The pixel with the smallest gradient value within a preset neighborhood can be used as the first minimum point representing the bubble center.
[0036] The second step is to connect each pixel to the nearest first minimum point to obtain the connection line for each pixel.
[0037] In one embodiment, the target minimum point of each pixel is obtained, and each pixel is connected to its target minimum point to obtain a connection line for each pixel. The target minimum point is the first minimum point that is closest to the pixel, and different pixels can correspond to the same target minimum point.
[0038] The third step is to perform curve fitting analysis based on the gradient values on the line connecting each pixel to obtain the gradient value fitting curve of the line connecting each pixel to its first minimum point.
[0039] In one embodiment, the least squares method is used to perform curve fitting on the gradient values of all pixels along the connection of each pixel to obtain the gradient value fitting curve for each pixel.
[0040] The implementation process of the least squares method is existing technology and will not be elaborated here. Of course, implementers can also use other curve fitting methods, such as polynomial fitting, which are not specifically limited here.
[0041] S23, determine the degree of influence of the contents of each pixel based on the curvature characteristics of the curve fitted to the gradient value corresponding to each pixel and the gradient value of each pixel within the preset neighborhood.
[0042] As an exemplary implementation, for each pixel, the degree of influence of the content at that pixel is determined, including: The first step is to obtain the first derivative curve of the gradient value fitting curve corresponding to the pixel, and then calculate the average slope value of the first derivative curve.
[0043] Here, the average slope value is used to characterize the texture change features of a pixel when it is close to the center of the content, specifically referring to the center of the bubble.
[0044] In one embodiment, the first derivative curve of the gradient value fitting curve corresponding to the pixel is first obtained, then the slope values on the first derivative curve are obtained, and the average value of all slope values on the first derivative curve is calculated as the average slope value corresponding to the pixel.
[0045] In gastrointestinal imaging analysis, features such as air bubbles can cause barrel distortion. Quantifying this type of distortion requires analyzing slope changes to capture curvature characteristics, with the average slope of the first-order derivative curve being the preferred method. This is because barrel distortion involves the rate of change of local slope, and the average slope of the first-order derivative directly reflects this dynamic characteristic. The smaller the average slope value, the closer the pixel is to the center of the air bubble, and the sparser its texture, indicating that the pixel is affected by the air bubble, thus contributing to the barrel distortion.
[0046] The second step is to calculate the average gradient of the preset neighborhood of the pixel based on the gradient value of each pixel within the preset neighborhood.
[0047] Here, the gradient mean is used to characterize at least the degree of barrel distortion within a preset neighborhood of a pixel.
[0048] In one embodiment, the gradient value of each pixel within eight neighborhoods of a pixel is obtained, and the average gradient value of all pixels within eight neighborhoods is calculated to obtain the average gradient value of the eight neighborhoods of the pixel.
[0049] It should be noted that the bubble boundary exhibits a significant abrupt change in grayscale due to the reflection of the gas tissue interface, such as from dark to light, and the average gradient value increases, which characterizes the edge sharpness and texture richness. Therefore, the larger the average gradient value, the clearer the bubble outline and the more obvious the distortion effect.
[0050] The third step is to fuse the average slope value and the average gradient value to obtain the degree of influence of the content of the pixel.
[0051] In one embodiment, the degree of influence of the contents is negatively correlated with the average slope value and positively correlated with the average gradient value.
[0052] Negative correlation means that the larger the independent variable is, the smaller the dependent variable is, while positive correlation means that the larger the independent variable is, the larger the dependent variable is.
[0053] As an example, the formula for calculating the influence of the content at the u-th pixel can be: In the formula, This indicates the degree of influence of the contents at the u-th pixel. This represents the average gradient of the eight neighbors of the u-th pixel. This represents the average slope of the first derivative curve corresponding to the u-th pixel. This represents a non-zero constant, used to avoid the case where the denominator of a fraction is zero. An empirical value of 0.001 can be taken.
[0054] Formula for calculating the degree of impact of contents. It can also characterize the bubble coefficient of a pixel. The larger the value, the greater the average gradient value corresponding to the pixel. The smaller the average slope value, the more the pixel conforms to the bubble image characteristics, and the greater the influence of the barrel distortion caused by the bubble on the pixel.
[0055] Referring to the calculation process of the influence of the contents of the u-th pixel, the influence of the contents of each pixel in the current endoscopic image can be obtained.
[0056] Thus, this embodiment has obtained the degree of influence of the contents on each pixel in the current endoscopic image, which will be used to achieve distortion correction in the future.
[0057] S3. Based on the positional changes of the same key point in the current endoscopic image and several frames of real-time endoscopic images, determine the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristalsis rate.
[0058] First, it should be noted that the continuous peristaltic contractions of the digestive tract cause varying degrees of distortion when digestive endoscopy captures images of the digestive tract. Specifically, during peristalsis, the texture of the digestive tract wall and polyps may be stretched and deformed, resulting in image distortion and affecting image distortion correction. Therefore, it is necessary to analyze the real-time distortion impact on different parts of the image during the peristaltic contractions of the digestive tract, i.e., to perform a quantitative analysis of peristaltic distortion.
[0059] Here, the tangential distortion variable is used to characterize the effect of gastrointestinal peristalsis. The larger the tangential distortion variable, the greater the degree of distortion of the pixel caused by the influence of gastrointestinal peristalsis.
[0060] As an exemplary implementation, step S3 described above can be achieved through... Figure 3 The steps shown are to be implemented as follows: S31, acquire the key points in the current endoscopic image and several frames of real-time endoscopic images, and record them as folds in the digestive tract.
[0061] In one embodiment, deep learning is used to assist in acquiring key points in the current endoscopic image and each frame of real-time endoscopic images, and these key points are recorded as folds within the digestive tract. The process of acquiring these key points in the endoscopic images is existing technology and will not be described further here.
[0062] S32, optical flow detection is used to obtain optical flow field data in each frame of endoscopic image, the position change of each fold point in each frame of endoscopic image is determined and recorded as deformation, and curve fitting is performed on each deformation of the same fold point to obtain the deformation fitting curve.
[0063] Here, the change in position can characterize the magnitude of the change in image distance of the same fold point per unit time, which can reflect the deformation of different fold points during intestinal peristalsis.
[0064] In one embodiment, optical flow detection is used to acquire optical flow field data in consecutive frame images, tracking the positional change of each fold point in the image, denoted as deformation. The same fold point has corresponding deformation values in different endoscopic images; that is, one fold point corresponds to multiple deformation values. The implementation process of optical flow detection is prior art and will not be described in detail here.
[0065] In one embodiment, the least squares method is used to fit curves of each deformation at the same fold point to obtain the deformation fitting curve for each fold point.
[0066] S33, based on the deformation fitting curve of each fold point, determine the current peristaltic rate characterization value of the digestive tract and the tangential distortion factor of each pixel point.
[0067] Here, the peristalsis rate characterization value is used at least to characterize the current peristalsis speed of the digestive tract, and the tangential distortion factor is used at least to characterize the degree to which the pixel is affected by the peristalsis of the digestive tract.
[0068] As an exemplary implementation, step S33 above may include: S331, determine the current peristaltic rate characterization value of the digestive tract based on the deformation fitting curve of each fold point.
[0069] The first step is to fit a curve based on the deformation of each fold point and select several creeping points from all the fold points.
[0070] First, it should be noted that the human digestive tract usually maintains a relatively regular rhythm of contraction and peristalsis. Therefore, peristaltic points can be selected based on the regularity of expansion and contraction of each fold.
[0071] Here, peristaltic points refer to the folds in the digestive tract where obvious peristalsis occurs.
[0072] The first sub-step involves obtaining the first and second deformations of each second maximum point on the deformation fitting curve of each fold point.
[0073] Here, the second maximum point is the maximum point on the deformation curve, the first deformation is the deformation at the midpoint between the second maximum point and its nearest third minimum point, and the second deformation is the average of all deformations between the second maximum point and its nearest third minimum point.
[0074] In one embodiment, the maximum and minimum points on the deformation fitting curve of the fold point are obtained and denoted as the second maximum and the third minimum points; the nearest third minimum point is determined for each second maximum point to obtain the third minimum point corresponding to each second maximum point; the deformation of the midpoint between the second maximum point and its corresponding third minimum point is obtained and denoted as the first deformation, and the deformation of all data points between the second maximum point and its corresponding third minimum point is obtained, and the average value of the deformation of all data points is taken as the second deformation.
[0075] The second sub-step involves determining the creep characteristic value of the fold point based on the similarity between the first and second deformation variables of each second maximum point.
[0076] First, it should be noted that during intestinal peristalsis, the folds in the intestine will continuously expand and contract, resulting in the outward expansion and inward contraction of the folds, causing the deformation of the folds to continuously increase and decrease.
[0077] Here, the peristaltic characteristic value is used to characterize the regularity of the outward expansion and inward contraction of the fold point during peristalsis. The larger the peristaltic characteristic value, the greater the probability that the fold point belongs to the peristaltic point.
[0078] In one embodiment, the ratio of the first deformation variable and the second deformation variable at the same second maximum point is calculated, and then the difference between the ratio and 1 is calculated to obtain the difference value of each second maximum point; the average value of the difference values of all second maximum points is obtained, and the average value of the difference values is subjected to negative correlation normalization to obtain the normalized value, and the normalized value is determined as the creep characteristic value of the fold point.
[0079] As an example, the formula for calculating the creep characteristic value of the i-th fold point can be: In the formula, Let represent the creep eigenvalue of the i-th fold point, exp represent the exponential function with base e, exp(-) is used to handle negative correlation of the data, and J represent the number of second maxima points corresponding to the i-th fold point. This represents the first deformation of the j-th second maximum point corresponding to the i-th fold point. This represents the second shape variable corresponding to the j-th second maximum point of the i-th fold point. This represents the function for finding the absolute value.
[0080] In the formula for calculating the peristaltic characteristic value, The smaller, the more... The closer it is to 1, and The higher the similarity, that is, the closer the mean of the deformation of all data points between the second maximum and the third minimum is to the deformation of the midpoint between the second maximum and the third minimum, the greater the probability that the i-th fold point is in a regular creeping state, the greater the creeping characteristic value of the i-th fold point, and the greater the probability that the i-th fold point is a creeping point.
[0081] By referring to the calculation process of the peristaltic characteristic value of the i-th fold point, the peristaltic characteristic value of each fold point can be obtained.
[0082] The third sub-step involves selecting several peristaltic points based on the peristaltic characteristic value of each fold point.
[0083] In one embodiment, for the creep feature values of all fold points, the high-threshold portion is obtained by Otsu threshold segmentation and is used as the creep point.
[0084] In another embodiment, a peristaltic feature threshold is set, such as an empirical value of 0.7, and wrinkles with peristaltic feature values greater than the peristaltic feature threshold are taken as peristaltic points.
[0085] The peristalsis characteristic threshold can be set by the implementer according to the specific circumstances, and no specific limitation is made here.
[0086] The second step is to obtain the first distance value between each peristaltic point and the center of the digestive tract, and then perform curve fitting on the intercept of the deformation fitting curve of each peristaltic point according to the numerical order of the first distance value to obtain the intercept fitting curve.
[0087] First, it should be noted that since the contraction and peristalsis of the digestive tract are for the continuous transport of contents, the peristaltic effect of the digestive tract is transferable. The deformation of the peristaltic point will be continuously passed on. Therefore, the peristaltic rate characterization value is determined by analyzing the intercept of the fitting curve of the deformation of the peristaltic point.
[0088] As an exemplary implementation, obtaining the center of the digestive tract in the current endoscopic image includes: The first sub-step is to determine the pixel with the smallest gray level in the eight-neighborhood of each pixel in the current endoscopic image as the orientation pixel.
[0089] The second sub-step involves drawing a ray from the current pixel to the next pixel, resulting in a ray for each pixel.
[0090] The third sub-step involves identifying the pixel's grayscale value as the endoscopic image progresses deeper into the digestive tract until it reaches the end. This is because the pixel that passes through the most rays in the current endoscopic image is designated as the center of the digestive tract. In other words, the intersection of at least two rays is obtained, and the intersection with the most rays is taken as the center of the digestive tract.
[0091] In one embodiment, the Euclidean distance between each peristaltic point and the center of the digestive tract is determined as the first distance value; in order to facilitate subsequent analysis of the peristaltic transmission speed of the peristaltic points moving inward or outward, the values are arranged in descending order to obtain the sequence of the first distance values.
[0092] Among them, the first distance value sequence shows peristaltic points distributed towards the inside of the digestive tract, and the peristaltic speed of the peristaltic points closer to the center of the digestive tract is faster.
[0093] In another embodiment, the line connecting each peristaltic point to the center of the digestive tract is obtained, and the length of the line is used as the first distance value. It is worth noting that in this embodiment, the line connecting two points is represented as a line segment.
[0094] In one embodiment, the least squares method is used to fit the intercept of each creep point to obtain the intercept fitting curve.
[0095] The x-axis of the intercept fitting curve represents the first distance value of each creeping point, and the y-axis represents the intercept of the deformation fitting curve of each creeping point. The method for determining the intercept is existing technology and will not be elaborated here.
[0096] It should be noted that since the intercept of the curve at the peristaltic point reflects the peristaltic transmission characteristics of the peristaltic point, the intercept fitting curve can reflect the initiation sequence of contraction and peristalsis.
[0097] The third step is to determine the second distance value between each first maximum point and its adjacent second minimum point on the intercept fitting curve, and to perform curve fitting on all the second distance values to obtain the distance fitting curve.
[0098] Here, the first maximum point is used to characterize at least the maximum point located on the intercept fitting curve, and the second minimum point is used to characterize at least the minimum point located on the intercept fitting curve.
[0099] In one embodiment, each first maximum point and each second minimum point on the intercept fitting curve are obtained, and the Euclidean distance between the first maximum point and its nearest and adjacent second minimum point is calculated as the second distance value. The least squares method is used to perform curve fitting on all the second distance values to obtain the distance fitting curve.
[0100] The calculation processes for Euclidean distance and least squares method are existing technologies and will not be elaborated here.
[0101] It should be noted that the second distance value reflects the peristaltic transmission speed of the peristaltic point. As peristalsis continuously propagates into the digestive tract, the faster the peristaltic speed is displayed in the image, the smaller the distance between the first maximum point and the second minimum point will be.
[0102] The fourth step is to calculate the absolute value of the average slope of the fitted curve, normalize the absolute value of the average slope, and obtain the current peristaltic rate characterization value of the digestive tract.
[0103] Here, the average slope refers to the average of the slopes of all data points on the distance-fitted curve. When analyzing gastrointestinal motility, to ensure the numerical accuracy of the peristaltic rate representation, the absolute value of the average slope of the distance-fitted curve is taken.
[0104] Since the faster the contraction and peristalsis of the digestive tract, the faster the deformation transmission speed of the peristaltic points will be, the absolute value of the average slope of the distance fitting curve is obtained. The larger the absolute value of the average slope, the faster the transmission speed of the peristaltic points towards the interior of the intestine in the digestive tract, and the faster the peristalsis rate of the digestive tract. Therefore, the normalized value corresponding to the absolute value of the average slope can be used as the characterization value of the current peristalsis rate of the digestive tract.
[0105] In one embodiment, the normalization of the absolute value of the average slope can be achieved using the norm linear normalization function.
[0106] S332, determine the tangential distortion factor of each pixel based on the deformation fitting curve of each wrinkle point.
[0107] First, it should be noted that the distortion in different parts of the current endoscopic images is affected by the peristalsis of the digestive tract. When the intestinal wall of the digestive tract contracts unevenly or causes enhanced tangential distortion, and the more obvious the peristalsis of the digestive tract, the more obvious the tangential distortion.
[0108] As an exemplary implementation, determining the tangential distortion factor for each pixel includes: The first step is to obtain the deformation difference between each second maximum point and its nearest third minimum point on the deformation fitting curve of the creeping point, and then calculate the average value of all deformation differences as the creeping contraction index value of the creeping point.
[0109] Referring to step S331 above, each peristaltic point in the current endoscopic image can be obtained. Based on the deformation curve of the peristaltic point, the tangential distortion factor of each pixel can be determined.
[0110] Here, the peristaltic contraction index value is used at least to characterize the range of deformation of the peristaltic point as it expands and contracts during peristalsis.
[0111] It should be noted that the difference in deformation between each second maximum point and its nearest third minimum point reflects the fluctuation range of the deformation fitting curve, while the average of all deformation differences characterizes the overall contraction range of gastrointestinal peristalsis.
[0112] By referring to the calculation process of the peristaltic contraction index value of the above peristaltic point, the peristaltic contraction index value of each peristaltic point can be obtained.
[0113] The second step is to perform cluster analysis on all peristaltic points based on the first distance value between each peristaltic point and the center of the digestive tract, and obtain the clusters of each peristaltic point.
[0114] In one embodiment, based on the first distance value between each peristaltic point and the center of the digestive tract, the K-means clustering algorithm is used to cluster all peristaltic points to obtain each peristaltic point cluster.
[0115] The implementation process of the K-means clustering algorithm is existing technology and will not be described in detail here.
[0116] It should be noted that the more similar the distance between the peristaltic point and the center of the digestive tract, the greater the likelihood that the peristaltic point is located in the same circle of the digestive tract, and the more similar the peristaltic behavior of each peristaltic point in the same peristaltic point cluster.
[0117] The third step is to determine the tangential distortion factor of the peristaltic point to which each pixel belongs, based on the difference between the peristaltic contraction index value of each peristaltic point and the peristaltic contraction index value of the peristaltic point cluster to which each peristaltic point belongs.
[0118] Here, the peristaltic contraction index value of the peristaltic point cluster is equal to the average value of all peristaltic contraction index values within the peristaltic point cluster.
[0119] In one embodiment, the absolute value of the difference between the peristaltic contraction index value of a peristaltic point and the peristaltic contraction index value of the peristaltic point cluster to which the peristaltic point belongs is calculated, and the absolute value of the difference is used as the tangential distortion factor of the peristaltic point; based on the location of each peristaltic point in the current endoscopic image, a classification neural network is used to divide each pixel in the current endoscopic image to obtain the peristaltic point to which each pixel belongs, and then the tangential distortion factor of the peristaltic point to which each pixel belongs is determined.
[0120] The process of using a classification neural network to divide pixels is an existing technology and will not be described in detail here.
[0121] It should be noted that the larger the tangential distortion factor, the larger the creeping contraction range of the current pixel is compared with the creeping contraction range of its class, and the larger the tangential distortion factor of the creeping point to which the current pixel belongs.
[0122] S34, the peristaltic rate characterization value and the tangential distortion factor of each pixel are fused to determine the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristaltic rate.
[0123] In one embodiment, the product of the peristaltic rate characterization value and the tangential distortion factor is calculated as the tangential distortion variable of the corresponding pixel under the current gastrointestinal peristaltic rate, thereby obtaining the tangential distortion variable of each pixel in the current endoscopic image under the current gastrointestinal peristaltic rate.
[0124] Thus, this embodiment obtains the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristalsis rate, which is used to achieve image distortion correction.
[0125] S4. Based on the degree of influence of the contents of each pixel in the current endoscopic image and the tangential distortion under the current gastrointestinal peristalsis rate, perform distortion correction on the current endoscopic image.
[0126] In one embodiment, the product of the influence of contents on the same pixel in the current endoscopic image and the tangential distortion at the current gastrointestinal peristalsis rate is calculated. The normalized value obtained after normalizing the product is used as the comprehensive distortion of the corresponding pixel in the current endoscopic image. Based on the comprehensive distortion of each pixel in the current endoscopic image, an AI (Artificial Intelligence) scan is used to generate a heatmap of the distortion, and the corresponding formula is applied to stretch the pixel grid in sections. The AI checks whether the lesions in the current endoscopic image are deformed. If they are not qualified, the local rework is carried out to obtain the current endoscopic image after distortion correction.
[0127] As an exemplary implementation, determining the overall distortion of a pixel includes: The first step is to obtain the texture change index of the creep point to which each pixel belongs during the creeping process.
[0128] In one embodiment, the gradient variance value in the eight neighborhood of the peristaltic point is obtained, and then the least squares method is used to obtain the fitting curve of the gradient variance value of the peristaltic point in different frames of endoscopic images collected within the current preset time period, which is used as the gradient variance fitting curve; the variance of the gradient variance fitting curve is calculated as the texture change index of the peristaltic point during the peristaltic process.
[0129] It should be noted that the gradient variance of the creeping point reflects the texture of the creeping point, while the texture change index reflects the texture change of the creeping point during the creeping process.
[0130] The second step involves fusing the influence of the content, tangential distortion, and texture change index of the same pixel to obtain the comprehensive distortion of the pixel.
[0131] In one embodiment, the product of the content influence degree, tangential distortion, and texture change index of the same pixel is calculated, the product is normalized to obtain a normalized value, and the normalized value is used as the comprehensive distortion of the corresponding pixel in the current endoscopic image.
[0132] The above-mentioned normalization method for the product can be the hyperbolic tangent function. Of course, other normalization methods can also be used, and no specific limitation is made here.
[0133] As an example, the formula for calculating the comprehensive distortion of the u-th pixel in the current endoscopic image can be: In the formula, Let represent the overall distortion of the u-th pixel in the current endoscopic image, and let th represent the hyperbolic tangent function. This indicates the degree of influence of the contents at the u-th pixel in the current endoscopic image. This represents the tangential distortion of the u-th pixel in the current endoscopic image at the current gastrointestinal peristalsis rate. This represents the texture change index of the peristaltic point to which the u-th pixel in the current endoscopic image belongs during the peristaltic process.
[0134] It should be noted that the larger the overall distortion of a pixel, the greater the influence of bubbles on the pixel, the more obvious the tangential distortion, and the more obvious the texture change of the pixel. In other words, the greater the influence of distortion on the pixel, the larger the overall distortion of the pixel.
[0135] Furthermore, an artificial intelligence for polyp identification is used to scan the corrected current endoscopic image using a CNN (Convolutional Neural Network) model. If the lesion edges are blurred, the bubble region is recompressed; the edge region is locally stretched again. This process is repeated until the artificial intelligence is satisfied.
[0136] Thus, this embodiment achieves more effective real-time image distortion correction during gastrointestinal endoscopy.
[0137] Another embodiment of the present invention provides a real-time image distortion correction system for digestive endoscopy, including a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement a real-time image distortion correction method for digestive endoscopy.
[0138] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for real-time image distortion correction during digestive endoscopy, characterized in that, Includes the following steps: Acquire the current endoscopic image during a digestive endoscopy, and acquire several consecutive real-time endoscopic images preceding the current endoscopic image; Based on the gradient value of each pixel in the current endoscopic image, the degree of influence of the contents on each pixel in the current endoscopic image is determined; the degree of influence of the contents is at least used to characterize the obviousness of the bubble image features possessed by the pixel; Based on the positional changes of the same key point in the current endoscopic image and the several frames of real-time endoscopic images, determine the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristalsis rate; Based on the degree of influence of the contents on each pixel in the current endoscopic image and the tangential distortion under the current gastrointestinal peristalsis rate, the current endoscopic image is distorted. Based on the positional changes of the same key point in the current endoscopic image and several frames of real-time endoscopic images, the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristalsis rate is determined, including: Acquire key points in the current endoscopic image and several frames of real-time endoscopic images, and record them as folds in the digestive tract; Optical flow field data in each frame of endoscopic image is obtained by optical flow detection. The positional change of each fold point in each frame of endoscopic image is determined and recorded as deformation. Curve fitting is performed on each deformation of the same fold point to obtain the deformation fitting curve. Based on the deformation fitting curve of each fold point, determine the peristaltic rate characterization value of the current digestive tract and the tangential distortion factor of each pixel point; The peristaltic rate characterization value and the tangential distortion factor of each pixel are fused to determine the tangential distortion of each pixel in the current endoscopic image under the current gastrointestinal peristaltic rate.
2. The method for real-time image distortion correction during digestive endoscopy according to claim 1, characterized in that, The step of determining the degree of influence of contents on each pixel in the current endoscopic image based on the gradient value of each pixel in the current endoscopic image includes: Determine the gradient value of each pixel in the current endoscopic image; Based on the gradient value of each pixel, determine the gradient value fitting curve of the line connecting each pixel and its first minimum point; The degree of influence of the contents of each pixel is determined based on the curvature characteristics of the curve fitted to the gradient value corresponding to each pixel and the gradient value of each pixel within a preset neighborhood.
3. The method for real-time image distortion correction during digestive endoscopy according to claim 2, characterized in that, The step of determining the gradient value fitting curve of the line connecting each pixel to its first minimum point based on the gradient value of each pixel includes: For each pixel, if the gradient value of the pixel is the smallest in the preset neighborhood, then the pixel is taken as the first minimum point, and several first minimum points are obtained in the current endoscopic image. Connect each pixel to the nearest first minimum point to obtain the connection line for each pixel; Curve fitting analysis is performed based on the gradient values on the line connecting each pixel to obtain the gradient value fitting curve of the line connecting each pixel to its first minimum point.
4. The method for real-time image distortion correction during digestive endoscopy according to claim 3, characterized in that, The step of determining the degree of influence of the contents of each pixel based on the curvature characteristics of the curve fitted to the gradient value corresponding to each pixel and the gradient value of each pixel within a preset neighborhood range includes: For each pixel, the first derivative curve of the gradient value fitting curve corresponding to the pixel is obtained, and then the average slope value of the first derivative curve is calculated; the average slope value is used to characterize the texture change features when the pixel is close to the center of the content. The average gradient of a pixel within a preset neighborhood is calculated based on the gradient value of each pixel within that neighborhood; the average gradient is used to characterize at least the degree of barrel distortion within the preset neighborhood of the pixel. The average slope value and the average gradient value are fused to obtain the degree of influence of the contents of the pixel.
5. The method for real-time image distortion correction during digestive endoscopy according to claim 1, characterized in that, Based on the deformation fitting curve at each fold point, the current peristaltic rate characterization value of the digestive tract is determined, including: Based on the deformation fitting curve of each fold point, select a number of creeping points from all fold points; Obtain the first distance value between each peristaltic point and the center of the digestive tract, and perform curve fitting on the intercept of the deformation fitting curve of each peristaltic point according to the numerical order of the first distance value to obtain the intercept fitting curve; Determine the second distance value between each first maximum point and its adjacent second minimum point on the intercept fitting curve, and perform curve fitting on all the second distance values to obtain the distance fitting curve; Calculate the absolute value of the average slope of the distance fitting curve, normalize the absolute value of the average slope, and obtain the current peristaltic rate characterization value of the digestive tract.
6. The method for real-time image distortion correction during digestive endoscopy according to claim 5, characterized in that, The process of fitting a curve based on the deformation of each fold point to select several creeping points from all fold points includes: For each fold point, obtain the first and second deformation variables of each second maximum point on the deformation fitting curve of the fold point; the first deformation variable is the deformation variable of the midpoint between the second maximum point and its nearest third minimum point, and the second deformation variable is the average value of all deformation variables between the second maximum point and its nearest third minimum point; The creep characteristic value of the fold point is determined based on the degree of similarity between the first and second deformation variables of each second maximum point; Several peristaltic points were selected based on the peristaltic characteristic value of each fold point.
7. The method for real-time image distortion correction during digestive endoscopy according to claim 6, characterized in that, The step of determining the creep characteristic value of the fold point based on the similarity between the first and second deformation variables of each of the second maximum points includes: Calculate the ratio of the first shape variable and the second shape variable at the same second maximum point, and then calculate the difference between the ratio and 1 to obtain the difference value for each second maximum point; The average of the difference values of all the second maximum points is obtained, and the average of the difference values is normalized by negative correlation to obtain a normalized value. The normalized value is determined as the creep characteristic value of the fold point.
8. The method for real-time image distortion correction during digestive endoscopy according to claim 6, characterized in that, Based on the deformation fitting curve of each wrinkle point, the tangential distortion factor of each pixel is determined, including: Obtain the deformation difference between each second maximum point and its nearest third minimum point on the deformation fitting curve of the peristaltic point, and then calculate the average value of all the deformation differences as the peristaltic contraction index value of the peristaltic point; Based on the first distance value between each peristaltic point and the center of the digestive tract, cluster analysis is performed on all peristaltic points to obtain each peristaltic point cluster; Based on the difference between the peristaltic contraction index value of each peristaltic point and the peristaltic contraction index value of the peristaltic point cluster to which each peristaltic point belongs, the tangential distortion factor of the peristaltic point to which each pixel belongs is determined.
9. A real-time image distortion correction system for digestive endoscopy, characterized in that, It includes a processor and a memory, the processor being used to process instructions stored in the memory to implement a real-time image distortion correction method for digestive endoscopy as described in any one of claims 1-8.
Citation Information
Patent Citations
Image distortion removal method and system accompanying laparoscopic surgery stage
CN119006342A
Image value analysis method and system for massive images in alimentary canal
CN121837698A
