A method and system for processing images of gastric antral peristalsis based on a dual-lens endoscope capsule.
By acquiring video sequences of the gastric antrum using a dual-lens endoscope capsule and combining optical flow calculation and consistency analysis, the problem of insufficient accuracy in identifying gastric antrum peristalsis was solved, enabling automatic identification and counting of gastric antrum peristalsis in complex environments, thus improving the accuracy and stability of identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-09
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies struggle to accurately distinguish between gastric wall peristalsis and capsule movement under conditions of free movement of the endoscope capsule, resulting in insufficient accuracy and stability in identifying antral peristalsis. Furthermore, existing methods fail to fully utilize the multi-view imaging information of the dual-lens endoscope capsule.
A dual-lens endoscope capsule was used to acquire video sequences of the gastric antrum. Through optical flow calculation and consistency analysis, combined with temporal integrity determination, the peristalsis of the gastric wall and the movement of the capsule were distinguished, so as to realize the automatic and objective statistics of the number of peristalsis in the gastric antrum.
It significantly improves the accuracy and stability of gastric antral peristalsis image recognition, can accurately count the number of gastric antral peristalsis in complex motion environments, and has a high degree of automation and good interpretability.
Smart Images

Figure CN121482056B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and system for processing images of gastric antral peristalsis based on a dual-lens gastroscopy capsule, belonging to the field of medical image or video recognition and image data processing technology. Background Technology
[0002] Gastric antral peristalsis is an important physiological indicator reflecting gastric motility. Its frequency, rhythm, and intensity are significant for assessing gastric emptying function, diagnosing functional dyspepsia, and related diseases. Currently, the assessment of gastric antral peristalsis in clinical examinations mainly relies on manual observation and experience-based judgment by physicians based on gastroscopy or imaging data. This method is highly subjective, difficult to quantify and standardize, and inefficient in scenarios involving long-duration video or large-scale screening.
[0003] With the development of capsule endoscopy technology, capsule endoscopy has been increasingly used in gastric examinations due to its non-invasiveness and ease of operation. Compared with traditional endoscopy, capsule endoscopy operates freely within the gastric cavity, making it susceptible to the influence of factors such as the flow of gastric contents, gastric wall peristalsis, and changes in its own posture. This results in complex motions in the video image, including rotation, translation, and shaking. Particularly in the antral region, the gastric wall exhibits significant periodic non-rigid deformation, posing a considerable challenge to the objective identification and quantitative analysis of antral peristalsis.
[0004] To improve field of view coverage and imaging integrity, some gastroscopy capsules employ a dual-lens structure to image the gastric cavity. However, existing methods for analyzing antral peristalsis are mostly based on motion detection or feature extraction from single-view videos, failing to fully consider the multi-view information provided by dual-lens imaging. In practical applications, the capsule's own rotation or displacement often exhibits inconsistent motion characteristics in different lenses, while actual gastric wall peristalsis has a certain degree of temporal synchronicity and deformation correlation. Existing technologies fail to effectively utilize these characteristics, making it difficult to accurately distinguish between gastric wall peristalsis and capsule movement, thus affecting the accuracy and stability of peristalsis count statistics.
[0005] Furthermore, gastric antral peristalsis is a continuous, periodic physiological process, and localized movements in a single frame or within a short period of time cannot accurately represent a complete peristaltic event. Existing methods based on motion amplitude or thresholds are prone to misclassifying localized disturbances or incomplete movements as peristalsis, making it difficult to guarantee the reliability of statistical results. At the same time, manual annotation of peristaltic events is costly and inconsistent, which also limits the widespread application of related automated analysis methods in clinical settings.
[0006] Therefore, there is an urgent need for an automatic identification and counting method for gastric antral peristalsis in dual-lens gastroscopy capsule video, which can effectively distinguish between gastric wall peristalsis and capsule movement under complex motion interference conditions, and achieve objective and stable statistics on the number of gastric antral peristalsis based on temporal characteristics. Summary of the Invention
[0007] To address the shortcomings of existing technologies, which rely primarily on manual observation of gastric antral peristalsis, making objective quantitative assessment difficult, and the inability to distinguish between gastric wall peristalsis and capsule movement under conditions of free movement of the endoscope capsule, especially the failure of existing methods to fully utilize the multi-view imaging information of the dual-lens endoscope capsule, resulting in insufficient accuracy and stability of peristalsis recognition, this invention proposes a gastric antral peristalsis image processing method and system based on a dual-lens endoscope capsule. This method improves the accuracy and stability of gastric antral peristalsis image recognition and enables automatic, objective, and reliable statistics on the number of gastric antral peristalsis.
[0008] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0009] A method for processing images of gastric antral peristalsis based on a dual-lens endoscope capsule includes the following steps:
[0010] Step 1, Video Acquisition Step: Acquire the video sequence of the gastric antrum captured by the dual-lens endoscope capsule inside the human stomach; the dual lenses are a first lens and a second lens located at both ends of the endoscope capsule along its axis (the first lens and the second lens correspond to different viewpoints), and acquire images from the capsule's forward and backward viewpoints respectively.
[0011] Step 2, Motion Feature Acquisition Step: Motion information processing is performed on the video sequences from the first and second shots respectively to obtain motion features characterizing stomach wall deformation or image displacement;
[0012] Step 3, Dual-lens Consistency Analysis: Based on the motion characteristics of the first and second lenses, a consistency analysis is performed on the motion direction, trend, and periodic characteristics of the first and second lenses within the same time period. When the motion characteristics of the two lenses meet the preset consistency conditions, it is determined that there is a gastric antral peristalsis event within the corresponding time period, specifically including:
[0013] Assuming the first shot video sequence is The second-shot video sequence is Where x and y are pixel coordinates, and t is the frame time, for adjacent frames t and t +1, calculate the motion vector for each pixel using optical flow constraints. It satisfies the fundamental equation of optical flow: where V ( x, y, t ) is a pixel ( x, y In time t arrive t The motion vector between +1; u ( x, y, t ) represents the pixel in the horizontal direction ( x Displacement in the axial direction; v (x, y, t ) represents the pixel in the vertical direction ( y Displacement in the axial direction.
[0014] ;
[0015] Under the assumption of small displacement, the Taylor expansion can be used to approximate it as follows:
[0016] ;
[0017] in , , The images are respectively in x, y Partial derivative with respect to time, u and v Given the horizontal and vertical motion components of this pixel, the optical flow vector of the first lens can be obtained by solving the above equations. The optical flow vector of the second lens At every point in time t This corresponds to the position of each pixel in the image. x, y A two-dimensional motion vector field.
[0018] In each frame, the optical flow vector is statistically analyzed within the ROI region of the gastric antrum to obtain the comprehensive motion characteristics of each frame, such as the average motion amplitude or orientation histogram:
[0019] ;
[0020] Where N is the number of pixels within the ROI, ||·|| represents the vector magnitude, which can be used to characterize the motion intensity of each frame; v1(x,y,t) represents the pixel position (x,y) of the first shot at time t; v2(x,y,t) represents the pixel position (x,y) of the second shot at time t.
[0021] The motion features of the first and second shots are time-aligned, and the feature vectors at corresponding time points are obtained. For consistency determination, a consistency index C(t) can be defined:
[0022] ;
[0023] When C(t) is higher than the preset threshold θ, time point t is determined to be consistent motion; when several consecutive frames meet the consistency condition, it is marked as a candidate creep time period.
[0024] At the same time, the optical flow vector is smoothed and filtered to reduce the impact of noise on the consistency determination.
[0025] ;
[0026] Step 4, Timing Integrity Determination Step: Perform timing analysis on the gastric antral peristalsis events to determine whether they meet the timing characteristics requirements of a complete peristalsis cycle, so as to eliminate misjudgments caused by instantaneous disturbances or incomplete movements;
[0027] Step 5, Peristalsis Counting and Result Output: Based on the complete peristalsis cycle obtained from the determination, count the number of peristalsis in the gastric antrum and output the peristalsis parameter information.
[0028] In step one above, the gastric antrum video sequence is obtained by capturing images of the gastric environment, including the gastric antrum region, through a dual-lens endoscope capsule as it moves inside the human stomach, using a first lens and a second lens located at both ends of the capsule. The first and second lenses are imaging units corresponding to different viewpoints, used to acquire gastric wall image information from different directions.
[0029] The aforementioned dual lenses are positioned opposite each other along the capsule's axis, and are used to acquire images from the capsule's forward and backward perspectives, respectively. During video acquisition, the dual lenses perform synchronous or quasi-synchronous shooting at the same time reference to form time-corresponding dual-lens video frame pairs, thereby providing basic data for subsequent dual-lens motion consistency analysis.
[0030] The video sequence acquired by the dual lenses is a continuous multi-frame image data, containing image information of the gastric antrum region at different time points. In step one, the acquired gastric antrum video sequence can be the original image data or the preprocessed image data. The preprocessing includes, but is not limited to, image denoising, brightness correction, distortion correction, or image cropping.
[0031] In step two above, the motion feature acquisition step includes: processing the motion information of the gastric antrum video sequences acquired by the first and second shots respectively to obtain motion feature information reflecting the motion state of the gastric wall.
[0032] In step four above, the dual-lens consistency analysis does not simply compare the motion amplitude of the two videos. Instead, it constructs time-varying curves based on the optical flow characteristics of the two videos and performs correlation analysis on their changing trends. When the optical flow characteristics of the two videos simultaneously show increasing, peaking, and decreasing trends in the time dimension, it is determined that the change originates from gastric wall peristalsis. When only one video or the trend is inconsistent, it is determined to be non-peristaltic motion and is removed.
[0033] Through the above steps of optical flow calculation, feature extraction and consistency analysis, high-confidence candidate gastric antral peristalsis time periods can be obtained, providing reliable input for the temporal integrity determination in step four.
[0034] In step two above, motion information processing includes calculating the motion vector of each pixel or region in the image based on the pixel change relationship between adjacent video frames, thereby forming a motion feature field corresponding to each time period; the motion vector can be used to characterize the displacement, deformation or motion trend of the stomach wall during the shooting process.
[0035] In step two above, the motion features can also be obtained by feature point tracking or region matching of the video sequence to reflect the relative motion relationship of the stomach wall surface at different time points.
[0036] In step two above, the obtained motion features can be further filtered by region, retaining only motion information related to the gastric antrum region, and / or the motion features within the gastric antrum region can be weighted to reduce the impact of gastric contents disturbance or image noise on the motion analysis results.
[0037] In step two above, the obtained motion features include directional and amplitude information containing time information, which are used to characterize the direction of motion, trend of change and periodic characteristics, thereby providing basic data for subsequent dual-lens consistency analysis and creep determination.
[0038] In step three above, the dual-lens consistency analysis step includes: based on the motion characteristics obtained by the first lens and the second lens respectively, performing a joint analysis of the motion changes of the two lenses under the same time reference, so as to determine whether there are motion events caused by gastric wall peristalsis within the time period.
[0039] In step three above, the consistency analysis includes:
[0040] First, the motion features of the first shot and the second shot within the corresponding time period are time-aligned to construct a pair of motion features of two shots with a time correspondence.
[0041] Then, the motion direction and trend of the dual-lens motion feature pair are compared. When the motion features of the first lens and the second lens show similar change direction or change pattern in the same time period, it is determined that there are consistent motion features in that time period; otherwise, the corresponding dual-lens motion feature pair is removed.
[0042] Then, based on the different dual-lens motion characteristics, the periodicity of the motion characteristics of the first and second lenses is analyzed. When the first and second lenses detect periodic motion changes with temporal synchronization within the same time period, the periodic motion is determined to be a candidate gastric antral peristalsis event.
[0043] The time alignment can be achieved based on frame number, timestamp, or a preset synchronization strategy.
[0044] In step three above, the preset consistency condition is:
[0045] When the first shot and the second shot have the same direction of change or the same direction of change, they are considered similar; otherwise, they are considered to lack consistent motion features and the corresponding pair of two-shot motion features should be discarded.
[0046] When the images captured by the two lenses change in the same direction, it is considered that the first and second lenses detected periodic motion changes with temporal synchronization within the same time period; otherwise, it cannot be used as a candidate gastric antral peristalsis event.
[0047] To reduce the interference of capsule rotation, translation, or shaking on peristalsis determination, this application introduces a consistency threshold or correlation constraint in the dual-lens consistency analysis. Only when the motion characteristics of the dual lenses meet the preset consistency conditions will the corresponding time period be determined as a candidate gastric antrum peristalsis event.
[0048] Through the above dual-lens consistency analysis steps, it is possible to effectively distinguish between the actual deformation movement caused by gastric wall peristalsis and the non-peristaltic movement caused by the movement of the capsule itself or local disturbance, providing reliable candidate events for subsequent peristaltic cycle determination.
[0049] In step four above, the time sequence integrity determination step includes: performing time sequence analysis on the candidate gastric antrum peristalsis events obtained through dual-lens consistency analysis to determine whether the candidate events meet the time sequence characteristics requirements of a complete gastric antrum peristalsis cycle.
[0050] In step four above, the temporal integrity determination involves constructing a temporal change sequence of the motility features corresponding to gastric antral peristalsis events based on the changes over time, and then analyzing the temporal change sequence as follows:
[0051] Determine whether the time change sequence contains a complete and cyclical period. A complete period includes a contraction phase, a peak phase, and a relaxation phase that occur sequentially. If the cycle contains a complete period and the duration of the cycle meets a preset condition, the candidate peristaltic event is determined to be a complete gastric antral peristaltic cycle.
[0052] If a complete cycle is not included, and / or the cycle duration does not meet the preset conditions, it will be excluded.
[0053] In step four above, the temporal integrity determination includes a comprehensive judgment on the duration, magnitude of change, and trend of candidate peristaltic events, excluding abnormal motion events with too short a duration, discontinuous changes, or insufficient deformation magnitude.
[0054] In step four above, to improve the stability of the determination, the temporal integrity determination can be combined with a sliding time window and / or continuous frame analysis strategy to jointly analyze the motion characteristics in multiple adjacent time periods, thereby avoiding misjudging local disturbances or instantaneous motions as complete creeping cycles.
[0055] By using the above-mentioned steps to determine the integrity of the time sequence, it can be ensured that only motion events that conform to the characteristics of a complete physiological rhythm are included in the gastric antral peristalsis count, thereby improving the accuracy and reliability of the peristalsis counting results.
[0056] In step four above, the temporal integrity determination process is as follows: assuming the candidate event time period is... The combined motion characteristics of the first and second shots are respectively and It can fuse the features of two lenses into a single sequence:
[0057] ;
[0058] in The fusion weights can be adjusted according to the system configuration; in this example, they are set to 0.5. Characterizes the overall motion intensity of candidate events within a time period; where This represents the original motion intensity index corresponding to time t. This represents the smoothed motion intensity sequence after anti-interference processing, where k represents the half-width parameter of the smoothing window, which determines the number of time points before and after the average calculation.
[0059] Analyzing the time series F(t), we determine the three stages of creep:
[0060] Contraction phase: Exercise intensity gradually increases.
[0061] ;
[0062] Peak phase: Reaching a local maximum value:
[0063] ;
[0064] Relaxation phase: Exercise intensity gradually decreases.
[0065] ;
[0066] in , For the amplitude change threshold, This indicates the point in time when the gastric antrum begins to show obvious contractile movements. This indicates the point in time when the intensity of gastric wall movement reaches its maximum during a single peristalsis, used to distinguish between real peristalsis and noise disturbances. It can be set experimentally or dynamically adapted.
[0067] Define a function to determine the complete peristaltic cycle:
[0068] ;
[0069] like If the event passes the integrity check, it is considered a complete peristaltic cycle; otherwise, it is discarded. The output of step four is the set of all candidate events that pass the integrity check.
[0070] ;
[0071] in Indicates the i-th element from arrive The time period, this set will be used as input for step five, the counting of the number of peristalsis.
[0072] By using the above-mentioned temporal integrity determination, effective peristaltic events that conform to the physiological rhythm characteristics of gastric antrum peristalsis are screened out, providing a reliable basis for subsequent peristalsis count statistics and result output.
[0073] In step five above, the peristalsis counting and result output steps include: based on the complete gastric antrum peristalsis cycle determined by the temporal integrity judgment, the gastric antrum peristalsis cycle is statistically analyzed, and the result information related to gastric antrum peristalsis is output.
[0074] In step five above, the peristalsis counting and result output step includes: counting each event determined to be a complete antral peristalsis cycle, and calculating the corresponding number of antral peristalsis, peristalsis frequency, peristalsis cycle length, peristalsis intensity, and / or peristalsis occurrence time point based on a preset statistical time period or the entire video sequence, to reflect the rhythmic characteristics of antral peristalsis, and outputting the results; wherein, the peristalsis intensity parameter can be calculated based on the amplitude change, deformation magnitude, and duration of motion characteristics to reflect the degree of contraction of antral peristalsis. Specifically, counting each event i determined to be a complete antral peristalsis cycle is performed. The total number of peristalsis is obtained by summing them up. ; Calculate the length of each peristaltic cycle With peak peristalsis time point Calculate the creep intensity based on the amplitude change and duration; Based on the statistical time period or the entire video sequence, the system outputs the number of worm movements, frequency, cycle length, intensity, and occurrence time. α, β, γ This is the weighting coefficient; the other parameters have been explained above.
[0075] In step five above, the output results may include a consistency index or confidence score of the peristaltic features corresponding to the two lenses, used to characterize the reliability of the peristaltic counting results. The output results can be output or saved through a display terminal, data interface, or storage module.
[0076] A gastric antral peristalsis image processing system based on a dual-lens endoscope capsule includes:
[0077] The video acquisition module is used to acquire video sequences of the gastric antrum captured by the dual-lens gastroscopy capsule inside the human stomach; the dual lenses are a first lens and a second lens located at both ends of the gastroscopy capsule along its axis (the first lens and the second lens correspond to different perspectives), and respectively acquire images from the capsule's forward and backward perspectives.
[0078] The motion feature calculation module is used to process the motion information of the video sequences from the first and second shots respectively to obtain motion features that characterize stomach wall deformation or image displacement.
[0079] The dual-lens consistency analysis module is used to perform consistency analysis on the motion direction, change trend and periodic characteristics of the first and second lenses within the same time period based on the motion characteristics of the first and second lenses. When the motion characteristics of the dual lenses meet the preset consistency conditions, it is determined that there is a gastric antral peristalsis event within the corresponding time period.
[0080] The time-series analysis module is used to perform time-series analysis on gastric antral peristalsis events to determine whether they meet the time-series characteristics requirements of a complete peristalsis cycle, so as to eliminate misjudgments caused by instantaneous disturbances or incomplete movements.
[0081] The results output module is used to count the number of gastric antral peristalsis based on the complete peristalsis cycle obtained by the determination, and output peristalsis parameter information.
[0082] Any content not mentioned in the above system shall be implemented using a scheme consistent with the method.
[0083] Any techniques not mentioned in this invention are based on existing technologies.
[0084] This invention fully utilizes the multi-view imaging capabilities of a dual-lens endoscope capsule to automatically identify and count antral peristalsis in the complex intragastric environment. Compared to existing methods based on single-view video or simple motion analysis, this invention, through dual-lens motion consistency analysis, effectively suppresses interference caused by the capsule's own rotation, translation, or shaking, significantly improving the accuracy and stability of antral peristalsis image recognition.
[0085] Meanwhile, this invention introduces a temporal integrity determination mechanism to impose periodic and phased constraints on candidate peristaltic events, avoiding misjudging local disturbances or incomplete movements as peristalsis. This makes the statistical results of peristalsis counts more consistent with the true physiological rhythm characteristics of the gastric antrum. This method eliminates the need for manual frame-by-frame annotation, enabling objective and quantitative analysis of gastric antrum peristalsis while maintaining computational efficiency.
[0086] Furthermore, the number of peristalsis and related parameters output by this invention have good interpretability and are applicable to non-invasive examination devices such as dual-lens capsule endoscopy. Attached Figure Description
[0087] Figure 1 This is a schematic diagram of the overall process of a gastric antrum peristalsis image processing method based on a dual-lens endoscope capsule according to the present invention, including a video acquisition step, a motion feature calculation step, a dual-lens consistency analysis step, a temporal integrity determination step, and a peristalsis counting and result output step.
[0088] Figure 2 This is a schematic diagram of video acquisition and time alignment in a dual-lens gastroscopy capsule endoscopy, showing the video frame sequences acquired by the first and second lenses under the same time reference and their corresponding relationships.
[0089] Figure 3 This is a schematic diagram of dual-lens motion consistency analysis, showing the changes in motion characteristics of the first and second lenses within the corresponding time period, as well as the process of determining gastric antral peristalsis events based on dual-lens motion consistency.
[0090] Figure 4 The present invention provides a structural block diagram of a gastric antrum peristalsis image processing system based on a dual-lens endoscope capsule, comprising a video acquisition module, a motion feature calculation module, a dual-lens consistency analysis module, a time-series analysis module, and a result output module. Detailed Implementation
[0091] To better understand the present invention, the following embodiments further illustrate the content of the present invention, but the content of the present invention is not limited to the following embodiments.
[0092] Example 1
[0093] In this embodiment, as Figure 1 As shown, the image processing method for gastric antral peristalsis based on a dual-lens endoscope capsule includes the following steps:
[0094] Step 1: After the subject swallows the dual-lens endoscope capsule, it moves freely in the stomach along with the stomach contents and the peristalsis of the stomach wall. The first and second lenses, located at both ends of the capsule's axis, simultaneously or nearly simultaneously image the stomach environment, acquiring images from the capsule's forward and backward perspectives, respectively.
[0095] When the capsule is located in the gastric antrum region, the first and second lenses respectively acquire video image sequences containing gastric antrum wall motion information, and continuously output them according to a preset frame rate to form a first video sequence and a second video sequence corresponding to two perspectives. The frames in the video sequence are arranged in chronological order to characterize the morphological changes and motion state of the gastric antrum at different time points.
[0096] In this embodiment, the first video sequence and the second video sequence are wirelessly transmitted to an external receiving device in real time. The video sequences retain timestamp information during transmission or storage to facilitate subsequent time alignment processing of video frames from different perspectives.
[0097] By using the above method, a dual-view gastroscopy video sequence reflecting the peristaltic process of the gastric antrum within the same time period is obtained, providing basic data for subsequent motion feature extraction and peristalsis recognition.
[0098] Step 2: After completing the acquisition of the dual-lens gastric antrum video sequence described in Step 1, the acquired first and second video sequences are processed to extract motion information that can characterize the motion state of the gastric antrum wall.
[0099] Specifically, adjacent image frames in the first and second video sequences are analyzed to calculate the changes in the corresponding image regions over time, thereby obtaining motion features that reflect the movement trends of pixels or regions in the image. These motion features may include, but are not limited to, pixel-level or region-level motion vectors, displacement amplitudes, motion direction distributions, or comprehensive motion intensity indices.
[0100] In one implementation, the grayscale or brightness change between adjacent frames in the video sequence is calculated. Specifically, firstly, two adjacent frames are selected from the video sequence acquired by the endoscope capsule, and denoted as the t-th frame. and the image of frame t+1 Where (x, y) represents the pixel coordinates. Convert two frames to grayscale or extract the luminance channel, and calculate the grayscale change at the corresponding pixel positions: ,in Indicates time t arrive t The brightness change of this pixel is between +1 and +1; , These represent the grayscale or luminance values at the same pixel location in two adjacent frames. This yields a motion vector field representing the local motion of the image; based on the matching relationship between image blocks or feature regions, region-level motion displacement information is obtained.
[0101] To improve the stability and noise resistance of motion features, preprocessing operations can be performed on video frames before or during motion feature calculation. These preprocessing operations include, but are not limited to, image denoising, brightness normalization, contrast enhancement, or region cropping, to reduce the impact of gastric fluid reflection, bubbles, or noise on motion feature calculation.
[0102] Through the above processing, motion feature sequences corresponding to the first video sequence and the second video sequence are obtained respectively. The motion feature sequences are used to characterize the motion changes of the gastric antrum region over a continuous period of time, providing input data for subsequent dual-lens motion consistency analysis.
[0103] Step 3: After obtaining the motion feature sequences corresponding to the first video sequence and the second video sequence described in Step 2, a consistency analysis is performed on the motion features from different perspectives to distinguish between the actual gastric wall movement caused by antral peristalsis and the non-target movement caused by the movement of the capsule itself or environmental disturbances.
[0104] Specifically, based on the timestamp information retained in step one, such as Figure 2 As shown, motion features acquired by the first and second shots at the same or similar time points are time-aligned (in this example, based on timestamp alignment) to form corresponding dual-shot motion feature pairs. These dual-shot motion feature pairs are used to characterize the motion state of the gastric antrum region under different viewpoints within the same time period. The motion direction and trend of the dual-shot motion feature pairs are compared. When the motion features of the first and second shots exhibit similar directions or patterns of change within the same time period, it is determined that there are consistent motion features within that time period; otherwise, the corresponding dual-shot motion feature pair is discarded. Furthermore, the periodicity of the motion features of the first and second shots is analyzed based on different dual-shot motion feature pairs. When periodic motion changes with temporal synchronization are detected in the first and second shots within the same time period, the periodic motion is determined to be a candidate gastric antrum peristalsis event.
[0105] In this embodiment, to achieve the dual-lens motion consistency analysis in step three, optical flow is calculated between consecutive frames of the video sequences of the first and second lenses, and the actual peristalsis of the gastric antrum wall is analyzed using optical flow vectors. It should be noted that in the optical flow analysis process, this invention not only calculates the displacement amplitude of pixels but also statistically analyzes the directional distribution of optical flow vectors to distinguish between radial contraction motion and overall translational motion. For gastric wall deformation caused by antral peristalsis, the optical flow vector exhibits a consistent direction from the outside to the inside or from the inside to the outside in local areas, while the optical flow vector generated by the overall movement of the capsule shows a relatively consistent direction over a large area. By distinguishing between the two, the peristaltic characteristics of the gastric antrum are enhanced.
[0106] Assuming the first shot video sequence is The second-shot video sequence is ,in x, y For pixel coordinates, t For frame time, for adjacent frames t and t +1, calculate the motion vector for each pixel using optical flow constraints. It satisfies the fundamental equation of optical flow: whereV ( x, y, t ) is a pixel ( x, y In time t arrive t The motion vector between +1; u ( x, y, t ) represents the pixel in the horizontal direction ( x Displacement in the axial direction; v ( x, y, t ) represents the displacement of a pixel in the vertical direction (y-axis direction).
[0107] Under the assumption of small displacement, the Taylor expansion can be used to approximate it as follows:
[0108] ;
[0109] in , , The images are respectively in x, y Partial derivative with respect to time, u and v Given the horizontal and vertical motion components of this pixel, the optical flow vector of the first lens can be obtained by solving the above equations. The optical flow vector of the second lens At every point in time t This corresponds to the position of each pixel in the image. x, y A two-dimensional motion vector field.
[0110] In each frame, the optical flow vector is statistically analyzed within the ROI region of the gastric antrum to obtain the comprehensive motion characteristics of each frame, such as the average motion amplitude or orientation histogram:
[0111] ;
[0112] in N for ROI The number of pixels within the frame, where ||·|| represents the vector magnitude, is a feature that can be used to characterize the motion intensity of each frame. v 1 ( x, y, t This indicates that the first camera is located at pixel position (t) at time t. x, y ); v 2 ( x, y, t This indicates that the second lens is located at pixel position (t) at time t. x, y ).
[0113] The motion features of the first and second shots are time-aligned, and the feature vectors at corresponding time points are obtained. For consistency determination, a consistency index C(t) can be defined:
[0114] ;
[0115] When C(t) is higher than the preset threshold θ, time point t is determined to be consistent motion; when several consecutive frames meet the consistency condition, it is marked as a candidate creep time period.
[0116] At the same time, the optical flow vector is smoothed and filtered to reduce the impact of noise on the consistency determination.
[0117] ;
[0118] In dual-lens consistency analysis, it is not simply a matter of comparing the motion amplitude of the two videos. Instead, time-varying curves are constructed based on the optical flow characteristics of the two videos, and correlation analysis is performed on their changing trends. When the optical flow characteristics of the two videos simultaneously show trends of enhancement, peak, and weakening in the time dimension, it is determined that the change originates from gastric wall peristalsis. When only one video or the trend is inconsistent, it is determined to be non-peristaltic motion and is removed.
[0119] Through the above steps of optical flow calculation, feature extraction and consistency analysis, high-confidence candidate gastric antral peristalsis time periods can be obtained, providing reliable input for the temporal integrity determination in step four.
[0120] Step four: After obtaining the candidate time periods that meet the dual-lens motion consistency conditions described in step three, perform temporal integrity determination on the motion characteristics within each candidate time period to identify whether a complete gastric antral peristalsis cycle is constituted.
[0121] Gastric antral peristalsis exhibits a distinct physiological rhythm, characterized by a continuous contraction-peak-relaxation process over time. Therefore, this invention determines whether a complete gastric antral peristalsis cycle is constituted by analyzing the completeness of the optical flow characteristics over time, rather than the amplitude of movement at a single time point, thus avoiding misinterpreting local disturbances or instantaneous movements as peristalsis.
[0122] Assuming the candidate event time period is The combined motion characteristics of the first and second shots are respectively and It can fuse the features of two lenses into a single sequence:
[0123] ;
[0124] in The fusion weights can be adjusted according to the system configuration; in this example, they are set to 0.5. Characterizes the overall motion intensity of candidate events within a time period;
[0125] Analyzing the time series F(t), we determine the three stages of creep:
[0126] Contraction phase: Exercise intensity gradually increases.
[0127] ;
[0128] Peak phase: Reaching a local maximum value:
[0129] ;
[0130] Relaxation phase: Exercise intensity gradually decreases.
[0131] ;
[0132] in , For the amplitude change threshold, This indicates the point in time when the gastric antrum begins to show obvious contractile movements. This indicates the point in time when the intensity of gastric wall movement reaches its maximum during a single peristalsis, used to distinguish between real peristalsis and noise disturbances. It can be set experimentally or dynamically adapted.
[0133] Define a function to determine the complete peristaltic cycle:
[0134] ;
[0135] like If the event passes the integrity check, the candidate event is determined to be a complete peristaltic cycle; otherwise, it is discarded. The output of step four is the set of all candidate events that pass the integrity check.
[0136] ;
[0137] in Indicates the i-th element from arrive The time period, this set will be used as input for step five, the counting of the number of peristalsis.
[0138] By using the above-mentioned temporal integrity determination, effective peristaltic events that conform to the physiological rhythm characteristics of gastric antrum peristalsis are screened out, providing a reliable basis for subsequent peristalsis count statistics and result output.
[0139] Figure 1 The upper right corner displays heatmaps of the videos taken by camera A and camera B, respectively. The highlighted areas indicate changes between the current and previous frames. "Peristalsis" indicates whether there is stomach peristalsis in the current frame, "Number of Peristalsis" indicates the total number of stomach peristalsis events from the start of video playback to the current frame, A and B represent the motion amplitude of the areas captured by the two cameras, and "Intensity" is the calculated intensity of stomach peristalsis in the current frame. The statistical table in the lower right corner shows the trend of changes across all frames of the two cameras and the specific points where stomach peristalsis occurred.
[0140] Step 5: After completing the temporal integrity determination described in Step 4, perform statistical analysis and result output processing on the effective peristaltic events determined to be part of a complete gastric antral peristaltic cycle.
[0141] Specifically, the complete gastric antral peristalsis cycles obtained through step four are recorded in chronological order, and the number of complete peristalsis cycles occurring within a preset detection time range is accumulated to obtain the number of gastric antral peristalsis cycles within the corresponding time period. The detection time range can be the entire gastric examination process or a specific time interval set by the user or the system.
[0142] In addition to the number of peristalsis, based on the time-series curves corresponding to each complete peristalsis cycle, auxiliary parameters related to peristalsis are further calculated. These auxiliary parameters include, but are not limited to, peristalsis duration, peristalsis intensity variation, or peristalsis cycle distribution, in order to reflect the overall characteristic state of gastric antral peristalsis.
[0143] During the output process, the number of peristalsis and auxiliary parameters can be displayed graphically on the terminal device or stored as data in a storage medium for doctors to view, analyze, or use in subsequent clinical assessments. The output results can be associated with corresponding video time periods, allowing doctors to review the specific peristalsis process when needed.
[0144] Example 2
[0145] like Figure 4 As shown, a gastric antral peristalsis image processing system based on a dual-lens endoscope capsule includes:
[0146] The video acquisition module is used to acquire video sequences of the gastric antrum captured by the dual-lens gastroscopy capsule inside the human stomach; the dual lenses are a first lens and a second lens located at both ends of the gastroscopy capsule along its axis (the first lens and the second lens correspond to different perspectives), and respectively acquire images from the capsule's forward and backward perspectives.
[0147] The motion feature calculation module is used to process the motion information of the video sequences from the first and second shots respectively to obtain motion features that characterize stomach wall deformation or image displacement.
[0148] The dual-lens consistency analysis module is used to perform consistency analysis on the motion direction, change trend and periodic characteristics of the first and second lenses within the same time period based on the motion characteristics of the first and second lenses. When the motion characteristics of the dual lenses meet the preset consistency conditions, it is determined that there is a gastric antral peristalsis event within the corresponding time period.
[0149] The time-series analysis module is used to perform time-series analysis on gastric antral peristalsis events to determine whether they meet the time-series characteristics requirements of a complete peristalsis cycle, so as to eliminate misjudgments caused by instantaneous disturbances or incomplete movements.
[0150] The results output module is used to count the number of gastric antral peristalsis based on the determined complete peristalsis cycle and output the peristalsis parameter information. The rest are the same as in Example 1.
[0151] This invention employs a two-level judgment structure. First, it filters time periods that may contain gastric antral peristalsis by using the consistency of optical flow from dual lenses. Then, it confirms the complete peristalsis cycle by judging the temporal integrity. This ensures the accuracy of identification while improving the system's robustness to complex gastric motility environments.
[0152] In summary, this invention acquires video sequences of the gastric antrum from different perspectives using a dual-lens endoscope capsule, extracts gastric wall motion features by combining optical flow analysis, and achieves automatic identification and quantitative statistics of the number of gastric antrum peristalsis based on the consistency of motion and time sequence integrity of the dual lenses. This technical solution can effectively suppress interference caused by capsule movement, changes in perspective, and local disturbances in the complex gastric environment, improving the accuracy and stability of gastric antrum peristalsis image recognition.
[0153] Compared with existing methods that rely on manual observation or single-view video analysis, this invention does not require manual frame-by-frame annotation, and has the advantages of strong objectivity, good repeatability and high degree of automation. It can provide reliable quantitative evidence for gastric motility assessment and has good clinical application value.
[0154] It should be noted that the technical solution of the present invention has been described in detail above with reference to specific embodiments, but the protection scope of the present invention is not limited to the above-described embodiments. For those skilled in the art, equivalent transformations or substitutions made to the order of steps, parameter settings, or implementation methods without departing from the technical concept of the present invention should all fall within the protection scope of the present invention.
Claims
1. A method for processing images of gastric antral peristalsis based on a dual-lens endoscope capsule, characterized in that: Includes the following steps: Step 1, Video Acquisition Step: Acquire the video sequence of the gastric antrum captured by the dual-lens endoscope capsule inside the human stomach; the dual lenses are the first lens and the second lens located at both ends of the endoscope capsule along its axis, respectively acquiring images from the capsule's forward and backward perspectives; Step 2, Motion Feature Acquisition Step: Motion information processing is performed on the video sequences from the first and second shots respectively to obtain motion features characterizing stomach wall deformation or image displacement; Step 3, Dual-lens Consistency Analysis: Based on the motion characteristics of the first and second lenses, a consistency analysis is performed on the motion direction, trend, and periodic characteristics of the first and second lenses within the same time period. When the motion characteristics of the two lenses meet the preset consistency conditions, it is determined that there is a gastric antral peristalsis event within the corresponding time period, specifically including: Assuming the first shot video sequence is The second-shot video sequence is Where x and y are pixel coordinates, and t is the frame time. For adjacent frames t and t+1, the motion vector of each pixel is calculated using optical flow constraints. , where V(x,y,t) is the motion vector of pixel (x,y) between time t and t+1; u(x,y,t) is the displacement of the pixel in the horizontal direction; v(x,y,t) is the displacement of the pixel in the vertical direction; Under the assumption of small displacement, the Taylor expansion approximates it as follows: ; in , , Let be the partial derivatives of the image in the x, y, and time directions, respectively, and u and v be the horizontal and vertical motion components of the pixel. By solving the above equations, the optical flow vector of the first lens can be obtained. The optical flow vector of the second lens Specifically, it refers to the two-dimensional motion vector field corresponding to each pixel position (x,y) in the image at each time point t; In each frame, the optical flow vector is statistically analyzed within the ROI region of the gastric antrum to obtain the comprehensive motion characteristics of each frame, including the average motion amplitude or direction histogram: , ; Where N is the number of pixels within the ROI, ||·|| represents the vector magnitude, which is used to characterize the motion intensity of each frame; v1(x,y,t) represents the pixel position (x,y) of the first shot at time t; v2(x,y,t) represents the pixel position (x,y) of the second shot at time t. The motion features of the first and second shots are time-aligned, and the feature vectors at corresponding time points are obtained. For consistency determination, a consistency index C(t) is defined: ; When C(t) is higher than the preset threshold θ, time point t is determined to be consistent motion; when several consecutive frames meet the consistency condition, it is marked as a candidate creep time period. At the same time, the optical flow vector is smoothed and filtered to reduce the impact of noise on the consistency determination. ; in This represents the original motion intensity index corresponding to time t. This represents the smoothed motion intensity sequence after anti-interference processing, where k represents the half-width parameter of the smoothing window, which determines the number of time points before and after the average calculation. Step 4, Timing Integrity Determination Step: Perform timing analysis on the gastric antral peristalsis events to determine whether they meet the timing characteristics requirements of a complete peristalsis cycle, so as to eliminate misjudgments caused by instantaneous disturbances or incomplete movements; Step 5, Peristalsis Counting and Result Output: Based on the complete peristalsis cycle obtained from the determination, count the number of peristalsis in the gastric antrum and output the peristalsis parameter information.
2. The method for processing gastric antral peristalsis images based on a dual-lens endoscope capsule according to claim 1, characterized in that: In step two, motion information processing includes calculating the motion vector of each pixel or region in the image based on the pixel change relationship between adjacent video frames, thereby forming a motion feature field corresponding to each time period; the motion vector is used to characterize the displacement, deformation or motion trend of the stomach wall during the shooting process.
3. The method for processing images of gastric antral peristalsis based on a dual-lens endoscope capsule according to claim 1 or 2, characterized in that: In step two, the obtained motion features include directional and amplitude information containing time information, which are used to characterize the direction of motion, trend of change, and periodicity.
4. The method for processing gastric antral peristalsis images based on a dual-lens endoscope capsule according to claim 1 or 2, characterized in that: Step three, the consistency analysis includes: First, the motion features of the first shot and the second shot within the corresponding time period are time-aligned to construct a pair of motion features of two shots with a time correspondence. Then, the motion direction and trend of the dual-lens motion feature pair are compared. When the motion features of the first lens and the second lens show similar change direction or change pattern in the same time period, it is determined that there are consistent motion features in that time period; otherwise, the corresponding dual-lens motion feature pair is removed. Then, based on the different dual-lens motion characteristics, the periodicity of the motion characteristics of the first and second lenses is analyzed. When the first and second lenses detect periodic motion changes with temporal synchronization within the same time period, the periodic motion is determined to be a candidate gastric antral peristalsis event. The time alignment is achieved based on frame number, timestamp, or a preset synchronization strategy.
5. The method for processing images of gastric antral peristalsis based on a dual-lens endoscope capsule according to claim 1 or 2, characterized in that: In step four, the temporal integrity determination involves constructing a temporal change sequence of the motility features corresponding to gastric antral peristalsis events based on the changes over time, and then analyzing the temporal change sequence as follows: Determine whether the time change sequence contains a complete and cyclical period. A complete period includes a contraction phase, a peak phase, and a relaxation phase that occur sequentially. If the duration of the cycle meets a preset condition, the gastric antral peristalsis event is determined to be a complete gastric antral peristalsis cycle. If a complete cycle is not included, and / or the cycle duration does not meet the preset conditions, it will be excluded.
6. The method for processing gastric antral peristalsis images based on a dual-lens endoscope capsule according to claim 1 or 2, characterized in that: In step four, the temporal integrity determination process: assuming the candidate event time period is... The combined motion characteristics of the first and second shots are respectively and The features from two lenses are fused into a single sequence: ; in As the fusion weight, the sequence F(t) characterizes the overall motion intensity of the candidate event within the time period; Analyzing the time series F(t), we determine the three stages of creep: Contraction phase: Exercise intensity gradually increases. ; Peak phase: Reaching a local maximum value: ; Relaxation phase: Exercise intensity gradually decreases. ; in , For the amplitude change threshold, This indicates the point in time when the gastric antrum begins to show obvious contractile movements. This indicates the point in time when the intensity of stomach wall movement reaches its maximum during a single peristalsis, and is used to distinguish between real peristalsis and noise disturbance. Define a function to determine the complete peristaltic cycle: ; like If the event passes the integrity check, it is considered a complete peristaltic cycle; otherwise, it is discarded. The output of step four is the set of all candidate events that pass the integrity check. ; in Indicates the i-th element from arrive The time period, this set will be used as input for step five, the counting of the number of peristalsis.
7. The method for processing images of gastric antral peristalsis based on a dual-lens endoscope capsule according to claim 1 or 2, characterized in that: Step five, the peristalsis counting and result output steps include: based on the complete gastric antrum peristalsis cycle determined by the temporal integrity judgment, the gastric antrum peristalsis cycle is statistically analyzed, and the result information related to gastric antrum peristalsis is output.
8. The method for processing gastric antral peristalsis images based on a dual-lens endoscope capsule according to claim 7, characterized in that: Step five, the peristalsis counting and result output steps, include: counting each event determined to be a complete antral peristalsis cycle, and calculating the corresponding number of antral peristalsis, peristalsis frequency, peristalsis cycle length, peristalsis intensity, and / or peristalsis occurrence time point based on a preset statistical time period or the entire video sequence, and outputting the results; wherein, the peristalsis intensity parameter is calculated based on the amplitude change, deformation magnitude, and duration of motion characteristics to reflect the degree of contraction of antral peristalsis; specifically, counting each event i determined to be a complete antral peristalsis cycle. The total number of peristalsis is obtained by summing them up. ; Calculate the length of each peristaltic cycle With peak peristalsis time point Calculate creep intensity based on amplitude variation and duration. It outputs the number of worms, frequency, cycle length, intensity, and occurrence time based on the statistical time period or the entire video sequence, where α, β, and γ are weighting coefficients.
9. A gastric antral peristalsis image processing system based on a dual-lens gastroscopy capsule, characterized in that: include: The video acquisition module is used to acquire video sequences of the gastric antrum captured by the dual-lens gastroscopy capsule inside the human stomach; The dual lenses are a first lens and a second lens located at both ends of the axial direction of the gastroscopy capsule, which respectively acquire images from the forward and backward perspectives of the capsule. The motion feature calculation module is used to process the motion information of the video sequences from the first and second shots respectively to obtain motion features that characterize stomach wall deformation or image displacement. The dual-lens consistency analysis module is used to perform consistency analysis on the motion direction, trend of change, and periodic characteristics of the first and second lenses within the same time period, based on the motion characteristics of the first and second lenses. When the motion characteristics of the dual lenses meet the preset consistency conditions, it is determined that there is a gastric antral peristalsis event within the corresponding time period. Specifically: Assuming the first shot video sequence is The second-shot video sequence is Where x and y are pixel coordinates, and t is the frame time. For adjacent frames t and t+1, the motion vector of each pixel is calculated using optical flow constraints. Where V(x,y,t) is the motion vector of pixel (x,y) between time t and t+1; u(x,y,t) is the displacement of the pixel in the horizontal direction; and v(x,y,t) is the displacement of the pixel in the vertical direction. Under the assumption of small displacement, the Taylor expansion approximates it as follows: ; in , , Let be the partial derivatives of the image in the x, y, and time directions, respectively, and u and v be the horizontal and vertical motion components of the pixel. By solving the above equations, the optical flow vector of the first lens can be obtained. The optical flow vector of the second lens At each time point t, there is a two-dimensional motion vector field corresponding to each pixel position (x,y) in the image; In each frame, the optical flow vector is statistically analyzed within the ROI region of the gastric antrum to obtain the comprehensive motion characteristics of each frame, including the average motion amplitude or direction histogram: , ; Where N is the number of pixels within the ROI, ||·|| represents the vector magnitude, which is used to characterize the motion intensity of each frame; v1(x,y,t) represents the pixel position (x,y) of the first shot at time t; v2(x,y,t) represents the pixel position (x,y) of the second shot at time t. The motion features of the first and second shots are time-aligned, and the feature vectors at corresponding time points are obtained. For consistency determination, a consistency index C(t) is defined: ; When C(t) is higher than the preset threshold θ, time point t is determined to be consistent motion; when several consecutive frames meet the consistency condition, it is marked as a candidate creep time period. At the same time, the optical flow vector is smoothed and filtered to reduce the impact of noise on the consistency determination. ; The timing analysis module is used for timing integrity determination. It performs timing analysis on gastric antral peristalsis events to determine whether they meet the timing characteristics requirements of a complete peristalsis cycle, so as to eliminate misjudgments caused by instantaneous disturbances or incomplete movements. The results output module is used to count the number of gastric antral peristalsis based on the complete peristalsis cycle obtained by the determination, and output peristalsis parameter information.
10. The gastric antral peristalsis image processing system based on a dual-lens endoscope capsule according to claim 9, characterized in that: Temporal integrity determination process: Assume the time period of the candidate event is... The combined motion characteristics of the first and second shots are respectively and The features from two lenses are fused into a single sequence: ; in To fuse weights, sequences Characterizes the overall motion intensity of candidate events within a time period; Analyzing the time series F(t), we determine the three stages of creep: Contraction phase: Exercise intensity gradually increases. ; Peak phase: Reaching a local maximum value: ; Relaxation phase: Exercise intensity gradually decreases. ; in , For the amplitude change threshold, This indicates the point in time when the gastric antrum begins to show obvious contractile movements. This indicates the point in time when the intensity of stomach wall movement reaches its maximum during a single peristalsis, and is used to distinguish between real peristalsis and noise disturbance. Define a function to determine the complete peristaltic cycle: : like If the event passes the integrity check, it is considered a complete peristaltic cycle; otherwise, it is discarded. The output of step four is the set of all candidate events that pass the integrity check. ; in Indicates the i-th element from arrive The set will be used as input to the result output module for the specified time period.
Citation Information
Patent Citations
Capsule endoscope
CN109091097A
Capsule endoscope system and method for positioning through antenna matrix
CN119405251A