Helicobacter pylori intelligent identification method and system based on computer vision processing

CN122368012APending Publication Date: 2026-07-10363 HOSPITAL +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610556081.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-24
Publication Date
2026-07-10

Smart Images

  • Figure CN122368012A_ABST
    Figure CN122368012A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of helicobacter pylori identification, and discloses a helicobacter pylori intelligent identification method and system based on computer vision processing; including: collecting a gastric mucosa sample, obtaining an HP fluorescent staining image through staining treatment; performing split processing on the HP fluorescent staining image to obtain multiple sub-pictures, and taking the coordinate information of a predetermined orientation of each sub-picture as first coordinate information; performing multi-process operations on each sub-picture to generate a first sub-picture with a rectangular frame and a confidence level; splicing and combining the position coordinates of the rectangular frame in the first sub-picture with the first information coordinates on the corresponding sub-picture to generate a labeled image; comprehensively analyzing the labeled image and outputting a structured detection report. Through distance transformation and adhesion separation of the watershed, and consistent double-layer verification, the present application can effectively reduce the false detection rate of various artifacts such as bright spots, debris, bubbles and the like, thereby improving the accuracy and robustness of HP bacterial body identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Helicobacter pylori identification technology, and more specifically, to a method and system for intelligent identification of Helicobacter pylori based on computer vision processing. Background Technology

[0002] Helicobacter pylori (HP) infection is closely related to the development and progression of chronic gastritis, peptic ulcers, and gastric cancer, and is one of the important etiological indicators of the gastrointestinal tract. Clinical detection pathways are broadly divided into two categories: non-invasive and invasive. Among them, microscopic examination based on endoscopic sampling (brushing cytology and histopathology) can provide direct morphological evidence and can be linked to pathological classification and subsequent treatment strategies, thus playing an important role in clinical diagnosis and efficacy evaluation.

[0003] Traditional methods for identifying Helicobacter pylori mostly rely on manual microscopic examination and experience-based interpretation, which suffers from problems such as time-consuming processes, high subjectivity, and insufficient repeatability and consistency. Furthermore, while traditional image processing methods, such as deep learning-based detection methods, can improve detection efficiency, they are prone to unstable segmentation and increased false positives and false negatives under conditions of uneven lighting, background autofluorescence, complex tissue structures, bacterial cell adhesion, and weak signals. In addition, because HP targets in microscopic images are small in scale (length on the order of micrometers, diameter even smaller) and have diverse morphologies (spirals and arcs coexisting), and are often associated with glandular structures in histological samples, Background elements such as interstitial components overlap, and although the background is relatively simple in the sample being scanned, artifacts such as bright spots, debris, and bubbles are prone to interference. Fluorescence images also face engineering problems such as non-uniform illumination, noise, and focus fluctuations, making it difficult to standardize the objective quantification of bacterial density. Existing automated methods mostly focus on a single step (such as threshold segmentation or single-channel intensity discrimination), lacking a complete process that can be reproduced and implemented by unifying and integrating multi-dimensional information such as color features (fluorescence intensity), geometric morphology (area, aspect ratio, roundness, compactness), skeleton / curvature (spiral), and connected domains and adhesion separation (watershed).

[0004] In view of this, the present invention proposes a method and system for intelligent identification of Helicobacter pylori based on computer vision processing to solve the above problems. Summary of the Invention

[0005] To overcome the aforementioned deficiencies of the prior art and achieve the above objectives, the present invention provides the following technical solution: A computer vision-based intelligent identification method for Helicobacter pylori, including the following identification methods: Gastric mucosal samples were collected and specifically labeled using acridine orange immunofluorescence staining to obtain images labeled with acridine orange fluorescent probes. The images were then preprocessed to obtain HP fluorescent staining images. The HP fluorescence staining image is segmented to obtain multiple sub-images, and the coordinate information of the predetermined orientation of each sub-image is used as the first coordinate information. The predetermined orientation is the upper left corner of each sub-image in the HP fluorescence staining image. Perform multiple operations on each sub-image based on the OpenCV algorithm to generate a first sub-image with a bounding box and confidence score. The position coordinates attached to the rectangle in the first sub-image are combined with the first information coordinates on the corresponding sub-image to generate a labeled map with HP location, quantity and morphological distribution. The system performs comprehensive analysis of the labeled images, intelligently determines the HP infection status and infection level, and outputs a structured detection report.

[0006] Furthermore, the method for generating the first sub-image with a bounding box and confidence score is as follows: Sub-images are input into a pre-constructed multi-scale pyramid to obtain sub-images at multiple scales. Thresholding segmentation is performed on each scale sub-image to obtain a first binary image. Opening and closing morphological operations on elliptical structural elements are applied to the first binary image to obtain a second binary image. Distance transformation and label generation are performed on the second binary image to obtain a foreground label image. The watershed algorithm is used to separate individuals, obtaining independent connected components for each HP cell, denoted as HP cell connected components. The confidence score of each HP cell connected component is calculated to filter candidate regions. The candidate regions are double-validated. When the double-validation passes, the candidate region is marked as a reliable candidate region. The bounding boxes of the reliable candidate regions are obtained, and the bounding boxes are bound to the corresponding confidence scores to output detection boxes with bounding boxes and confidence scores for each scale sub-image. Based on the detection boxes of all scale sub-images, a detection box set is constructed. Non-maximum suppression detection is performed on the detection box set to obtain a standard detection box set. The standard detection box set is mapped back to the original coordinates of the sub-image to generate a first sub-image with bounding boxes and confidence scores.

[0007] Furthermore, the method for thresholding sub-images at each scale is as follows: Thresholding segmentation includes Otsu thresholding and adaptive thresholding. It calculates the global gray-level variance within the scale sub-image and selects the optimal threshold for segmentation based on the global gray-level variance. Among them, adaptive thresholding segmentation performs segmentation by dynamically adjusting the threshold within a local window, while Otsu thresholding segmentation selects the optimal threshold for segmentation by maximizing the inter-class variance.

[0008] Furthermore, the method for selecting the optimal threshold segmentation based on the global gray-level variance is as follows: Obtain the grayscale value of each pixel in each scale sub-image and set a segmentation threshold. Pixels with grayscale values ​​less than the segmentation threshold are classified as background pixels, and pixels with grayscale values ​​greater than or equal to the segmentation threshold are classified as foreground pixels. Based on the grayscale values ​​of all pixels in each scale sub-image, calculate the global grayscale variance of each scale sub-image. Compare the global grayscale variance with a preset grayscale variance threshold. If the global grayscale variance is less than the preset grayscale variance threshold, the Otsu threshold segmentation is recorded as the optimal threshold segmentation. If the global grayscale variance is greater than or equal to the preset grayscale variance threshold, the adaptive threshold segmentation is recorded as the optimal threshold segmentation.

[0009] Furthermore, the method for obtaining the connected components of HP cells is as follows: A Euclidean distance transformation is performed on the second binary image. For each foreground pixel, the background pixel closest to the current foreground pixel is recorded as the current nearest background pixel. The Euclidean distance between the current foreground pixel and the current nearest background pixel is calculated. Based on the Euclidean distances of all foreground pixels, a distance transformation map is generated. A thresholding process is applied to the distance transformation map, retaining foreground pixels whose Euclidean distance is greater than a preset Euclidean distance threshold. All retained foreground pixels are aggregated to form a defined foreground region. Connectivity analysis is performed on the defined foreground region: using 4-neighborhood or 8-neighborhood connectivity rules, adjacent foreground pixels are... The pixels are aggregated into several spatially unconnected continuous pixel sets, each set being an independent connected component; a unique integer identifier is assigned to each independent connected component to obtain the foreground label map; dilation is performed on the second binary image to generate the background label map; a watershed label image is constructed based on the foreground and background label maps; the watershed algorithm is executed using the second binary image as the segmentation input image and the watershed label image as the seed label to obtain the HP cell segmentation result image; connected component extraction is performed on the HP cell segmentation result image to obtain the independent connected component of each HP cell, denoted as the HP cell connected component.

[0010] Furthermore, the method for selecting candidate regions is as follows: Geometric features, skeleton, and curvature features are extracted for each HP cell connected region to obtain geometric and skeleton curvature features. The region corresponding to the HP cell connected region in the scale sub-image is recorded as the cell ROI region, and color and texture features are extracted from the cell ROI region. The geometric, skeleton curvature, color, and texture features are fused using a fusion function to obtain a comprehensive feature vector, and the comprehensive feature vector is weighted and summed to obtain the confidence score. The confidence score is compared with a preset confidence threshold. If the confidence score is greater than the preset confidence threshold, the corresponding HP cell connected region is recorded as a candidate region.

[0011] Furthermore, the method for performing two-layer verification on candidate regions is as follows: The two-layer verification includes geometric consistency verification and local structural consistency verification. Geometric consistency verification uses template matching and normalized cross-correlation method: a predefined standard HP bacterial template is used to traverse all positions of the candidate region in a preset sliding window manner, and the normalized cross-correlation number of each position is calculated. The maximum normalized cross-correlation number is taken as the maximum cross-correlation number of the candidate region. When the maximum cross-correlation number is greater than the preset cross-correlation number threshold, the consistency verification is passed. Local structural consistency verification employs a combination of corner detection and ORB descriptors: Corner detection is performed on both the standard HP bacterial template and candidate regions, extracting their respective corner sets; ORB descriptors are extracted for each corner within the set, and the ORB descriptors of all corners are combined to obtain the standard HP bacterial template descriptor set and the candidate region descriptor set, respectively; Hamming distance is used to pair the standard HP bacterial template descriptor set and the candidate region descriptor set one by one, resulting in multiple quality matching pairs; the number of quality matching pairs is divided by the total number of corners in the standard HP bacterial template to obtain the matching rate. If the matching rate is greater than a preset matching rate threshold, the consistency verification passes.

[0012] Furthermore, the method for obtaining the standard detection box set is as follows: Sort all detection boxes in the detection box set from high to low confidence and build a sorting table A. The detection box with the highest confidence in sorting table A is recorded as the baseline box A. Calculate the intersection-union ratio (IUR) A between each other detection box in sorting table A and the baseline box A. Classify other detection boxes with IUR A greater than the preset IUR threshold A1 into the redundant group of the baseline box A, and record it as the redundant group A. After removing all detection frames from redundant group A and the baseline frame A from the detection frame set, a new sorting table is constructed, denoted as sorting table B. The detection frame with the highest confidence in sorting table B is designated as the baseline frame B. The intersection-union ratio (IUR) B of each other detection frame in sorting table B with the baseline frame B is calculated. Detection frames with an IUR B greater than a preset IUR threshold B1 are assigned to the redundant group of the baseline frame B, denoted as redundant group B. This operation is repeated until the detection frame set is empty, resulting in multiple redundant groups. For each redundant group, the detection frame with the highest confidence is retained and designated as the optimal detection frame. All optimal detection frames are merged to obtain the standard detection frame set.

[0013] Furthermore, the method for obtaining the bounding box of the reliable candidate region is as follows: Based on the connected components of HP cells corresponding to reliable candidate regions, the contour search algorithm in OpenCV is used to extract the complete external contour of HP cells within the connected components. The coordinate data of all pixels on the external contour are obtained, including the x-coordinate and y-coordinate. The coordinate data of all pixels on the external contour are traversed, and the minimum, maximum, minimum, and maximum x-coordinates are extracted respectively. The minimum and minimum y-coordinates are used as the coordinates of the upper left corner of the rectangle, and the maximum and maximum y-coordinates are used as the coordinates of the lower right corner of the rectangle. The smallest rectangle that can completely enclose the external contour is constructed based on the coordinates of the upper left and lower right corners of the rectangle, which is the bounding box of the reliable candidate region.

[0014] A computer vision-based intelligent identification system for Helicobacter pylori, comprising: The acquisition module is used to collect gastric mucosal samples, specifically label the gastric mucosal samples using acridine orange immunofluorescence staining, obtain images labeled with acridine orange fluorescent probes, and perform preprocessing operations on the images to obtain HP fluorescent staining images; The segmentation module is used to segment the HP fluorescence staining image to obtain multiple sub-images, and uses the coordinate information of the predetermined orientation of each sub-image as the first coordinate information. The predetermined orientation is the upper left corner of each sub-image in the HP fluorescence staining image. The recognition module performs multiple operations on each sub-image based on the OpenCV algorithm and outputs the first sub-image with a bounding box and confidence score. The stitching module is used to stitch together the position coordinates of the rectangle attached to the first sub-image with the first information coordinates on the corresponding sub-image to generate a labeled map with HP position, quantity and shape distribution. The interpretation module is used to perform comprehensive analysis on the labeled map, intelligently determine the HP infection status and infection level, and output a structured detection report.

[0015] The technical effects and advantages of the Helicobacter pylori intelligent identification method and system based on computer vision processing in this invention are as follows: The HP intelligent recognition method provided by this invention does not rely on deep learning models. It can achieve fast, objective and interpretable recognition of HP in fluorescently stained images based entirely on traditional OpenCV image processing and morphological processing. This reduces the dependence on computing power and large-scale labeled data, making it easy to deploy at the grassroots and edge devices. At the same time, through the segmentation-recognition-stitching processing strategy, it can run on large-field-of-view, high-resolution images, effectively reducing hardware requirements and video memory / memory usage, improving throughput and reducing the bottleneck of whole-image processing. This invention effectively reduces the false detection rate of various artifacts such as bright spots, debris, and bubbles by using distance transformation and watershed adhesion separation, as well as consistency double-layer verification, thereby significantly improving the accuracy and robustness of HP cell identification. Attached Figure Description

[0016] Figure 1 This is a flowchart of the identification method of the present invention; Figure 2 This is a block diagram of the identification system of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] In one embodiment, a computer vision-based intelligent identification method for Helicobacter pylori is disclosed, such as... Figure 1 As shown, the method includes: Gastric mucosal samples were collected and specifically labeled using acridine orange immunofluorescence staining to obtain images labeled with acridine orange fluorescent probes. The images were then preprocessed to obtain HP fluorescent staining images. The HP fluorescence staining image is segmented to obtain multiple sub-images, and the coordinate information of the predetermined orientation of each sub-image is used as the first coordinate information, where the predetermined orientation is the upper left corner of the sub-image; Perform multiple operations on each sub-image based on the OpenCV algorithm to generate a first sub-image with a bounding box and confidence score. The position coordinates attached to the rectangle in the first sub-image are combined with the first information coordinates on the corresponding sub-image to generate a labeled map with HP location, quantity and morphological distribution. The system performs comprehensive analysis of the labeled images, intelligently determines the HP infection status and infection level, and outputs a structured detection report.

[0019] The above scheme provides a specific method for intelligent identification of Helicobacter pylori based on computer vision processing. First, gastric mucosal samples are collected and specifically labeled using acridine orange immunofluorescence staining to obtain images labeled with the acridine orange fluorescent probe. Gastric mucosal samples include endoscopic brushing cytology samples and also include gastric biopsy histopathological samples. The images are preprocessed to obtain HP fluorescently stained images. The endoscopic brushing cytology samples are obtained by brushing cell smears under gastroscopy, which is convenient, minimally invasive, and accurately reflects the true HP infection status of the gastric mucosa, laying the foundation for subsequent efficient identification. The obtained samples were specifically labeled using acridine orange immunofluorescence staining, and images labeled with acridine orange fluorescent probes were accurately acquired using fluorescence imaging technology. Specifically, the acridine orange fluorescent probes were used to specifically bind and label Helicobacter pylori nucleic acid, which showed orange-red / red fluorescence at the corresponding excitation wavelength. This allowed Helicobacter pylori to form a clear fluorescence contrast with background cells and tissue impurities in the gastric mucosal samples under gastroscopy, thus clearly displaying the morphological characteristics of Helicobacter pylori (HP). This enabled specific color development and precise localization of Helicobacter pylori (HP), providing a high-contrast, high-recognition sample basis for subsequent image recognition. The acquired images are then preprocessed, including denoising, contrast enhancement, non-uniform illumination correction, and color normalization. CLAHE is used to enhance brightness and contrast, and flat-field or top / bottom cap correction is performed. Channel normalization and intensity stretching are performed in HSV and / or Lab space. For noise suppression, Gaussian filtering is used to remove Gaussian noise, and median filtering is used to eliminate salt-and-pepper noise. For the edge blurring problem commonly seen in fluorescence microscopy images, bilateral filtering and guided filtering are introduced to smooth the background while maintaining the detail and integrity of bacterial edges. In the enhancement stage, contrast-limited adaptive histogram equalization is used to improve brightness differences caused by non-uniform illumination. These preprocessing operations effectively eliminate interference generated during gastroscopy brushing, staining, and image acquisition, improving the identification of Helicobacter pylori (HP) target regions. After preprocessing, an HP fluorescence staining image is obtained. Then, the HP fluorescence staining image is segmented to obtain multiple sub-images, and the coordinates of each sub-image at a predetermined orientation are used as the first coordinate information. Here, multiple sub-images can be... One, and The number of sub-images must be greater than or equal to 4. The predetermined orientation is the upper left corner of each sub-image within the HP fluorescence staining image. Then, computer vision technology is used to label each sub-image, performing multiple operations based on the OpenCV algorithm on each sub-image, including scale division, threshold segmentation, morphological processing, connected component analysis, skeleton extraction and curvature analysis, and geometric / texture / color multi-feature fusion discrimination, ultimately resulting in a first sub-image with a rectangular bounding box (i.e., marked with HP locations) and a confidence level. Next, sub-images are stitched together, combining the position coordinates of the rectangular bounding box in the first sub-image with the first information coordinates to generate a labeled map showing the location, quantity, and morphological distribution of HP. Here, the coordinate conversion during stitching is based on the anchor point at the predetermined orientation (upper left corner) and the size parameters of the first sub-image. This ensures that the detection results of HP in gastroscopy gastric mucosal samples can be accurately traced back to the specific location of the original sample, providing a precise reference for clinical interpretation. Finally, the results are interpreted. Based on the output annotation map, a comprehensive analysis of the number, spatial distribution, and morphological characteristics of Helicobacter pylori is conducted to intelligently determine the infection status and infection level, and output a structured test report, providing intuitive and quantitative reference for clinical interpretation. For example, the stained red Helicobacter pylori are annotated on the original stained image, displaying the object ID and key features (such as roundness, eccentricity, peak curvature, etc.), and simultaneously generating field-of-view statistics, including indicators such as bacterial count and number of suspicious objects, thereby exporting an overlay annotation map and a structured report. When the number of Helicobacter pylori bacteria exceeds a preset threshold and the proportion of typical morphology is high, the infection status and infection level are determined. When HP infection is detected, it indicates the presence of HP infection. Furthermore, when HP infection is present, the infection level can be classified based on the density, distribution range, and proportion of typical spiral / arc morphology of the bacteria. A higher density, distribution range, and proportion of typical spiral / arc morphology indicate a higher infection level. Specific judgment rules can be set based on the experience and expertise of those in the field, such as by incorporating existing clinical diagnostic standards to achieve objective, quantitative, and standardized judgment of HP infection and its level. This method relies on a standardized image processing workflow, possessing advantages such as strong interpretability, high processing efficiency, and adaptability to small sample testing, providing a reliable basis for rapid clinical diagnosis and screening.

[0020] The method for generating the first sub-image with a bounding box and confidence score is as follows: The sub-image is input into a pre-constructed multi-scale pyramid to obtain multiple scale sub-images; threshold segmentation is performed on each scale sub-image to obtain the first binary image; opening and closing morphological operations on elliptical structuring elements are applied to the first binary image to obtain the second binary image; distance transformation and label generation are performed on the second binary image to obtain a foreground label image, and the watershed algorithm is used for individual separation to obtain the independent connected components of each HP cell, denoted as the HP cell connected component; the connected components of each HP cell are calculated. The confidence level is used to filter candidate regions; the candidate regions are then subjected to double-layer validation, and when the double-layer validation passes, the candidate region is marked as a reliable candidate region; the bounding boxes of the reliable candidate regions are obtained, and the bounding boxes are bound to the corresponding confidence levels, outputting detection boxes with bounding boxes and confidence levels for each scale sub-image; a detection box set is constructed based on the detection boxes of all scale sub-images; non-maximum suppression detection is performed on the detection box set to obtain a standard detection box set; the standard detection box set is mapped back to the original coordinates of the sub-image to generate the first sub-image with bounding boxes and confidence levels; The method for thresholding sub-images at various scales is as follows: thresholding includes Otsu thresholding and adaptive thresholding. The global gray-level variance within the sub-images at each scale is calculated, and the optimal threshold is selected based on the global gray-level variance. Among them, adaptive thresholding is performed by dynamically adjusting the threshold within a local window, while Otsu thresholding is performed by maximizing the inter-class variance to select the optimal threshold. The method for selecting the optimal threshold segmentation based on global gray-level variance is as follows: The gray-level value of each pixel in each scale sub-image is obtained, and a segmentation threshold is set. Pixels with gray-level values ​​less than the segmentation threshold are classified as background pixels, and pixels with gray-level values ​​greater than or equal to the segmentation threshold are classified as foreground pixels. Based on the gray-level values ​​of all pixels in the scale sub-image, the global gray-level variance of each scale sub-image is calculated. The global gray-level variance is compared with a preset gray-level variance threshold. If the global gray-level variance is less than the preset gray-level variance threshold, the Otsu threshold segmentation is recorded as the optimal threshold segmentation. If the global gray-level variance is greater than or equal to the preset gray-level variance threshold, the adaptive threshold segmentation is recorded as the optimal threshold segmentation. The method for obtaining the connected components of HP cells is as follows: Perform Euclidean distance transformation on the second binary image. For each foreground pixel, the background pixel closest to the current foreground pixel is recorded as the current nearest background pixel. Calculate the Euclidean distance between the current foreground pixel and the current nearest background pixel. Based on the Euclidean distances of all foreground pixels, generate a distance transformation map. Threshold the distance transformation map, retaining foreground pixels with Euclidean distances greater than a preset Euclidean distance threshold. Aggregate all retained foreground pixels to form a defined foreground region. Perform connected component analysis on the defined foreground region: using 4-neighborhood or 8-neighborhood connectivity rules, connect the adjacent pixels to the nearest neighbor. Adjacent foreground pixels are aggregated into several spatially unconnected continuous pixel sets, each set being an independent connected component. A unique integer identifier is assigned to each independent connected component to obtain a foreground label map. Dilation is performed on the second binary image to generate a background label map. A watershed label image is constructed based on the foreground and background label maps. Using the second binary image as the segmentation input image and the watershed label image as the seed label, the watershed algorithm is executed to obtain the HP cell segmentation result image. Connected component extraction is performed on the HP cell segmentation result image to obtain an independent connected component for each HP cell, denoted as the HP cell connected component. The method for selecting candidate regions is as follows: geometric features and skeleton and curvature features are extracted for each HP cell connected region to obtain geometric features and skeleton curvature features. The region corresponding to the HP cell connected region in the scale sub-image is recorded as the cell ROI region. The color features and texture features of the cell ROI region are extracted. The geometric features, skeleton curvature features, color features and texture features are fused through a fusion function to obtain a comprehensive feature vector. The comprehensive feature vector is weighted and summed to obtain the confidence score. The confidence score is compared with a preset confidence threshold. If the confidence score is greater than the preset confidence threshold, the corresponding HP cell connected region is recorded as a candidate region. The two-layer verification method includes geometric consistency verification and local structural consistency verification. Geometric consistency verification uses template matching normalized cross-correlation method for consistency verification: a predefined standard HP bacterial template is used to traverse all positions of the candidate region in a preset sliding window manner, and the normalized cross-correlation number of each position is calculated. The maximum normalized cross-correlation number is taken as the maximum cross-correlation number of the candidate region. When the maximum cross-correlation number is greater than the preset cross-correlation number threshold, the consistency verification passes. Local structural consistency verification employs a combination of corner detection and ORB descriptors: Corner detection is performed on both the standard HP bacterial template and candidate regions, extracting their respective corner sets; ORB descriptors are extracted for each corner within the set, and the ORB descriptors of all corners are combined to obtain the standard HP bacterial template descriptor set and the candidate region descriptor set, respectively; Hamming distance is used to pair the standard HP bacterial template descriptor set and the candidate region descriptor set one by one, resulting in multiple quality matching pairs; the number of quality matching pairs is divided by the total number of corners in the standard HP bacterial template to obtain the matching rate. If the matching rate is greater than a preset matching rate threshold, the consistency verification passes. The method for obtaining the standard detection box set is as follows: sort all detection boxes in the detection box set from high to low confidence, construct a sorting table A, and record the detection box with the highest confidence in sorting table A as the reference box A. Calculate the intersection-union ratio (IUR) A between each other detection box in sorting table A and the reference box A. Assign other detection boxes with IUR A greater than the preset IUR threshold A1 to the redundant group of the reference box A, and record them as the redundant group A. After removing all detection frames from redundant group A and the baseline frame A from the detection frame set, a new sorting table is constructed, denoted as sorting table B. The detection frame with the highest confidence in sorting table B is designated as the baseline frame B. The intersection-union ratio (IUR) B of each other detection frame in sorting table B with the baseline frame B is calculated. Detection frames with an IUR B greater than a preset IUR threshold B1 are assigned to the redundant group of the baseline frame B, denoted as redundant group B. This operation is repeated until the detection frame set is empty, resulting in multiple redundant groups. For each redundant group, the detection frame with the highest confidence is retained and designated as the optimal detection frame. All optimal detection frames are merged to obtain the standard detection frame set.

[0021] The above scheme provides a specific implementation plan for generating a first sub-image with a rectangular bounding box and confidence level. Firstly, because Helicobacter pylori (HP) microscopic images contain images as small as 1.5 mm... Even tiny individuals exist for up to 5 years. The spiral structure exhibits significant morphological variations. Single-scale detection methods are prone to missing small targets or causing edge breaks in large targets. Therefore, a multi-scale pyramid is employed for detection. Sub-images are input into the multi-scale pyramid to obtain sub-images at multiple scales. For example, a multi-scale pyramid can be constructed using scaling factors {1.0, 0.5, 0.25}, and thresholding and reliable candidate region extraction are performed independently at each scale. Thresholding of each scale sub-image to obtain the first binary image can be achieved using a combination of Otsu thresholding and adaptive thresholding. Specifically, the optimal thresholding can be selected based on the calculated global grayscale variance within the scale sub-images. Adaptive threshold segmentation effectively separates bacteria with weak fluorescence signals by dynamically adjusting the threshold within a local window. Otsu threshold segmentation selects the optimal threshold by maximizing the inter-class variance. Even in scenarios with uniform global grayscale distribution and significant differences in grayscale between the foreground and background, it automatically calculates the optimal global segmentation threshold, classifying pixels into background and foreground categories. This achieves efficient and stable segmentation of HP bacteria with strong fluorescence signals without manual intervention in threshold setting, while ensuring consistency and robustness of the segmentation results. It avoids over-segmentation or noise amplification problems that may occur with local thresholding methods in uniform scenes. The specific calculation formula is as follows:

[0022] In the formula, The inter-class variance measures the difference between the gray values ​​of the background and foreground classes. The larger the value, the clearer the distinction between the two classes and the better the segmentation effect. The preset segmentation threshold is the critical value used to divide the pixels of the scale sub-image. Pixels with gray values ​​less than the segmentation threshold t are classified as background pixels, and pixels with gray values ​​greater than or equal to the segmentation threshold t are classified as foreground pixels. The background probability is the proportion of pixels in the scaled sub-image whose grayscale value is less than the segmentation threshold t out of the total number of pixels. Foreground probability, which is the proportion of pixels in the scale sub-image whose gray value is greater than or equal to the segmentation threshold t out of the total number of pixels; This represents the average grayscale value of all background pixels in the scaled sub-image. The average grayscale value of all foreground pixels in each scale sub-image is used. The specific thresholding method chosen is as follows: First, the grayscale value of each pixel in each scale sub-image is obtained. Based on the grayscale values ​​of all pixels in each scale sub-image, the global grayscale variance of each scale sub-image is calculated. The global grayscale variance can be calculated using the variance formula. The global grayscale variance is compared with a preset grayscale variance threshold, which can be determined based on the experience and professional knowledge of those in the field. If the global grayscale variance is less than the preset grayscale variance threshold, it indicates that the global grayscale distribution of the scale sub-image is more uniform, and Otsu thresholding is better. Otsu thresholding is then recorded as the optimal thresholding. If the global grayscale variance is greater than or equal to the preset grayscale variance threshold, it indicates that the global grayscale distribution of the scale sub-image is not uniform enough, and adaptive thresholding is better. Adaptive thresholding is then recorded as the optimal thresholding. This method, based on the global... The strategy of adaptively selecting Otsu thresholding or adaptive thresholding based on gray-level variance enables accurate thresholding of sub-images at different quality scales: when the global gray-level variance of the sub-image is small (i.e., the gray-level distribution of foreground and background pixels is concentrated and significantly different), Otsu thresholding can automatically obtain the optimal global threshold, efficiently and stably separating bacteria with strong fluorescent signals; when the global gray-level variance is large (i.e., uneven illumination and weak fluorescent signal scenes), it switches to adaptive thresholding, dynamically adjusting the threshold through local windows to accurately separate bacteria with weak fluorescent signals. This approach balances the stability of global segmentation with the adaptability of local segmentation, avoiding the failure of single Otsu segmentation in uneven illumination scenes and the redundant calculation and over-segmentation of single adaptive thresholding in uniform scenes. It significantly improves the robustness and accuracy of HP cell binary image segmentation, providing high-quality basic data for subsequent morphological processing, individual separation, and feature extraction. Since the first binary image obtained by threshold segmentation may contain defects such as scattered noise, broken bacterial cell outlines, and internal micro-voids, elliptical structural elements are used to perform morphological opening and closing operations to optimize the quality of the binary image and obtain a second binary image. Using elliptical structural elements to perform morphological opening and closing operations is an existing technique and will not be described in detail here. For example, an opening operation (erosion followed by dilation) is first performed on the first binary image to remove isolated scattered noise and fine protrusions, while preserving the main shape and position of the bacterial cell. Then, a closing operation (dilation followed by erosion) is performed to fill the micro-voids inside the bacterial cell and connect the broken outline edges, making the bacterial cell region more complete and continuous. The resulting second binary image has less noise and a clearer, more complete bacterial cell outline, providing a reliable binarization basis for subsequent bacterial cell separation and feature extraction. After obtaining the second binary image, distance transformation and label generation are performed on it to obtain foreground labels. The watershed algorithm is then used for individual separation, resulting in independent connected components for each HP cell, denoted as the HP cell connected component. Specifically, an Euclidean distance transformation is first performed on the second binary image. For each foreground pixel, the background pixel closest to it is designated as the current nearest background pixel. The Euclidean distance between the current foreground pixel and the current nearest background pixel is calculated. Based on the Euclidean distances of all foreground pixels, a distance transformation is generated. The differences in Euclidean distances highlight the characteristics of the cell center and the adhesion boundaries—the cell center pixel is farther from the background and has a larger value, while the middle position of the adhesion region is further away. Small, forming a "valley" structure, providing a basis for subsequent seed region extraction; thresholding is performed on the distance transformation map, retaining foreground pixels with Euclidean distances greater than a preset Euclidean distance threshold, and all foreground pixels are naturally aggregated into several connected pixel blocks through spatial adjacency, forming a defined foreground region, where the preset Euclidean distance threshold can be determined based on the experience and professional knowledge of those in the field; when the Euclidean distance is greater than the preset Euclidean distance threshold, it indicates that the region is the core seed region of each HP cell, and is thus recorded as a defined foreground region, which can effectively exclude the adhering parts between cells; connected component analysis is performed on the defined foreground region: 4-neighbor or 8-neighbor connectivity rules can be used to aggregate adjacent foreground pixels into several empty... A foreground marker image is obtained by assigning a unique integer identifier to each of a set of non-contiguous, continuous pixels, each set representing an independent connected region (corresponding to the core seed region of a *HP* cell). Different identifiers represent the core seed regions of different *HP* cells. A dilation process is performed on the second binary image to generate a defined background region, resulting in a background marker image. The dilation process expands the background area, covering the adhesion gaps between cells and clearly distinguishing the background from the cell regions to be segmented. A watershed marker image is constructed based on the foreground and background marker images. The area covered by the foreground marker image is marked as the seed identifier region of the corresponding cell, the area covered by the background marker image is marked as the background marker region, and the area not covered by the foreground marker image is marked as the seed identifier region of the corresponding cell. The remaining areas covered by both are marked as the adhesion regions to be segmented. Using the second binary image as the segmentation input image and the watershed marker image as the seed marker, the watershed algorithm is executed. The algorithm starts "watering out" from the seed marker region of each bacterial cell, forming segmentation boundaries in the adhesion regions to be segmented, until different seed marker regions meet, resulting in the HP bacterial cell segmentation result image. The segmentation boundary regions between bacterial cells are marked as boundary marker regions. Connected component extraction is performed on the HP bacterial cell segmentation result image, filtering out the background marker regions and boundary marker regions in the HP bacterial cell segmentation result image, obtaining independent connected components for each HP bacterial cell, denoted as HP bacterial cell connected components. Thus, each connected component corresponds to a complete HP bacterial cell.This method effectively solves the problem of individual separation difficulties caused by HP cell adhesion, avoids over-segmentation and under-segmentation, ensures the integrity and independence of each cell region, and provides reliable basic data for subsequent multi-dimensional feature extraction such as geometric features and skeleton curvature features, significantly improving the accuracy and robustness of HP cell identification. After obtaining the HP cell connected components, the confidence score of each HP cell connected component is calculated to filter candidate regions. Specifically, geometric features, skeleton, and curvature features are extracted for each HP cell connected component to obtain geometric features and skeleton curvature features. Geometric features include the extraction of parameters such as area, perimeter, aspect ratio, roundness, compactness (the compactness formula is A / ab, where A is the total number of foreground pixels in the HP cell connected component, a is the length of the major semi-axis of the circumscribed ellipse of the HP cell connected component, and b is the length of the minor semi-axis of the circumscribed ellipse of the HP cell connected component), convexity, eccentricity, major and minor axes of the circumscribed ellipse, and orientation angle, which are used to characterize the overall contour and morphological features of the HP cell. The skeleton curvature features are obtained by first performing skeletonization processing on the HP cell connected components, extracting the cell centerline skeleton, and then calculating the curvature of each point on the skeleton. The curvature formula is used to quantitatively describe the degree of spiral, which can effectively distinguish spiral / arc HP cells from straight rod artifacts and improve the recognition accuracy. The formula is:

[0023] in,( , )and( , ) are the first and second derivatives, respectively. Curvature is defined as the degree of bending of the bacterial cell, with a larger curvature indicating a higher degree of bending. The region corresponding to the connected components of the HP bacterial cell in the scaled sub-image is designated as the ROI (Region of Interest) region. Color and texture features of the ROI region are extracted. Color features include the mean, variance, kurtosis, and ratio of the G / R channels within the ROI region. Color differences between the internal and external annular regions of the bacterial cell are also compared to distinguish the color distribution of HP cells from background impurities. Texture features are extracted using LBP (Local Binary Pattern) or GLCM (Gray-Level Co-occurrence Matrix) methods, extracting texture descriptors such as contrast, energy, entropy, and homogeneity to characterize the roughness and distribution of the HP bacterial cell surface. Geometric features, skeleton curvature features, color features, and texture features are first normalized, then fused using a fusion function to obtain a comprehensive feature vector. The comprehensive feature vector is then weighted and summed to obtain a confidence score. The confidence score is compared with a preset confidence threshold. The values ​​are compared, and if the confidence level is greater than the preset confidence threshold, the corresponding HP cell connected region is recorded as a candidate region. The weight of each feature and the preset confidence threshold can be set by the experience and professional knowledge of experts in this field. If the confidence level is greater than the preset confidence threshold, the HP cell connected region is determined to meet the characteristics of HP cells and is marked as a candidate region. When the confidence level is less than or equal to the preset confidence threshold, it is determined to be an artifact (such as impurities, bubbles, noise blocks, etc.) and is removed, and does not enter the subsequent verification process. In this way, the characteristics of HP cells can be comprehensively characterized from the aspects of morphology, structure, color, texture, etc., and the real HP cells can be accurately distinguished from various artifact interferences. Through the confidence threshold screening mechanism, invalid regions can be efficiently removed, reducing the amount of computation in subsequent verification steps, providing high-quality candidate regions for two-layer consistency verification, and laying a solid foundation for the accuracy and robustness of the final HP cell identification. After obtaining the candidate regions, a two-layer verification is performed, including geometric consistency verification and local structural consistency verification. Geometric consistency verification uses a template-matched normalized cross-correlation method: a predefined standard HP cell template (covering typical spiral / arc HP morphology) is used. The standard HP cell template is traversed through all positions in the candidate region using a preset sliding window method, and the normalized cross-correlation coefficient for each position is calculated. The formula for calculating the normalized cross-correlation coefficient is:

[0024] in, These are the coordinates of the sliding window position of the standard HP bacterial template in the candidate region. For position The normalized cross-correlation coefficient, The grayscale value at the corresponding position in the standard HP cell template can be obtained from a pre-collected template of typical HP cell morphology. The gray value corresponding to the candidate region is the normalized cross-correlation number. The closer the normalized cross-correlation number is to 1, the higher the morphology of the standard HP bacterial template is to the candidate region. Therefore, the maximum normalized cross-correlation number is taken as the maximum cross-correlation number of the candidate region. When the maximum cross-correlation number is greater than the preset cross-correlation number threshold (set by expert experience and professional knowledge), it is determined that the candidate region is highly consistent with the geometric shape of the standard HP bacterial template. If the geometric consistency verification is passed, the consistency verification is passed. Local structural consistency verification employs a combination of Harris / FAST corner detection and ORB descriptors: Corner detection is performed on both the standard HP bacterial template and candidate regions, extracting their respective corner sets; ORB descriptors are extracted for each corner within the corner set, and the ORB descriptors of all corners are combined to obtain the standard HP bacterial template descriptor set and the candidate region descriptor set, respectively; Hamming distance is used to pair the standard HP bacterial template descriptor set and the candidate region descriptor set one by one. Specifically, for each ORB descriptor in the standard HP bacterial template descriptor set, the descriptor with the smallest Hamming distance in the candidate region descriptor set is found to form a preliminary pair, resulting in multiple preliminary pairs. A preset Hamming distance threshold is used, and the Hamming distance of each preliminary pair is compared with the Hamming distance threshold. Preliminary pairs with distances smaller than the Hamming distance threshold are retained and recorded as quality matching pairs, resulting in multiple quality matching pairs; the number of quality matching pairs is divided by the total number of corners in the standard HP bacterial template to obtain the matching rate. If the matching rate is greater than the preset matching rate threshold, it indicates that the positional offset of the quality matching pair meets the preset geometric constraints. (e.g., affine transformation consistency) If the candidate region is found to be highly consistent with the local structure of the standard HP bacterial template, the consistency verification is passed. The preset Hamming distance threshold and matching rate threshold can be set according to the professional knowledge and experience of those in the field. Only when the two-layer verification is passed is the candidate region marked as a reliable candidate region. Through a two-layer verification mechanism combining geometric consistency verification and local structural consistency verification, the candidate region is accurately verified from two dimensions: global morphology and local details. Geometric consistency verification relies on the normalized cross-correlation method of template matching to verify the matching degree between the candidate region and the standard HP bacterial template at the global level, effectively suppressing the interference of artifacts with significant morphological differences. Local structural consistency verification uses corner detection and ORB descriptor extraction, combined with Hamming distance matching to calculate the matching rate, to verify the structural similarity between the candidate region and the standard HP bacterial template at the local detail level, accurately eliminating artifacts with similar morphology but disordered structure. This greatly improves the accuracy and robustness of HP bacterial recognition, effectively reduces the false detection rate of various artifacts such as bright spots, debris, and bubbles, and provides a solid guarantee for the subsequent generation of reliable HP bacterial detection boxes and final recognition results. Then, the bounding box of the reliable candidate region is obtained. Specifically, the connected component of the HP cell corresponding to the reliable candidate region is obtained. The contour search algorithm in OpenCV is used to extract the complete external contour of the HP cell within the connected component. The coordinate data of all pixels on the external contour is obtained, including the x-coordinate and y-coordinate. The coordinate data of all pixels on the external contour is traversed, and the minimum, maximum, minimum, and maximum values ​​of the x-coordinate, y-coordinate, and y-coordinate are extracted respectively. The minimum and minimum values ​​of the x-coordinate and y-coordinate are used as the coordinates of the upper left corner of the rectangle, and the maximum and maximum values ​​of the x-coordinate and y-coordinate are used as the coordinates of the lower right corner of the rectangle. Based on the upper left corner of the rectangle... The coordinates of the rectangle and the coordinates of the lower right corner of the rectangle form the smallest rectangle that can completely enclose the outer contour, which is the bounding box of the reliable candidate region. The bounding box is bound to the corresponding confidence level, and the detection boxes with bounding boxes and confidence levels are output for each scale sub-image. Based on the detection boxes of all scale sub-images, a detection box set is constructed. Non-maximum suppression detection is performed on the detection box set to obtain the standard detection box set. Specifically, all detection boxes in the detection box set are sorted from high to low confidence level, forming a sorting table A. The detection box with the highest confidence level in sorting table A is designated as the baseline box A. The intersection-union ratio (IUU) A between each other detection box in sorting table A and the baseline box A is calculated using the following formula:

[0025] In the formula, Let A be the intersection area of ​​the reference box A and all other detection boxes. Let A be the union area of ​​the reference box A and all other detection boxes. For the Cross-Union Ratio (CUNR) A, when CUNR A is greater than the preset CUNR threshold A1, the detection box is determined to point to the same HP bacteria as the reference box A, and it is assigned to the redundant group A of the reference box A; otherwise, it is determined to be a detection box of a different bacteria and is retained in the sorting table. Similarly, after removing all detection boxes contained in the redundant group A and the reference box A from the detection box set, a new sorting table is constructed, denoted as sorting table B. The detection box with the highest confidence in sorting table B is designated as the reference box B. The CUNR B of each other detection box in sorting table B and the reference box B is calculated. Detection boxes with a CUNR B greater than the preset CUNR threshold B1 are assigned to the redundant group of the reference box B, denoted as redundant group B. This operation is repeated until the detection box set is empty, resulting in multiple redundant groups. For the detection boxes in each redundant group, the detection box with the highest confidence is retained and designated as the optimal detection box. The optimal detection boxes are merged to obtain a standard detection box set. A non-maximum suppression mechanism based on confidence ranking is used to accurately divide redundant detection box groups for the same HP bacterium using the intersection-union ratio (IU) as a constraint. Only the detection boxes with the highest built-in confidence in each group are retained. This effectively eliminates the problem of duplicate detection of the same bacterium across scales and sub-images, while ensuring the reliability and accuracy of the detection results for each HP bacterium. The iterative grouping logic ensures that all detection boxes are fully screened, avoiding missed detections or false deletions. Finally, the standard detection box set is mapped back to the original coordinates of the sub-image to generate the first sub-image with a rectangle and confidence score. This scheme uses an OpenCV-based HP recognition process. The entire processing chain uses explicit rules and interpretable features, eliminating the need to train a deep model. Parameters can be managed using configuration files, facilitating cross-device and batch processing reproducibility.

[0026] In one embodiment, a computer vision-based intelligent identification system for Helicobacter pylori is disclosed, such as... Figure 2 As shown, the identification system includes: The acquisition module is used to collect gastric mucosal samples under gastroscopy. The gastric mucosal samples are specifically labeled by acridine orange immunofluorescence staining to obtain images labeled with acridine orange fluorescent probes. The images are then preprocessed to obtain HP fluorescent staining images. The segmentation module is used to segment the HP fluorescence staining image to obtain multiple sub-images, and uses the coordinate information of the predetermined orientation of each sub-image as the first coordinate information. The predetermined orientation is the upper left corner of each sub-image in the HP fluorescence staining image. The recognition module performs multiple operations on each sub-image based on the OpenCV algorithm and outputs the first sub-image with a bounding box and confidence score. The stitching module is used to stitch together the position coordinates of the rectangle attached to the first sub-image with the first information coordinates on the corresponding sub-image to generate a labeled map with HP position, quantity and shape distribution. The interpretation module is used to perform comprehensive analysis on the labeled map, intelligently determine the HP infection status and infection level, and output a structured detection report.

[0027] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0028] All formulas in this manual are dimensionless and calculated numerically. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters and thresholds in the formulas are set by those skilled in the art according to the actual situation.

[0029] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims

1. A method for intelligent identification of Helicobacter pylori based on computer vision processing, characterized in that, Identification methods include: Gastric mucosal samples were collected and specifically labeled using acridine orange immunofluorescence staining to obtain images labeled with acridine orange fluorescent probes. The images were then preprocessed to obtain HP fluorescent staining images. The HP fluorescence staining image is segmented to obtain multiple sub-images, and the coordinate information of the predetermined orientation of each sub-image is used as the first coordinate information. The predetermined orientation is the upper left corner of each sub-image in the HP fluorescence staining image. Perform multiple operations on each sub-image based on the OpenCV algorithm to generate a first sub-image with a bounding box and confidence score. The position coordinates attached to the rectangle in the first sub-image are combined with the first information coordinates on the corresponding sub-image to generate a labeled map with HP location, quantity and morphological distribution. The system performs comprehensive analysis of the labeled images, intelligently determines the HP infection status and infection level, and outputs a structured detection report.

2. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 1, characterized in that, The method for generating the first sub-image with a bounding box and confidence score is as follows: Sub-images are input into a pre-constructed multi-scale pyramid to obtain sub-images at multiple scales; threshold segmentation is performed on each scale sub-image to obtain the first binary image; opening and closing morphological operations of elliptical structural elements are applied to the first binary image to obtain the second binary image; distance transformation and label generation are performed on the second binary image to obtain the foreground label image, and the watershed algorithm is used to separate individuals to obtain the independent connected components of each HP cell, denoted as the HP cell connected component; Calculate the confidence score of each HP cell connected component to filter out candidate regions; perform double-layer validation on the candidate regions, and mark the candidate regions as reliable candidate regions when the double-layer validation passes; obtain the bounding boxes of the reliable candidate regions, bind the bounding boxes to the corresponding confidence scores, and output the detection boxes with bounding boxes and confidence scores for each scale sub-image. Construct a set of detection boxes based on the detection boxes of all scale sub-images; Non-maximum suppression detection is performed on the detection box set to obtain the standard detection box set; Map the standard detection box set back to the original coordinates of the sub-image to generate the first sub-image with a rectangle and confidence score.

3. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 2, characterized in that, The method for thresholding sub-images at various scales is as follows: Thresholding segmentation includes Otsu thresholding and adaptive thresholding. It calculates the global gray-level variance within the scale sub-image and selects the optimal threshold for segmentation based on the global gray-level variance. Among them, adaptive thresholding segmentation performs segmentation by dynamically adjusting the threshold within a local window, while Otsu thresholding segmentation selects the optimal threshold for segmentation by maximizing the inter-class variance.

4. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 3, characterized in that, The method for selecting the optimal threshold segmentation based on global gray-level variance is as follows: Obtain the grayscale value of each pixel in each scale sub-image and set a segmentation threshold. Pixels with grayscale values ​​less than the segmentation threshold are classified as background pixels, and pixels with grayscale values ​​greater than or equal to the segmentation threshold are classified as foreground pixels. Based on the grayscale values ​​of all pixels in each scale sub-image, calculate the global grayscale variance of each scale sub-image. Compare the global grayscale variance with a preset grayscale variance threshold. If the global grayscale variance is less than the preset grayscale variance threshold, the Otsu threshold segmentation is recorded as the optimal threshold segmentation. If the global grayscale variance is greater than or equal to the preset grayscale variance threshold, the adaptive threshold segmentation is recorded as the optimal threshold segmentation.

5. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 3, characterized in that, The method for obtaining the connected components of HP cells is as follows: Perform Euclidean distance transformation on the second binary image. For each foreground pixel, the background pixel that is closest to the current foreground pixel is recorded as the current nearest background pixel. Calculate the Euclidean distance between the current foreground pixel and the current nearest background pixel. Generate a distance transformation map based on the Euclidean distances of all foreground pixels. Thresholding is performed on the distance transformation map to retain foreground pixels whose Euclidean distance is greater than a preset Euclidean distance threshold. All retained foreground pixels are aggregated to form a defined foreground region. Connectivity analysis is performed on the defined foreground region: using 4-neighborhood or 8-neighborhood connectivity rules, adjacent foreground pixels are aggregated into several spatially unconnected continuous pixel sets, each set being an independent connected component. A unique integer identifier is assigned to each independent connected component to obtain the foreground label map. Dilation is performed on the second binary map to generate the background label map. A watershed marker image is constructed based on the foreground marker image and the background marker image; the second binary image is used as the segmentation input image and the watershed marker image is used as the seed marker, and the watershed algorithm is executed to obtain the HP cell segmentation result image; connected component extraction is performed on the HP cell segmentation result image to obtain the independent connected component of each HP cell, which is denoted as the HP cell connected component.

6. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 2, characterized in that, The method for filtering out candidate regions is as follows: Geometric features, skeleton, and curvature features are extracted for each HP cell connected region to obtain geometric and skeleton curvature features. The region corresponding to the HP cell connected region in the scale sub-image is recorded as the cell ROI region, and color and texture features are extracted from the cell ROI region. The geometric, skeleton curvature, color, and texture features are fused using a fusion function to obtain a comprehensive feature vector, and the comprehensive feature vector is weighted and summed to obtain the confidence score. The confidence score is compared with a preset confidence threshold. If the confidence score is greater than the preset confidence threshold, the corresponding HP cell connected region is recorded as a candidate region.

7. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 2, characterized in that, The method for performing two-layer validation on candidate regions is as follows: The two-layer verification includes geometric consistency verification and local structural consistency verification. Geometric consistency verification uses template matching and normalized cross-correlation method: a predefined standard HP bacterial template is used to traverse all positions of the candidate region in a preset sliding window manner, and the normalized cross-correlation number of each position is calculated. The maximum normalized cross-correlation number is taken as the maximum cross-correlation number of the candidate region. When the maximum cross-correlation number is greater than the preset cross-correlation number threshold, the consistency verification is passed. Local structural consistency verification employs a combination of corner detection and ORB descriptors: Corner detection is performed on both the standard HP bacterial template and candidate regions, extracting their respective corner sets; ORB descriptors are extracted for each corner within the set, and the ORB descriptors of all corners are combined to obtain the standard HP bacterial template descriptor set and the candidate region descriptor set, respectively; Hamming distance is used to pair the standard HP bacterial template descriptor set and the candidate region descriptor set one by one, resulting in multiple quality matching pairs; the number of quality matching pairs is divided by the total number of corners in the standard HP bacterial template to obtain the matching rate. If the matching rate is greater than a preset matching rate threshold, the consistency verification passes.

8. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 2, characterized in that, The method for obtaining the standard detection box set is as follows: Sort all detection boxes in the detection box set from high to low confidence level and build a sorting table A. The detection box with the highest confidence level in the sorting table A is set as the baseline box A. Calculate the intersection-union ratio (IUR) A between each other detection box in the sorting table A and the baseline box A. Assign other detection boxes with IUR A greater than the preset IUR threshold A1 to the redundant group of the baseline box A and set as the redundant group A. After removing all detection boxes from the redundant group A and the baseline box A from the detection box set, a new sorting table is constructed, denoted as sorting table B. The detection box with the highest confidence in sorting table B is designated as the baseline box B. The intersection-union ratio (IUR) B between each other detection box in sorting table B and the baseline box B is calculated. Detection boxes with an IUR B greater than a preset IUR threshold B1 are assigned to the redundant group of the baseline box B, denoted as redundant group B. This operation is repeated until the detection box set is empty, resulting in multiple redundant groups. For each redundant group, the detection box with the highest confidence is retained and designated as the optimal detection box. All optimal detection boxes are merged to obtain the standard detection box set.

9. The intelligent identification method for Helicobacter pylori based on computer vision processing according to claim 2, characterized in that, The method for obtaining the bounding box of a reliable candidate region is as follows: Based on the reliable candidate region corresponding to the HP cell connected region, the contour search algorithm in OpenCV is used to extract the complete external contour of the HP cell within the connected region. The coordinate data of all pixels on the external contour are obtained, including the x-coordinate and y-coordinate. The coordinate data of all pixels on the external contour are traversed, and the minimum, maximum and minimum values ​​of the x-coordinate, and the maximum value of the y-coordinate are extracted respectively. Using the minimum values ​​of the horizontal and vertical coordinates as the coordinates of the top left corner of the rectangle, and the maximum values ​​of the horizontal and vertical coordinates as the coordinates of the bottom right corner of the rectangle, the smallest rectangle that can completely enclose the outer contour is constructed based on the coordinates of the top left and bottom right corners of the rectangle, which is the bounding box of the reliable candidate region.

10. A Helicobacter pylori intelligent identification system based on computer vision processing, implementing the Helicobacter pylori intelligent identification method based on computer vision processing as described in any one of claims 1-9, characterized in that, The identification system includes: The acquisition module is used to collect gastric mucosal samples, specifically label the gastric mucosal samples using acridine orange immunofluorescence staining, obtain images labeled with acridine orange fluorescent probes, and perform preprocessing operations on the images to obtain HP fluorescent staining images; The segmentation module is used to segment the HP fluorescence staining image to obtain multiple sub-images, and uses the coordinate information of the predetermined orientation of each sub-image as the first coordinate information. The predetermined orientation is the upper left corner of each sub-image in the HP fluorescence staining image. The recognition module performs multiple operations on each sub-image based on the OpenCV algorithm and outputs the first sub-image with a bounding box and confidence score. The stitching module is used to stitch together the position coordinates of the rectangle attached to the first sub-image with the first information coordinates on the corresponding sub-image to generate a labeled map with HP position, quantity and shape distribution. The interpretation module is used to perform comprehensive analysis on the labeled map, intelligently determine the HP infection status and infection level, and output a structured detection report.