A gastric ulcer detection method combining endoscopic monitoring and image recognition technology
By combining endoscopic monitoring and image recognition technology with multi-frame image analysis of the positional stability and morphological factors of bright spot connected regions, the accuracy and robustness issues in gastric ulcer detection have been resolved, enabling precise identification and differentiation of gastric ulcer regions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING SHIKU TECH CO LTD
- Filing Date
- 2026-03-26
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies have low accuracy in detecting gastric ulcers and struggle to effectively overcome interference from factors such as endoscopic reflection and temporary mucosal abnormalities, leading to false positives and false negatives.
By combining endoscopic monitoring and image recognition technology, multiple consecutive frames of grayscale images of the stomach interior are acquired. The positional stability and morphological factors of bright spot connected regions are analyzed to determine ulcer factors and achieve accurate identification of gastric ulcer areas.
It significantly improves the accuracy and robustness of gastric ulcer detection, overcomes the problems of false positives and false negatives in traditional methods, and provides more reliable auxiliary diagnostic evidence.
Smart Images

Figure CN122243986A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically to a method for detecting gastric ulcers that combines endoscopic monitoring and image recognition technology. Background Technology
[0002] Gastric ulcer is a common digestive tract disease, and its early detection and diagnosis have a significant impact on treatment outcomes. Currently, in clinical diagnosis, endoscopic monitoring is the main method for observing the condition of the gastric mucosa and identifying ulcer areas. Doctors obtain images of the patient's stomach through endoscopy and make visual judgments.
[0003] With the development of image processing technology, attempts have been made to combine endoscopic images with computer-aided detection to improve the objectivity and efficiency of diagnosis. However, due to the complexity of the gastric environment and interference factors during image acquisition, existing technologies still face challenges in achieving stable and accurate automatic identification of gastric ulcers.
[0004] In existing technologies, images of the stomach's interior are typically acquired using an endoscope, and then image recognition technology is used to analyze and process these images to achieve automated or semi-automated detection of gastric ulcers. This method improves detection efficiency to some extent and reduces the reliance on subjective human judgment. However, to ensure clarity of observation, endoscopic equipment usually has a light source mounted on top. This light source easily produces reflections on the gastric mucosa. Additionally, the presence of polyps or other tissues within the stomach can lead to interference areas in the images that resemble the characteristics of gastric ulcers. This results in low accuracy and robustness in identifying gastric ulcers, making it difficult to effectively promote and apply in real-world clinical settings. Summary of the Invention
[0005] To address the technical problem of low accuracy in image recognition-based gastric ulcer detection, the present invention aims to provide a gastric ulcer detection method that combines endoscopic monitoring and image recognition technology. The specific technical solution adopted is as follows: Firstly, a method for detecting gastric ulcers combining endoscopic monitoring and image recognition technologies is provided. This method includes: acquiring multiple consecutive frames of raw images of the stomach interior and performing grayscale processing to obtain multiple consecutive frames of grayscale images; for each frame of grayscale image, determining bright spot connected components; for each frame of grayscale image except the last frame, determining the positional stability and morphological factor of each bright spot connected component, where positional stability characterizes the positional consistency of the bright spot connected component between the current frame and the next frame, and morphological factor characterizes the morphological structural features of the bright spot connected component in the current frame; determining an ulcer factor for each bright spot connected component based on its positional stability and morphological factor; and determining the gastric ulcer region based on the multiple ulcer factors corresponding to each bright spot connected component.
[0006] In one possible design, determining the positional stability of each bright spot connected region includes: for each bright spot connected region, determining multiple internal edge connections of the bright spot connected region and corresponding external edge connections for each internal edge connection. The internal edge connections are the lines connecting the centroid of the bright spot connected region to the pixels on the edges of the bright spot connected region, and the external edge connections are the straight lines formed by multiple pixels extending from the internal edge connections outwards from the bright spot connected region. Based on the grayscale values of each pixel on each internal edge connection and its corresponding external edge connection, determining the edge difference parameter corresponding to each pixel on the edge of the bright spot connected region. In the next frame of grayscale image, determining the matching connected region corresponding to the bright spot connected region in the current frame of grayscale image. Based on the edge difference parameter and grayscale value corresponding to each pixel on the edge of the bright spot connected region in the current frame of grayscale image, and the edge difference parameter and grayscale value corresponding to the same pixel on the edge of the matching connected region in the next frame of grayscale image, determining the positional stability of each bright spot connected region.
[0007] In one possible design, determining the matching connected component in the next frame of grayscale image that corresponds to the bright spot connected component in the current frame of grayscale image includes: for each bright spot connected component in the current frame of grayscale image, determining a candidate connected component based on the distance between it and each bright spot connected component in the next frame of grayscale image; and determining the matching connected component based on the similarity between the bright spot connected component and the candidate connected component.
[0008] In one possible design, determining the morphological factor of each bright spot connected region includes: determining structural feature parameters based on the edge roughness of the bright spot connected region and the gray-scale distribution characteristics of multiple internal edge connections; determining the color difference factor of the bright spot connected region based on the color difference between the surrounding region and the tissue region in the original image, where the surrounding region is the region other than the bright spot connected region within the smallest bounding circle of the bright spot connected region, and the tissue region is the region other than the smallest bounding circle of the bright spot connected region in the original image; and determining the morphological factor of the bright spot connected region based on the structural feature parameters and the color difference factor.
[0009] In one possible design, determining the edge roughness of a bright spot connected region includes: obtaining an edge chain code sequence of the bright spot connected region; determining the absolute value of the difference between adjacent chain code values in the edge chain code sequence to obtain an absolute difference sequence; and determining the edge roughness based on the absolute difference sequence.
[0010] In one possible design, the grayscale distribution characteristics of multiple internal edge connections are determined, including: for each internal edge connection, determining the grayscale value sequence of each pixel on the internal edge connection; performing quadratic curve fitting based on the grayscale value sequence to obtain the corresponding fitting curve; and determining the quadratic coefficient of each fitting curve as the grayscale distribution characteristic of the internal edge connection, wherein the quadratic coefficient is used to characterize the degree of concavity of the grayscale value distribution on the internal edge connection.
[0011] In one possible design, the color difference factor of the bright spot connected region is determined based on the color difference between the surrounding area and the tissue area in the original image, including: determining the color difference factor based on the red channel pixel value of each pixel in the surrounding area and the red channel pixel value of each pixel in the tissue area.
[0012] In one possible design, the gastric ulcer region is determined based on multiple ulcer factors corresponding to each bright spot connected region, including: for each bright spot connected region, if the ulcer factors in a consecutive preset number of frames are all greater than a preset ulcer threshold, the bright spot connected region is determined to be a gastric ulcer region.
[0013] In one possible design, determining the bright spot connected components in a grayscale image includes: performing edge detection on the grayscale image to obtain edge information; determining connected regions in the grayscale image based on the edge information; and identifying regions in the connected regions whose average grayscale value is higher than a preset grayscale threshold as bright spot connected components.
[0014] In one possible design, the gastric ulcer detection method combining endoscopic monitoring and image recognition technology further includes: determining the location information of the gastric ulcer region in a grayscale image; and visually marking the gastric ulcer region in the original image based on the location information.
[0015] The present invention has the following beneficial effects: In the gastric ulcer detection method combining endoscopic monitoring and image recognition technology provided by this invention, the dynamic positional stability characteristics of bright spot connected regions in multiple frames of images and the spatial morphological structure characteristics in a single frame of images are comprehensively analyzed and fused. This achieves accurate identification and differentiation of gastric ulcer regions, effectively overcoming the problems of false detection and missed detection caused by factors such as endoscopic reflection and temporary mucosal abnormalities in traditional single-frame image analysis methods. It significantly improves the accuracy and robustness of automatic gastric ulcer detection. At the same time, the interpretability and clinical applicability of the detection results are enhanced through quantitative evaluation and multi-frame consistency verification mechanisms, providing more reliable auxiliary diagnostic basis. Attached Figure Description
[0016] 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.
[0017] Figure 1 This is a schematic flowchart of a gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to an embodiment of the present invention. Figure 2 This is a schematic flowchart of a gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to an embodiment of the present invention. Figure 3 This is a schematic flowchart of a gastric ulcer detection method combining endoscopic monitoring and image recognition technology, provided in one embodiment of the present invention. Detailed Implementation
[0018] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a gastric ulcer detection method combining endoscopic monitoring and image recognition technology proposed according to the present invention. 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.
[0019] In embodiments of the present invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in embodiments of the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0020] In the description of this invention, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" and "more than one" refer to two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0021] 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.
[0022] The following description, in conjunction with the accompanying drawings, details a specific scheme for a gastric ulcer detection method combining endoscopic monitoring and image recognition technology provided by the present invention.
[0023] Please see Figure 1 The diagram illustrates a flowchart of a gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to an embodiment of the present invention, including steps S101-S105.
[0024] S101. Obtain multiple consecutive frames of raw images of the stomach interior and perform grayscale processing to obtain multiple consecutive frames of grayscale images.
[0025] One possible approach is to acquire raw images of the patient's stomach using an endoscopic device. This device consists of an endoscopic catheter, a front-end camera, a light source assembly, and other auxiliary components. The image acquisition frequency can be set to 15-30 frames per second, depending on requirements. Each acquired frame of the raw color image is then converted to grayscale. For example, a weighted average method can be used to convert the RGB (red, green, blue) three-channel data of the raw color image into single-channel grayscale values, thus obtaining a grayscale image corresponding to each frame of the raw image.
[0026] For example, the grayscale conversion formula is as follows: ,in, The grayscale value of the pixel is obtained after grayscale processing, and the value ranges from 0 to 255. This represents the red channel pixel value of that pixel in the original image. This represents the green channel pixel value of that pixel in the original image. The value is the blue channel pixel value of this pixel in the original image. 0.299, 0.587, and 0.114 are the weighting coefficients for the red, green, and blue channels, respectively. This coefficient setting conforms to the human eye's color perception characteristics and can preserve the gray-scale difference characteristics of gastric mucosal tissue and potential lesion areas to the greatest extent.
[0027] In some embodiments, the gray values of pixels can be further normalized based on the ratio of the gray value of each pixel in the grayscale image to 255.
[0028] In some embodiments, before acquiring raw images of the patient's stomach using an endoscopic device, the patient is required to fast for 6-8 hours to ensure that there is no food or liquid residue in the stomach, thus avoiding obstruction of the gastric mucosa and affecting the image acquisition effect. Depending on the patient's tolerance and examination needs, local anesthesia or mild sedation may be administered to the patient to improve the comfort and cooperation of the examination process. At the same time, the endoscopic device, including the endoscopic catheter, front-end camera, light source assembly, and auxiliary accessories, undergoes comprehensive aseptic disinfection to avoid the risk of cross-infection.
[0029] In some embodiments, after grayscale processing of the original image, the RGB channel data of the original image are retained for subsequent calculation and analysis.
[0030] S102. For each frame of grayscale image, determine the bright spot connected components in the grayscale image.
[0031] As one possible implementation, an image edge detection algorithm is used to obtain boundary differentiation information of different regions in a grayscale image, i.e., edge information. Based on this edge information, adjacent pixels with similar grayscale features in the image are divided into independent sets of continuous pixels, i.e., connected regions. Then, each connected region is filtered by a preset grayscale judgment standard, and connected regions that meet the grayscale features of gastric ulcers and related interference regions are retained and defined as bright spot connected regions. The bright spot connected regions cover gastric ulcer candidate regions, light spot regions formed by reflections from endoscopic light sources, and non-ulcer lesion regions such as polyps.
[0032] In some embodiments, determining the bright spot connected region in a grayscale image can also involve first performing noise reduction preprocessing on the grayscale image to remove random noise interference generated during image acquisition, then using global threshold segmentation technology to initially screen out pixels with grayscale values higher than a preset initial threshold, performing 8-neighborhood or 4-neighborhood connectivity analysis on these pixels, forming a connected region from a set of consecutive pixels, and directly determining the connected region as the bright spot connected region.
[0033] It should be noted that gastric ulcers are typically irregular and raised growths, and the base of the ulcer may often be covered with a white or yellow pseudomembrane composed of necrotic tissue, bacteria, fibrin, etc., with signs of bleeding around it. Therefore, in grayscale images, the gastric ulcer portion will appear with a higher grayscale value. Furthermore, because endoscopic equipment is equipped with a light source component for easier observation, the light source component reflects light onto the gastric mucosa, producing a light spot, which will also appear with a higher grayscale value. Therefore, the subsequent steps of this invention can be used to detect gastric ulcers by analyzing the connected regions of the bright spot to identify gastric ulcer areas with higher confidence.
[0034] S103. For each grayscale image except the last frame in a series of consecutive grayscale images, determine the position stability and morphological factor of each bright spot connected region.
[0035] Among them, position stability is used to characterize the positional consistency of the bright spot connected region in the current frame grayscale image and the next frame grayscale image, and morphological factor is used to characterize the morphological structural features of the bright spot connected region in the current frame grayscale image.
[0036] One possible implementation involves first determining the internal edge connection between the centroid of each bright spot connected region and the edge pixels, as well as the external edge connection formed by extending the internal edge connection outwards. Edge difference parameters are obtained by analyzing the pixel grayscale features on these two types of connections. Then, in the next frame of grayscale image, a matching connected region corresponding to the current bright spot connected region is matched. Position stability is quantized by comparing the edge difference parameters and grayscale values of the corresponding pixels in the current frame and the next frame. Here, the internal edge connection is the line connecting the centroid of the bright spot connected region to the pixels on the edge of the bright spot connected region, and the external edge connection is a straight line formed by extending the internal edge connection outwards from the bright spot connected region by multiple pixels.
[0037] It should be noted that the specific implementation of determining the position stability of each bright spot connected region based on the above method can be referred to the description of steps S201-S204 in the subsequent embodiments of the present invention, and will not be repeated here.
[0038] In some embodiments, the positional stability of each bright spot connected region can be determined, and the positional stability can also be quantified based on the centroid offset distance and area change of the bright spot connected region. Specifically, the centroid coordinates and area of the bright spot connected region in the current frame grayscale image are determined, the centroid coordinates and area of the bright spot connected region in the next frame grayscale image are determined, the offset distance is determined based on the centroid coordinates in the two grayscale images, and the area change is determined based on the difference between the two areas. The positional stability is further determined based on the offset distance and the area change. The positional stability is negatively correlated with the offset distance and the area change. The smaller the offset distance and the area change, the higher the positional stability of the bright spot connected region.
[0039] In some embodiments, determining the positional stability of each bright spot connected region can also be achieved by aligning the current frame grayscale image and the next frame grayscale image using a preset image registration algorithm, determining the overlap area ratio of the two bright spot connected regions in the two grayscale images, and further combining the difference in the mean grayscale values of the two bright spot connected regions within the overlap area to obtain the overall positional stability. The positional stability is positively correlated with the overlap area ratio and negatively correlated with the difference in the mean grayscale values of the two bright spot connected regions within the overlap area.
[0040] When determining the morphological factors of the bright spot connected region, the edge roughness of the bright spot connected region is first analyzed by edge chain code. Combined with the gray-level distribution characteristics on the internal edge connection lines, structural feature parameters characterizing the internal concavity and edge regularity of the connected region are obtained. Then, the surrounding area corresponding to the minimum circumcircle of the bright spot connected region is divided into the tissue area of the rest of the image. By analyzing the difference in the red channel pixel values of the two types of regions in the original image, the color difference factor characterizing the redness and swelling of the surrounding tissue is obtained. Finally, the structural feature parameters and the color difference factor are integrated to obtain the morphological factor.
[0041] It should be noted that the specific implementation of determining the morphological factor of each bright spot connected region based on the above method can be referred to the description of steps S301-S303 in the subsequent embodiments of the present invention, and will not be repeated here.
[0042] In some embodiments, a pre-trained lightweight image feature extraction model can also be used to directly learn the morphology of bright spot connected regions and the associated features of surrounding tissues from grayscale images, and output quantified morphological factor values. The model training data covers various typical region samples such as gastric ulcers, polyps, and reflective spots.
[0043] S104. Determine the ulceration factor of each bright spot connected region based on the positional stability and morphological factor of each bright spot connected region.
[0044] As one possible implementation, for each bright spot connected region in each grayscale image, the corresponding ulcer factor is calculated through a feature fusion algorithm. The ulcer factor is used to quantify the comprehensive probability that the bright spot connected region belongs to a gastric ulcer lesion. Its value is positively correlated with the position stability parameter value and the morphological factor parameter value.
[0045] In some embodiments, the ulceration factor of the bright spot connected region is calculated based on positional stability and morphological factor as follows: In the formula, The first grayscale image The ulcer factor of the bright spot connected region, the larger the value, the more it indicates the ulceration factor of the bright spot connected region. The higher the probability that a bright spot in a connected region corresponds to a gastric ulcer lesion; The first grayscale image The positional stability of the connected region of the first bright spot is used to characterize the position of the second bright spot. The degree of positional consistency of a bright spot connected component in two consecutive grayscale images; The first grayscale image The morphological factor of the bright spot connected region is used to characterize the ... The morphological and structural features of a bright spot connected region in the current frame grayscale image.
[0046] Understandably, since the bright spot connected regions formed by the reflection of light from the light source component in the grayscale image change significantly with the movement of the endoscope, the bright spot connected regions formed by the light reflection of the light source component can be screened out based on the positional stability, which characterizes the positional consistency of the bright spot connected regions in two adjacent grayscale images. Furthermore, based on the morphological factors of the bright spot connected regions, it is determined whether the morphological characteristics of the bright spot connected regions conform to the morphological characteristics of ulcers. Only when the bright spot connected regions have both high positional stability and morphological factors that conform to the characteristics of gastric ulcers will a high ulcer factor value be generated. This provides a quantitative decision basis for the subsequent determination of gastric ulcer regions, making the automatic detection process of gastric ulcers have a quantifiable evaluation standard.
[0047] S105. Determine the gastric ulcer region based on multiple ulcer factors corresponding to each bright spot connected region.
[0048] As one possible implementation, for each bright spot connected region, it is determined whether the ulcer factor of the bright spot connected region is greater than a preset ulcer threshold in a consecutive preset number of frames, and if all are greater than the preset ulcer factor, the bright spot connected region is determined to be a gastric ulcer region.
[0049] It should be noted that the preset quantity and preset ulcer threshold can be set based on experience, such as a preset quantity of 3 and a preset ulcer threshold of 0.7. The preset quantity can also be determined based on the number of times the same bright spot connected component appears in multiple consecutive grayscale images. For example, if a bright spot connected component appears 10 times in multiple consecutive grayscale images, then the preset quantity is 10. Alternatively, it can be based on a preset ratio, such as taking an empirical value of 70% to determine the preset quantity as 7.
[0050] In some embodiments, after determining the gastric ulcer region, the location information of the gastric ulcer region in the grayscale image is determined from any one grayscale image that completely includes the gastric ulcer region from a series of grayscale images, such as the coordinate information of the gastric ulcer region. Furthermore, the gastric ulcer region is visually marked in the original image corresponding to the grayscale image of that frame based on the location information.
[0051] Examples of visualization markers include displaying the mean value of the ulcer factor corresponding to the gastric ulcer region in multiple consecutive frames, the maximum value of the ulcer factor corresponding to the gastric ulcer region in multiple consecutive frames, and highlighting the edge of the gastric ulcer region.
[0052] Understandably, in the gastric ulcer detection method combining endoscopic monitoring and image recognition technology provided by this invention, the dynamic positional stability characteristics of bright spot connected regions in multiple frames of images and the spatial morphological structure characteristics in a single frame of images are comprehensively analyzed and fused. This achieves accurate identification and differentiation of gastric ulcer regions, effectively overcoming the problems of false detection and missed detection caused by factors such as endoscopic reflection and temporary mucosal abnormalities in traditional single-frame image analysis methods. It significantly improves the accuracy and robustness of automatic gastric ulcer detection. At the same time, the interpretability and clinical applicability of the detection results are enhanced through quantitative evaluation and multi-frame consistency verification mechanisms, providing more reliable auxiliary diagnostic basis.
[0053] In one design, embodiments of the present invention provide a specific implementation method for determining the positional stability of each bright spot connected region, such as... Figure 2 As shown, it includes steps S201-S204.
[0054] S201. For each bright spot connected region, determine multiple internal edge connections of the bright spot connected region and the corresponding external edge connections of each internal edge connection.
[0055] As one possible implementation, for each bright spot connected region, the centroid of the bright spot connected region is determined by the arithmetic mean of the coordinates of all pixels in the bright spot connected region. Then, starting from the centroid, rays are drawn to each pixel position on the edge contour of the bright spot connected region to form multiple internal edge lines. The number of internal edge lines is equal to the total number of pixels on the edge contour.
[0056] For each internal edge connection, multiple pixels are extended outwards along its direction to form a corresponding external edge connection. The number of pixels extended can be adaptively set according to the image resolution and the size of the bright spot connected region, with a value ranging from 5 to 15, to ensure that the external edge connection can effectively cover the mucosal tissue surrounding the bright spot connected region.
[0057] Understandably, the inner edge connections are used to analyze the grayscale variation characteristics within the bright spot's connected domain, while the outer edge connections are used to capture the grayscale distribution information of the surrounding tissue. The correspondence between the inner and outer edge connections provides a structural basis for subsequent calculation of edge difference parameters, thereby enabling a quantitative assessment of the transition characteristics between the bright spot's connected domain and the surrounding tissue, and providing key feature evidence for distinguishing between gastric ulcer areas and temporary reflective areas.
[0058] S202. Based on the gray values of each pixel on each internal edge connection and the corresponding external edge connection, determine the edge difference parameter corresponding to each pixel on the edge of the bright spot connected region.
[0059] One possible implementation involves extracting the grayscale value sequence of each pixel along each internal edge connection and its corresponding external edge connection. The transition characteristics of each edge pixel are quantified by analyzing the difference in grayscale distribution between the internal and external edge connections. Specifically, for each edge pixel's corresponding internal and external edge connections, their grayscale value change characteristics are calculated. The grayscale change characteristics of the internal edge connections reflect the grayscale distribution pattern within the bright spot's connected domain, while the grayscale change characteristics of the external edge connections reflect the grayscale distribution pattern of the surrounding tissue.
[0060] In some embodiments, the formula for calculating the edge difference parameter corresponding to each pixel on the edge of the bright spot connected region is as follows: In the formula, For the first On the edge of the bright spot connected region, the first The edge difference parameters corresponding to each pixel For the first On the edge of the bright spot connected region, the first The average of the grayscale differences between adjacent pixels on the internal edge connection line corresponding to each pixel is used to characterize the grayscale changes within the bright spot connected region. For the first On the edge of the bright spot connected region, the first The average of the grayscale differences between adjacent pixels along the outer edge line corresponding to each pixel is used to characterize the grayscale changes of the surrounding tissue. For a very small positive number, an empirical value can be taken as . This is used to prevent the denominator from being zero.
[0061] Understandably, each edge pixel receives a corresponding edge difference parameter. These parameter values collectively constitute a feature set describing the edge characteristics of the bright spot's connected domain. When... When the value is close to 1, it indicates that the grayscale change characteristics of the inner and outer edge connections are similar, and the edge transition is smooth; when A value significantly deviating from 1 indicates a clear difference in the grayscale variation characteristics of the inner and outer edge connections. This edge difference parameter provides an important feature basis for subsequent calculations of positional stability, enabling the system to accurately distinguish between genuine gastric ulcer edges and pseudo-edges caused by factors such as reflection.
[0062] S203. In the next frame of grayscale image, determine the matching connected component that corresponds to the bright spot connected component in the current frame of grayscale image.
[0063] As one possible implementation, for each bright spot connected component in the current grayscale image, candidate connected components are determined based on the distance between them and each bright spot connected component in the next frame of the grayscale image; further, matching connected components are determined based on the similarity between the bright spot connected components and the candidate connected components.
[0064] Specifically, the centroid coordinates of the bright spot connected region to be matched in the current frame grayscale image are used as the reference center. In the next frame grayscale image, all candidate connected regions within a set radius are searched. The search radius can be adaptively set to 20-50 pixels based on the image resolution and the speed of endoscope movement.
[0065] Furthermore, for each candidate connected component initially selected, a multi-dimensional similarity metric is calculated between it and the connected components of the bright spot to be matched in the current frame's grayscale image. This similarity includes spatial distance similarity, morphological structure similarity, and grayscale distribution similarity. Spatial distance similarity is quantified using the reciprocal of the Euclidean distance between the centroids of the two connected components. Morphological structure similarity is calculated by comparing the perimeter-to-area ratio, the aspect ratio of the circumscribed rectangle, and the Hu invariant moment feature of the two connected components. Grayscale distribution similarity is evaluated by analyzing the correlation coefficient and the difference in grayscale mean between the grayscale histograms within the two connected components.
[0066] Finally, by weighted fusion of the above multi-dimensional similarity metrics, the candidate connected component with the highest overall similarity is selected as the matching connected component.
[0067] Understandably, the matching process ensures that, considering endoscope movement and gastric peristalsis, the correspondence between connected components of the same bright spot can be accurately established across consecutive frames, providing a reliable inter-frame correlation basis for subsequent calculations of position stability. When no candidate connected component meets the similarity requirement, the bright spot connected component is determined to disappear in the next frame and is not included in the subsequent calculation of position stability.
[0068] S204. Based on the edge difference parameters and gray values of each pixel on the edge of the bright spot connected region in the current frame grayscale image, and the edge difference parameters and gray values of the same pixel on the edge of the matching connected region in the next frame grayscale image, determine the position stability of each bright spot connected region.
[0069] As one possible implementation, firstly, for the bright spot connected region in the current frame grayscale image, determine the first statistical feature of the edge difference parameters of all its edge pixels, denoted as . The first statistical feature can be the mean, median, variance, etc.; similarly, in the next frame of the grayscale image, the second statistical feature, which determines the edge difference parameters of all edge pixels of the matched connected components, is denoted as... Correspondingly, the second statistical feature and the first statistical feature are statistical features of the same dimension. For example, if the first statistical feature is the mean, the second statistical feature is also the mean. Next, the average gray value of all edge pixels in the bright spot connected region of the current frame grayscale image is calculated, denoted as... Calculate the average gray value of all edge pixels in the matching connected components of the next frame grayscale image, denoted as . .
[0070] Furthermore, the positional stability of each bright spot connected region is determined using the following formula.
[0071] In the formula, For the first Positional stability of a bright spot connected region The absolute difference in the statistical characteristics of edge difference parameters of edge pixels between two frames. The larger the value, the worse the temporal consistency of its edge shape or texture, and therefore the lower its positional stability. This represents the absolute difference in average grayscale at the edges of the bright spot connected region between two frames. The larger this value, the more likely the region has been affected by changes in lighting (such as reflection movement) or has undergone rapid deformation, and therefore its position stability is lower. This is the gray-level normalization constant, which can be 255. It is used to normalize the absolute difference in gray levels to the range of 0 to 1. and These are preset weighting coefficients, all greater than zero, used to adjust the proportion of the influence of the two differences on positional stability, for example... The possible value is 0.7. The possible value is 0.3; Based on the natural constant An exponential function with base 0.
[0072] Optionally, if no matching connected component satisfying the similarity condition is found in the next frame of grayscale image, the position stability of the bright spot connected component is directly set to zero. .
[0073] In the gastric ulcer detection method combining endoscopic monitoring and image recognition technology provided by this invention, a multi-dimensional positional stability evaluation system is constructed by establishing a corresponding analysis framework for connecting inner and outer edges and comparing the feature consistency of corresponding edge points between consecutive frames. This effectively utilizes the essential difference between the temporal spatial position invariance of the gastric ulcer region and the random positional change characteristics of the reflective region. By quantifying the consistency of edge difference parameters and grayscale feature changes between frames, the ability to identify reflective interference and the accuracy of confirming the real ulcer region are significantly improved. This provides a reliable temporal stability basis for subsequent ulcer factor calculation, thereby achieving stable tracking and accurate identification of the gastric ulcer region in complex endoscopic environments.
[0074] In one design, embodiments of the present invention provide a specific implementation method for determining the morphological factor of each bright spot connected region, such as... Figure 3 As shown, it includes steps S301-S303.
[0075] S301. Determine the structural feature parameters based on the edge roughness of the bright spot connected domain and the gray-scale distribution characteristics of multiple internal edge connections.
[0076] As one possible implementation, the edge chain code sequence of the bright spot connected region is first obtained; the absolute value of the difference between adjacent chain code values in the edge chain code sequence is determined to obtain the absolute difference sequence; and the edge roughness is further determined based on the absolute difference sequence.
[0077] Specifically, firstly, a complete edge chain code sequence of the bright spot connected region is obtained through a contour tracking algorithm. The edge chain code sequence adopts the 8-direction Freeman chain code representation, quantizing the directional relationship between adjacent pixels on the connected region contour into an integer value sequence of 0-7. Based on the edge chain code sequence, the irregularity characteristics of the edge are quantified by calculating the degree of directional change between adjacent chain code values, and an absolute difference sequence is constructed to evaluate the edge roughness.
[0078] For example, suppose Indicates length is The edge chain code sequence, where, Represents the first in the edge chain code sequence Each chain code value is represented by a chain code. An absolute difference sequence is obtained by calculating the absolute value of the difference between adjacent chain code values. ,in, The th in the absolute difference sequence The absolute value of each difference is calculated using the chain code, which is cyclic (0 after 7). calculate, To minimize the value, the calculation fully considers the cyclic characteristics of the chain code direction. Furthermore, the mean of the absolute difference sequence can be used to determine the edge roughness, or the variance of the absolute difference sequence can be used to determine the edge roughness.
[0079] Furthermore, the grayscale features of multiple internal edge connections are determined. For each internal edge connection, the grayscale value sequence of each pixel on the internal edge connection is determined. A quadratic curve is fitted based on the grayscale value sequence to obtain the corresponding fitted curve. The quadratic coefficient of each fitted curve is further determined as the grayscale distribution feature of the internal edge connection. The quadratic coefficient is used to characterize the degree of concavity of the grayscale value distribution on the internal edge connection.
[0080] Specifically, for each internal edge connection originating from the centroid of the bright spot's connected region, the gray values of all pixels along that connection are extracted and arranged in spatial order to form a gray value sequence. Based on this gray value sequence, a quadratic curve fitting is performed using the least squares method to obtain a fitting curve that characterizes the gray value distribution pattern along that connection. The fitting curve uses... The mathematical form of which is Represents the grayscale value of a pixel. This represents the position coordinates of a pixel relative to the centroid along the connecting line.
[0081] It should be noted that among the parameters of the fitted curve, the coefficients of the quadratic term... For the first The grayscale distribution characteristics of the internal edge connections are used to quantitatively characterize the concave properties of the grayscale value distribution along the connections. When the grayscale distribution curve of the edge connection opens upward, it means that the grayscale value from the centroid to the edge shows a pattern of first decreasing and then increasing. That is, the true feature corresponding to the internal edge connection in the bright spot connected domain is a convex shape, which is consistent with the morphological distribution from the ulcer center area to the edge position. When the grayscale distribution curve of the edge connection opens downwards, it means that the grayscale value from the centroid to the edge exhibits a pattern of first rising and then falling. That is, the true feature corresponding to the internal edge connection in the bright spot connected region is a concave shape, which does not conform to the morphological distribution from the ulcer center region to the edge position. The absolute value reflects the intensity of the convex or concave distribution of gray values along the inner edge line.
[0082] Finally, the structural feature parameters are determined based on the edge roughness of the bright spot connected domain and the gray-scale distribution characteristics of multiple internal edge connections.
[0083] In some embodiments, the formula for calculating the structural feature parameters of the bright spot connected region is as follows: In the formula, Indicates the first Structural feature parameters of a bright spot connected region The number of internal edge connections. For the first The quadratic coefficients of the fitted curve of the internal edge connection. For the first The edge roughness of a bright spot connected region, where the edge roughness is... The smaller the value, the smaller the directional difference between adjacent chain codes, meaning the edges are smoother and the edge roughness is lower. The larger the value, the greater the difference in direction indicated by adjacent chain codes, meaning the more uneven the edges. It is the hyperbolic tangent function.
[0084] Among them, in the first A bright spot connected region as well as The larger the value, the more the bright spot connected domain has both high edge irregularity and obvious concavity features, which will produce high structural feature parameter values, consistent with the typical morphological manifestation of gastric ulcer lesions.
[0085] S302. Determine the color difference factor of the bright spot connected region based on the color difference between the surrounding area and the tissue area in the original image.
[0086] The surrounding region is the area outside the bright spot connected region within the smallest bounding circle of the bright spot connected region, while the tissue region is the area outside the smallest bounding circle of the bright spot connected region in the original image.
[0087] As one possible implementation, firstly, the smallest bounding circular region of the bright spot connected regions is obtained. The portion of this circular region that does not belong to the bright spot connected regions is defined as the surrounding region. Simultaneously, the region in the image other than the smallest bounding circular regions of all bright spot connected regions is defined as the tissue region. Further, the color difference factor is determined based on the red channel pixel values of each pixel in the surrounding region and the red channel pixel values of each pixel in the tissue region.
[0088] In some embodiments, the formula for calculating the color difference factor is as follows: In the formula, For the first Color difference factor of each bright spot connected region The average value of the red channel pixels for each pixel within the organization region. This is the average value of the red channel pixels for each pixel within the surrounding area. The hyperparameters are preset and are extremely small positive numbers. This invention does not impose any special restrictions on them; in this embodiment, they are... For example, its purpose is to avoid in In this case, the morphology factor and ulcer factor calculated subsequently are 0. This is a constant used for normalization, set based on the overall color dynamic range of the image, for example, it can be 255.
[0089] in, This value is used to quantify the difference between the surrounding area and the normal tissue area on the red channel. It is positively correlated with the color difference factor; when the surrounding area exhibits obvious redness and swelling, this difference is indicated by the color difference factor. The value increases significantly, color difference factor The corresponding increase.
[0090] S303. Determine the morphological factors of the bright spot connected domains based on the structural characteristic parameters and color difference factors.
[0091] As one possible approach, an evaluation index capable of comprehensively characterizing the morphological features of gastric ulcers can be constructed by fusing analysis of structural feature parameters of bright spot connected regions and color difference factors. The morphological factors are obtained using the following formula: In the formula, For the first The morphological factor of a bright spot connected region Indicates the first Structural feature parameters of a bright spot connected region For the first Color difference factor of each bright spot connected region It is the hyperbolic tangent function.
[0092] The method effectively integrates structural and color features through multiplication operations, ensuring that morphological factors simultaneously reflect two key diagnostic features of gastric ulcers: irregular tissue structure and inflammatory response in the surrounding tissue. When a bright spot connected region simultaneously possesses high structural feature parameter values and significant redness and swelling, it will generate a high morphological factor value, indicating that the region exhibits typical morphological characteristics of a gastric ulcer.
[0093] In the gastric ulcer detection method combining endoscopic monitoring and image recognition technology provided by this invention, morphological factors are determined by comprehensively considering the structural feature parameters of the bright spot connected domain and the color difference factor. This achieves a comprehensive quantitative assessment of the morphological features of the gastric ulcer region, effectively integrating multi-dimensional information such as edge roughness, internal gray-scale distribution structure, and color features of surrounding tissues. This enables the system to simultaneously capture key diagnostic criteria such as the typical concave shape of the gastric ulcer, irregular edge features, and redness and swelling color changes of the surrounding tissue. This significantly improves the ability to distinguish the real ulcer region from interfering factors such as polyps and reflective spots in complex endoscopic images, providing a reliable spatial morphological analysis basis for the subsequent accurate calculation of ulcer factors, thereby comprehensively improving the specificity and clinical applicability of automatic gastric ulcer detection.
[0094] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0095] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for detecting gastric ulcers combining endoscopic monitoring and image recognition technology, characterized in that, The method includes: Acquire multiple consecutive frames of raw images of the stomach interior and perform grayscale processing to obtain multiple consecutive frames of grayscale images; For each frame of grayscale image, determine the bright spot connected components in the grayscale image; For each grayscale image except the last frame in a series of consecutive grayscale images, determine the position stability and morphological factor of each bright spot connected component. The position stability is used to characterize the positional consistency of the bright spot connected component in the current grayscale image and the next grayscale image, and the morphological factor is used to characterize the morphological structural features of the bright spot connected component in the current grayscale image. The ulceration factor of each bright spot connected region is determined based on the positional stability and the morphological factor of each bright spot connected region. The gastric ulcer region is determined based on multiple ulcer factors corresponding to each bright spot connected region.
2. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 1, characterized in that, Determine the positional stability of each bright spot connected region, including: For each bright spot connected region, multiple internal edge lines of the bright spot connected region and external edge lines corresponding to each internal edge line are determined. The internal edge lines are the lines connecting the centroid of the bright spot connected region to the pixels on the edge of the bright spot connected region. The external edge lines are the straight lines formed by the internal edge lines extending outward from the bright spot connected region to multiple pixels. Based on the gray values of each pixel on each internal edge connection and the corresponding external edge connection, determine the edge difference parameter corresponding to each pixel on the edge of the bright spot connected region; In the next frame of grayscale image, determine the matching connected component that corresponds to the bright spot connected component in the current frame of grayscale image; The positional stability of each bright spot connected region is determined based on the edge difference parameters and gray values of each pixel on the edge of the bright spot connected region in the current frame grayscale image, and the edge difference parameters and gray values of the same pixel on the edge of the matching connected region in the next frame grayscale image.
3. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 2, characterized in that, In the next frame of grayscale image, determine the matching connected component corresponding to the bright spot connected component in the current frame of grayscale image, including: For each bright spot connected component in the current frame grayscale image, candidate connected components are determined based on the distance between them and each bright spot connected component in the next frame grayscale image. The matching connected component is determined based on the similarity between the bright spot connected component and the candidate connected component.
4. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 1, characterized in that, Determine the morphological factors of each bright spot connected region, including: The structural feature parameters are determined based on the edge roughness of the bright spot connected domain and the gray-scale distribution characteristics of multiple internal edge connections. The color difference factor of the bright spot connected region is determined based on the color difference between the surrounding region and the tissue region in the original image. The surrounding region is the region other than the bright spot connected region in the minimum bounding circle region of the bright spot connected region. The tissue region is the region other than the minimum bounding circle region of the bright spot connected region in the original image. The morphological factor of the bright spot connected region is determined based on the structural feature parameters and the color difference factor.
5. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 4, characterized in that, Determining the edge roughness of the bright spot connected region includes: Obtain the edge chain code sequence of the bright spot connected region; Determine the absolute value of the difference between adjacent chain code values in the edge chain code sequence to obtain an absolute difference sequence; The edge roughness is determined based on the absolute difference sequence.
6. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 4, characterized in that, Determine the grayscale distribution characteristics of multiple internal edge connections, including: For each internal edge connection, determine the gray value sequence of each pixel on the internal edge connection; A quadratic curve is fitted based on the grayscale value sequence to obtain the corresponding fitted curve. The quadratic coefficient of each fitted curve is determined as the gray-level distribution characteristic of the inner edge connection, and the quadratic coefficient is used to characterize the degree of concavity of the gray-level distribution on the inner edge connection.
7. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 4, characterized in that, The color difference factor of the bright spot connected region is determined based on the color difference between the surrounding area and the tissue area in the original image, including: The color difference factor is determined based on the red channel pixel value of each pixel in the surrounding area and the red channel pixel value of each pixel in the tissue area.
8. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 1, characterized in that, The gastric ulcer region was determined based on multiple ulcer factors corresponding to each bright spot connected region, including: For each bright spot connected region, if the ulcer factor is greater than a preset ulcer threshold in a consecutive preset number of frames, the bright spot connected region is determined to be a gastric ulcer region.
9. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 1, characterized in that, Determining the connected components of bright spots in a grayscale image includes: Edge detection is performed on a grayscale image to obtain edge information; Based on the edge information, connected regions in the grayscale image are determined; Regions in the connected regions whose average gray value is higher than a preset gray threshold are identified as bright spot connected regions.
10. The gastric ulcer detection method combining endoscopic monitoring and image recognition technology according to claim 1, characterized in that, The method further includes: Determine the location information of the gastric ulcer region in the grayscale image; The gastric ulcer area is visually marked in the original image based on the location information.