Children intestinal tract lesion area detection method based on machine vision

Through machine vision-based detection methods, the adaptive histogram equalization of the endoscopic images is solved, which solves the problem that the prior art is difficult to accurately highlight the intestinal lesions in children, and achieves higher image enhancement accuracy and diagnostic reliability.

CN119600007AActive Publication Date: 2025-03-11XIAN CHILDRENS HOSPITAL

Patent Information

Application Number
CN202411747781.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-11
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

The prior art is difficult to accurately highlight the intestinal lesions in children when image enhancement of endoscopic images, especially in the early stage of ulcers and white pussy, which may highlight the reflective area and normal area, affecting the accuracy of diagnosis.

Method used

Using machine vision-based detection methods, by acquiring the grayscale images in the endoscope, performing threshold segmentation and density clustering, determining the shape characteristics of the ulcer area, performing partitioning and gradient analysis, obtaining edge points and areas to be optimized, further determining the target points and abnormal points, and adaptive histogram equalization is performed based on these features to enhance the contrast of the image.

Benefits of technology

Improve image enhancement accuracy, can highlight the characteristics of the ulcer area more clearly, weaken the impact of the reflective area, and thus improve the reliability of auxiliary doctors' diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119600007A_ABST
    Figure CN119600007A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image enhancement, in particular to a method for detecting an intestinal lesion area of a child based on machine vision. Carrying out threshold segmentation on the grayscale image to obtain a reference point; clustering the reference points and partitioning the grayscale image according to the shape of a cluster; acquiring edge points and a to-be-optimized area according to the gradient of the pixel points in the block area; obtaining a target point according to the gray difference characteristics of the pixel points and the edge points of the to-be-optimized region; obtaining an abnormal point according to the gray difference characteristics of the target point and other target points in the neighborhood and the gray difference characteristics of the neighborhood of the edge points; and obtaining a gray adjustment range value according to the gray difference characteristics of the neighborhoods of the abnormal points and the edge points in the to-be-optimized region. According to the method, a final gray value is obtained according to a gray adjustment range value and a gray discrete feature of an edge point neighborhood; histogram equalization is carried out according to the final gray value, an intestinal tract detection enhanced image is obtained, and the image enhancement accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image enhancement technology, and more specifically to a machine vision-based method for detecting intestinal lesions in children. Background Technology

[0002] The incidence of intestinal diseases has remained high in recent years, with a gradual increase in pediatric patients. To diagnose gastrointestinal diseases, white light endoscopy is needed to examine the intestinal tract. Under ideal conditions, the images obtained by endoscopy can provide doctors with auxiliary information for diagnosing lesions. However, in reality, endoscopy suffers from a series of serious imaging problems, such as insufficient lighting and blurry images, which hinder doctors' ability to identify lesions. Therefore, image enhancement is needed to improve the contrast of endoscopic images and highlight lesion features.

[0003] Histogram equalization is commonly used to enhance endoscopic images. However, in endoscopic images of Crohn's disease, a condition prevalent in children, ulcers are frequently observed. In the early stages of ulceration, the ulcer area darkens, making it difficult to detect in low light. Later, as the ulcer develops into a white pustule, excessive light can cause reflections inside the gastrointestinal tract, which may be mistaken for a white pustule. Therefore, directly using histogram equalization may not only fail to highlight the lesion area but may even accentuate reflective areas and other normal areas, affecting the accuracy of the endoscopic image and the reliability of its diagnostic assistance to physicians. Summary of the Invention

[0004] To address the technical problem that directly enhancing endoscopic images through histogram equalization can easily lead to inaccurate highlighting of lesion areas, the present invention aims to provide a machine vision-based method for detecting intestinal lesions in children. The specific technical solution adopted is as follows: Acquire a grayscale image of the intestine in an endoscope; perform threshold segmentation on the grayscale image to obtain reference points; perform density clustering on the reference points to obtain different clusters; obtain the partition side length based on the shape characteristics of the clusters; partition the grayscale image according to the partition side length to obtain different block regions; Edge points and regions to be optimized are obtained based on the gradient distribution characteristics of pixels in the segmented regions; target points are obtained based on the grayscale difference characteristics between the pixels in the regions to be optimized and the edge points, and the grayscale difference characteristics between other pixels in the neighborhood of the pixels and the edge points. Anomalies are obtained based on the grayscale difference features between the target point and other target points in the neighborhood, and the grayscale difference features of the neighborhood of the nearest edge point to the target point; a grayscale adjustment range value is obtained based on the grayscale difference features between the anomalies in the region to be optimized and the neighborhood of the nearest edge point; and the final grayscale value of the anomalies is obtained based on the grayscale adjustment range value and the grayscale dispersion features of the neighborhood of the edge point in the region to be optimized. Histogram equalization is performed on the segmented regions based on the gray values ​​of the pixels and the final gray values ​​of the anomalies to obtain locally enhanced gray-scale images; all locally enhanced gray-scale images are then stitched together to obtain an enhanced intestinal detection image.

[0005] Further, the step of thresholding the grayscale image to obtain reference points includes: The grayscale image is segmented according to a preset grayscale threshold, and pixels in regions exceeding the preset grayscale threshold are used as reference points.

[0006] Further, the step of obtaining the partition side length based on the shape features of the cluster includes: Calculate the ratio of the width to the length of the minimum bounding rectangle of the cluster to obtain the shape feature value of the cluster; select clusters whose shape feature value exceeds a preset shape threshold as initial clusters; use the maximum value of the Euclidean distance between any reference point in any initial cluster and the cluster center as the partitioning benchmark; calculate the product of the partitioning benchmark and a preset multiple to obtain the partition side length; the preset multiple exceeds a constant 2.

[0007] Further, the step of obtaining edge points and the region to be optimized based on the gradient distribution features of pixels in the segmented region includes: The gradient baseline value is obtained by averaging the gradient values ​​of the first quartile and the second quartile in the block region according to the quartile method; the absolute value of the difference between the gradient value of any pixel in the block region and the gradient baseline value is calculated and normalized to obtain the gradient difference feature value of any pixel; pixels whose gradient difference feature value exceeds a preset gradient threshold are designated as edge points. Calculate the sum of the average and maximum gradient difference feature values ​​of all pixels in the segmented region to obtain the probability feature value; the segmented region whose probability feature value exceeds a preset probability threshold is taken as the region to be optimized.

[0008] Further, the step of obtaining the target point based on the grayscale difference features between the pixel and the edge point in the region to be optimized, and the grayscale difference features between other pixels in the neighborhood of the pixel and the edge point, includes: Calculate the absolute value of the grayscale difference between the pixel and the nearest edge point in the region to be optimized and perform negative correlation mapping to obtain a grayscale similarity coefficient; calculate and normalize the average of the absolute values ​​of the grayscale differences between other non-edge pixels within a preset neighborhood of the pixel and the nearest edge point to obtain a neighborhood grayscale similarity coefficient; calculate the absolute value of the difference between the neighborhood grayscale similarity coefficient and the grayscale similarity coefficient to obtain a neighborhood difference feature value; calculate the product of a preset first weight and the grayscale similarity coefficient to obtain a first factor; calculate the product of a preset second weight and the neighborhood difference feature value to obtain a second factor; the preset first weight is greater than the preset second weight; calculate the sum of the first factor and the second factor to obtain the target index of the pixel; and select pixels whose target index exceeds a preset target threshold as target points.

[0009] Further, the step of obtaining anomaly points based on the grayscale difference features between the target point and other target points in the neighborhood, and the grayscale difference features of the neighborhood of the nearest edge point to the target point, includes: Calculate the average grayscale value of all target points and all edge points within a preset neighborhood of the nearest edge point to the target point, to obtain a first average grayscale value; calculate the average grayscale value of all non-target points and non-edge points within a preset neighborhood of the nearest edge point to the target point, to obtain a second average grayscale value; calculate the reciprocal of the absolute value of the difference between the first average grayscale value and the second average grayscale value, to obtain a first grayscale difference factor; calculate and normalize the variance of the grayscale values ​​within a preset neighborhood of the target point, to obtain a second grayscale difference factor; calculate the average of the first grayscale difference factor and the second grayscale difference factor, to obtain the mutation probability value of the target point; and designate target points whose mutation probability value exceeds a preset mutation threshold as outliers.

[0010] Further, the step of obtaining the grayscale adjustment range value based on the grayscale difference features between the outlier points in the region to be optimized and the nearest edge point neighborhood includes: The minimum grayscale value of the outlier points in the region to be optimized is used as the lower limit; the maximum grayscale value of the outlier points in the region to be optimized is used as the upper limit; if the upper limit is less than the minimum grayscale value of the non-target point within a preset neighborhood of the nearest edge point, the difference between the minimum grayscale value and the upper limit is calculated to obtain a first adjustment benchmark; the difference between the lower limit and the first adjustment benchmark is calculated to obtain a minimum adjustment range; the difference between the minimum adjustment range and the grayscale value of any outlier point in the region to be optimized is calculated to obtain the grayscale adjustment range value of the any outlier point. If the lower limit is greater than the maximum gray value of a non-target point within a preset neighborhood of the nearest edge point, calculate the difference between the lower limit and the maximum gray value to obtain a second adjustment benchmark; calculate the difference between the upper limit and the second adjustment benchmark to obtain a maximum adjustment range; calculate the difference between the maximum adjustment range and the gray value of any abnormal point in the region to be optimized to obtain the gray adjustment range value of the arbitrary abnormal point.

[0011] Further, the step of obtaining the final gray value of the outlier based on the gray-level adjustment range value and the gray-level discrete features of the neighborhood of the edge point in the region to be optimized includes: Calculate the average grayscale value of non-abnormal points within a preset neighborhood of the edge point to obtain the neighborhood grayscale average value; calculate the average of the absolute values ​​of the differences between the grayscale values ​​of non-abnormal points within the preset neighborhood of the edge point and the neighborhood grayscale average value to obtain the grayscale discrete feature value of the edge point; calculate the average grayscale discrete feature value of all edge points in the region to be optimized and normalize it to obtain the average grayscale discrete feature value; calculate the product of the grayscale adjustment range value and the average grayscale discrete feature value to obtain the grayscale adjustment factor; calculate the sum of the grayscale value of the abnormal point and the grayscale adjustment factor and round it to obtain the final grayscale value of the abnormal point.

[0012] The present invention has the following beneficial effects: In this invention, obtaining reference points can identify some obvious ulcer areas, providing a basis for image partitioning; obtaining clusters can determine the true ulcer areas based on their shape characteristics, allowing the partition side length to be slightly larger than the ulcer area, thus ensuring that each partition area contains at least one type of ulcer area, initially improving the accuracy of image enhancement. Obtaining edge points and areas to be optimized can distinguish between ulcer areas and normal intestine based on their differences, further determining the partition areas requiring adaptive histogram equalization; obtaining target points can select specific pixels to be adjusted based on the gray-level difference between pixels in normal intestine and ulcer areas, further improving the accuracy of image enhancement. Obtaining anomaly points can further distinguish target points based on the feature differences between ulcer areas and reflective areas in the image, thus determining the pixels in ulcer areas that need adjustment. Obtaining gray-level adjustment range values ​​can further limit the degree of gray-level adjustment of pixels based on the lesion severity of the ulcer area, improving the accuracy of the final histogram equalization. Obtaining the final gray-level value can be corrected based on the neighborhood gray-level features of the anomaly points, avoiding over-enhancement. Finally, different degrees of image enhancement were applied to different segmented regions, improving the accuracy of image enhancement. Obtaining enhanced images for intestinal detection can weaken reflective areas while improving the contrast of ulcer areas, resulting in more accurate histogram equalization and improved reliability in assisting doctors in diagnosis. Attached Figure Description

[0013] 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.

[0014] Figure 1 A flowchart of a machine vision-based method for detecting intestinal lesions in children, provided as an embodiment of the present invention; Figure 2 This is an example image of an enhanced intestinal detection image provided in one embodiment of the present invention. Detailed Implementation

[0015] 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 machine vision-based method for detecting intestinal lesions in children 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.

[0016] 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.

[0017] The following description, in conjunction with the accompanying drawings, details a specific scheme for a machine vision-based method for detecting intestinal lesions in children provided by this invention.

[0018] Please see Figure 1 The diagram illustrates a flowchart of a machine vision-based method for detecting intestinal lesions in children, according to an embodiment of the present invention. The method includes the following steps: Step S1: Acquire a grayscale image of the intestine in the endoscope; perform threshold segmentation on the grayscale image to obtain reference points; perform density clustering on the reference points to obtain different clusters; obtain the partition side length based on the shape characteristics of the clusters; partition the grayscale image according to the partition side length to obtain different block regions.

[0019] In this embodiment of the invention, the implementation scenario involves enhancing endoscopic images of the intestine using histogram equalization to improve the accuracy of image enhancement and the reliability of assisting doctors in diagnosis. First, a grayscale image of the intestine from the endoscope is acquired. To highlight ulcer lesions in the image, the location of the ulcer region needs to be determined, thereby improving the accuracy of histogram equalization. Typically, obvious ulcer regions exhibit a circular or elliptical shape with relatively regular shapes. Therefore, the pixels representing the ulcer will cluster within a certain range. This allows for partitioning based on the ulcer size, and adaptive image enhancement can be performed on different regions of the grayscale image to improve the accuracy of image enhancement.

[0020] Furthermore, since obvious ulcer areas appear as white pustules and exhibit a distinct circular shape in grayscale images, reference points can be obtained by thresholding the grayscale image. Specifically, this involves thresholding the grayscale image according to a preset grayscale threshold, and using pixels in areas exceeding the preset grayscale threshold as reference points. In this embodiment, the preset grayscale threshold is 120, which can be determined by the implementer based on the implementation scenario. Areas with high grayscale values ​​in the grayscale image may be reflective areas caused by endoscopic illumination or ulcer areas; therefore, the obtained reference points are pixels in ulcer areas and pixels in reflective areas. It is then necessary to distinguish these reference points to determine those representing ulcer areas. Since ulcer areas are circular and relatively regular in shape, the reference points can be clustered. Obvious ulcer areas are determined based on the cluster shape. Therefore, density clustering is performed on the reference points to obtain different clusters. In this embodiment, the existing DBSCAN density clustering algorithm is used for clustering; the specific steps are not detailed here. Some of these clusters represent different ulcer regions in the intestine. These clusters are roughly circular in shape, so the side length of the partitions can be obtained based on the shape characteristics of the clusters.

[0021] Preferably, in this embodiment of the invention, the step of obtaining the partition side length includes: calculating the ratio of the width to the length of the minimum bounding rectangle of the cluster to obtain the shape feature value of the cluster; when the width and length are closer, the shape feature value is closer to a constant 1, meaning that the minimum bounding rectangle is closer to a square, the cluster is more likely to be circular, and more likely to be a significant ulcer region. Clusters with shape feature values ​​exceeding a preset shape threshold are selected as initial clusters; in this embodiment of the invention, the preset shape threshold is 0.8, which can be determined by the implementer according to the implementation scenario. The initial clusters represent clusters with significant ulcer regions. The maximum value of the Euclidean distance between any reference point in any initial cluster and the cluster center is used as the partitioning benchmark; the partitioning benchmark is close to the radius of the ulcer region. The partition side length is obtained by multiplying the partition baseline by a preset multiple. The preset multiple exceeds a constant of 2; in this embodiment, it is 2.5, ensuring the partition side length is slightly larger than the length of the largest ulcer region. This aims to ensure that each partition contains only one ulcer region, effectively differentiating ulcer regions of varying degrees and making image enhancement more closely match the characteristics of the ulcer region within that partition. The grayscale image is then partitioned according to the partition side length to obtain different block regions. A grid with a length equal to the partition side length is constructed, with each grid representing a block region.

[0022] Step S2: Obtain edge points and regions to be optimized based on the gradient distribution characteristics of pixels in the segmented regions; obtain target points based on the grayscale difference characteristics between pixels and edge points in the regions to be optimized, and the grayscale difference characteristics between other pixels in the neighborhood of the pixel and edge points.

[0023] After obtaining different block regions, it is necessary to obtain the pixels representing ulcer areas of different degrees in each block region. When ulcer areas appear in a block region, they will differ from normal gastrointestinal areas, and the gray values ​​will change to a certain extent, which can easily generate edge pixels. Therefore, if there are edge points in a block region, it means that there are ulcer areas or reflective areas in that area. Therefore, the edge points and areas to be optimized are obtained based on the gradient distribution characteristics of the pixels in the block region.

[0024] Preferably, in this embodiment of the invention, the steps of obtaining edge points and the region to be optimized include: calculating the average of the gradient values ​​of the first quartile and the second quartile in the block region according to the quartile method to obtain a gradient baseline value; since the gradient value of edge points is often greater than the gradient value of other pixels, and the number of edge points is less than half of the pixels in the block region, edge points can be determined by the quartile method, and the gradient baseline value characterizes the level of the gradient value in the block region that is moderately low. Calculate and normalize the absolute value of the difference between the gradient value of any pixel in the block region and the gradient baseline value to obtain the gradient difference feature value of that pixel; the larger the gradient difference feature value, the more likely that the pixel is an edge point. Pixels with gradient difference feature values ​​exceeding a preset gradient threshold are regarded as edge points; in this embodiment of the invention, the preset gradient threshold is 0.7, which can be determined by the implementer according to the implementation scenario. The sum of the average and maximum gradient difference feature values ​​of all pixels in the segmented region is calculated to obtain the probability feature value. A larger average gradient difference feature value indicates more pixels with larger gradient values ​​in the segmented region; a larger maximum gradient difference feature value indicates more obvious edge points in the segmented region. Therefore, a larger probability feature value indicates a higher likelihood of edge points in the segmented region. Segmented regions with probability feature values ​​exceeding a preset probability threshold are designated as regions to be optimized. In this embodiment, the preset probability threshold is 1.3, which can be determined by the implementer based on the implementation scenario. If a segmented region is not to be optimized, it means that the segmented region is a normal gastrointestinal image region, and adaptive image enhancement is not required for this region.

[0025] Furthermore, after obtaining different regions to be optimized, it is necessary to identify the pixels that may be ulcer areas. The edge points caused by ulcer areas and reflective areas have significant grayscale differences compared to the pixels in normal gastrointestinal tract, while the grayscale of pixels in normal areas is similar. Therefore, the target point can be obtained based on the grayscale difference characteristics between the pixels in the region to be optimized and the edge points, as well as the grayscale difference characteristics between other pixels in the neighborhood of the pixel and the edge points.

[0026] Preferably, in this embodiment of the invention, the step of obtaining the target point includes: calculating the absolute value of the grayscale difference between a pixel in the region to be optimized and the nearest edge point, and performing a negative correlation mapping to obtain a grayscale similarity coefficient; the larger the grayscale difference between the pixel and the nearest edge point, the more likely the pixel is to be a normal pixel, and the smaller the grayscale similarity coefficient. The average value of the absolute grayscale difference between other non-edge pixels within a preset neighborhood of the pixel and the nearest edge point is calculated and normalized to obtain a neighborhood grayscale similarity coefficient; the neighborhood grayscale similarity coefficient characterizes the grayscale difference features between the pixel's neighboring pixels and the nearest edge point. In this embodiment of the invention, the preset neighborhood range is the eight-neighborhood of the pixel. The absolute value of the difference between the neighborhood grayscale similarity coefficient and the grayscale similarity coefficient is calculated to obtain a neighborhood difference feature value; the smaller the neighborhood difference feature value, the more similar the grayscale features of the pixel are to its neighboring pixels. Calculate the product of a preset first weight and a gray-level similarity coefficient to obtain a first factor; calculate the product of a preset second weight and a neighborhood difference feature value to obtain a second factor; the preset first weight is greater than the preset second weight; in this embodiment, the preset first weight is 0.7 and the preset second weight is 0.3. Calculate the sum of the first factor and the second factor to obtain the target index of the pixel; the smaller the first and second factors, the greater the gray-level difference between the pixel and the edge point, and the more similar the gray-level features of the pixel to its neighboring pixels, the more likely the pixel is a normal gastrointestinal pixel. Pixels with a target index exceeding a preset target threshold are designated as target points; in this embodiment, the preset target threshold is 0.6, which can be determined by the implementer according to the implementation scenario. Target points represent pixels of abnormal gastrointestinal function, possibly pixels in ulcer areas or reflective areas. The formula for obtaining the target index includes: In the formula, W represents the target index of the pixel. This indicates the preset first weight. This indicates that a second weight is preset. Let R represent an exponential function with the natural constant as the base, where R represents the gray value of the pixel, and T represents the gray value of the nearest edge point of the pixel. H represents the gray-level similarity coefficient, and H represents the neighborhood gray-level similarity coefficient. Represents the neighborhood difference feature value. Indicates the first factor. This indicates the second factor.

[0027] Step S3: Obtain outlier points based on the grayscale difference features between the target point and other target points in the neighborhood, and the grayscale difference features of the neighborhood of the nearest edge point to the target point; obtain the grayscale adjustment range value based on the grayscale difference features between the outlier point in the region to be optimized and the neighborhood of the nearest edge point; obtain the final grayscale value of the outlier point based on the grayscale adjustment range value and the grayscale dispersion features of the neighborhood of the edge point in the region to be optimized.

[0028] Since the target point may be a pixel in the ulcer area or the reflective area, further identification of the target point is needed to accurately increase the contrast of the ulcer area, distinguishing between target points in the ulcer area and those in the reflective area. The reflective area, caused by endoscopic illumination, has relatively uniform brightness; moreover, the grayscale value of the illuminated area is large, showing a significant difference from the grayscale values ​​of surrounding normal intestinal pixels. In contrast, the grayscale value of the ulcer area varies to some extent, and the difference from the grayscale values ​​of surrounding normal intestinal pixels is smaller. Therefore, abnormal points can be identified based on the grayscale difference characteristics between the target point and other neighboring target points, as well as the grayscale difference characteristics of the neighborhood of the nearest edge point to the target point.

[0029] Preferably, in this embodiment of the invention, the step of obtaining abnormal points includes: calculating the average grayscale value of all target points and all edge points within a preset neighborhood of the nearest edge point to the target point, to obtain a first average grayscale value. Since the target point may be located at the center of an ulcer area and a reflective area, and other pixels in its neighborhood are all target points of the same type, it is necessary to rely on the nearest edge point of the same type as the target point. The neighborhood of this edge point contains both target points of the same type and pixels of normal gastrointestinal tract. Calculate the average grayscale value of all non-target points and non-edge points within a preset neighborhood of the nearest edge point to the target point, to obtain a second average grayscale value; calculate the reciprocal of the absolute value of the difference between the first average grayscale value and the second average grayscale value to obtain a first grayscale difference factor; the larger the difference between the first average grayscale value and the second average grayscale value, the smaller the first grayscale difference factor, meaning that the target point is more likely to be in a reflective area; conversely, the larger the first grayscale difference factor, the more likely the target point is to be in an ulcer area. The variance of grayscale values ​​within a preset neighborhood of the target point is calculated and normalized to obtain a second grayscale difference factor. A larger second grayscale difference factor indicates a greater difference in grayscale values ​​between the target point and pixels within the preset neighborhood, making it more likely to be an ulcer region. The average of the first and second grayscale difference factors is calculated to obtain the mutation probability value of the target point. A larger mutation probability value indicates a greater likelihood that the target point is located in a lesioned ulcer region. Target points with mutation probability values ​​exceeding a preset mutation threshold are considered outliers. In this embodiment, the preset mutation threshold is 0.6, which can be determined by the implementer based on the implementation scenario. Outliers represent pixels in the area to be optimized where ulcer regions are located. The grayscale values ​​of these outliers need to be adjusted to increase the contrast after image enhancement. The formula for obtaining the mutation probability value includes: In the formula, Q represents the mutation probability value of the target point, and B represents the number of target points and edge points within the preset neighborhood of the nearest edge point to the target point. This represents the grayscale value of the b-th target point or edge point, and D represents the number of non-target points and non-edge points within a preset neighborhood of the nearest edge point to this target point. This represents the gray value of the d-th non-target point or non-edge point. This represents the first average gray value. This represents the second average gray value. Let E represent the first grayscale difference factor, and let E represent the variance of the grayscale values ​​within the preset neighborhood range of the target point. Represents the normalization function. This represents the second grayscale difference factor.

[0030] Furthermore, after identifying the outliers representing ulcer regions in the region to be optimized, the gray values ​​of these outliers can be adjusted to increase the contrast of the ulcer region after histogram equalization. Since different ulcer regions within the intestine are at different stages of lesion, their gray values ​​differ in the image. Some early-stage ulcers have lower gray values ​​than normal intestinal pixels, while some late-stage ulcers have higher gray values. To increase image contrast, the gray values ​​of outliers with lower gray values ​​need to be further reduced, and the gray values ​​of outliers with higher gray values ​​need to be further increased. Therefore, the gray value adjustment range is obtained based on the gray value difference characteristics between the outliers and their nearest edge neighborhoods in the region to be optimized.

[0031] Preferably, in this embodiment of the invention, the step of obtaining the grayscale adjustment range value includes: taking the minimum grayscale value of the abnormal points in the region to be optimized as the lower limit value; taking the maximum grayscale value of the abnormal points in the region to be optimized as the upper limit value; if the upper limit value is less than the minimum grayscale value of the non-target point within the preset neighborhood of the nearest edge point, it means that the ulcer region in the region to be optimized is in its initial stage and the grayscale value is low, and the grayscale value needs to be further reduced in order to highlight the ulcer region; calculating the difference between the minimum grayscale value and the upper limit value to obtain a first adjustment benchmark; the first adjustment benchmark is the difference between the maximum grayscale value of the abnormal points in the region to be optimized and the minimum grayscale value of the normal intestinal pixel, which characterizes the grayscale difference between the ulcer region and the intestinal region in the normal image. Calculating the difference between the lower limit value and the first adjustment benchmark to obtain the minimum adjustment range; the minimum adjustment range is the degree to which the abnormal points in the region to be optimized can be reduced. Calculating the difference between the minimum adjustment range and the grayscale value of any abnormal point in the region to be optimized to obtain the grayscale adjustment range value of the arbitrary abnormal point; the grayscale adjustment range value is a negative value.

[0032] Furthermore, if the lower limit is greater than the maximum grayscale value of non-target points within the preset neighborhood of the nearest edge point, it means that the ulcer region in the region to be optimized is in a later stage and has a higher grayscale value. The difference between the lower limit and the maximum grayscale value is calculated to obtain the second adjustment benchmark. The second adjustment benchmark characterizes the grayscale difference between the ulcer region and the normal intestinal region in the region to be optimized. The difference between the upper limit and the second adjustment benchmark is calculated to obtain the maximum adjustment range. The maximum adjustment range is the degree to which abnormal points in the region to be optimized can be adjusted upwards. The difference between the maximum adjustment range and the grayscale value of any abnormal point in the region to be optimized is calculated to obtain the grayscale adjustment range value of that abnormal point. This grayscale adjustment range value is positive.

[0033] After obtaining the grayscale adjustment range value of the abnormal points in the region to be optimized, in order to highlight the ulcer area while avoiding over-enhancement, it is necessary to analyze the grayscale features in the region to be optimized; therefore, the final grayscale value of the abnormal points is obtained based on the grayscale adjustment range value and the grayscale discrete features of the neighborhood of the edge points of the region to be optimized.

[0034] Preferably, in this embodiment of the invention, the step of obtaining the final grayscale value includes: calculating the average grayscale value of non-abnormal points within a preset neighborhood of the edge point to obtain the neighborhood grayscale average value; calculating the average of the absolute values ​​of the differences between the grayscale values ​​of non-abnormal points within the preset neighborhood of the edge point and the neighborhood grayscale average value to obtain the grayscale discrete feature value of the edge point; the grayscale discrete feature value characterizes the grayscale distribution in the neighborhood of the edge point. If the grayscale discrete feature value is larger, it means that the grayscale distribution is more uneven. The average grayscale discrete feature value of all edge points in the region to be optimized is calculated and normalized to obtain the average grayscale discrete feature value; when the average grayscale discrete feature value is larger, it means that the grayscale distribution of pixels in the region to be optimized is more uneven, and a higher degree of adjustment of the grayscale value of abnormal points is required; when the average grayscale discrete feature value is smaller, it means that the grayscale distribution of pixels in the region to be optimized is more uniform, and a significant contrast can be obtained without a large degree of adjustment of the grayscale value of abnormal points. The grayscale adjustment factor is obtained by multiplying the grayscale adjustment range value by the average grayscale discrete feature value. A larger absolute value of the grayscale adjustment factor indicates a greater grayscale adjustment. The sum of the grayscale value of the outlier and the grayscale adjustment factor is calculated and rounded to obtain the final grayscale value of the outlier. The final grayscale value is adjusted according to the severity of the lesion in the ulcer region where the outlier is located, so that subsequent image enhancement can better highlight the features of the ulcer region, thereby improving the reliability of endoscopic images in assisting doctors in diagnosis.

[0035] Step S4: Perform histogram equalization on the segmented regions based on the gray values ​​of the pixels and the final gray values ​​of the outliers to obtain locally enhanced grayscale images; stitch all locally enhanced grayscale images together to obtain an enhanced intestinal detection image.

[0036] After obtaining the final grayscale values ​​of outliers in the region to be optimized, histogram equalization can be performed on the segmented regions based on the grayscale values ​​of the individual pixels and the final grayscale values ​​of the outliers to obtain locally enhanced grayscale images. It should be noted that histogram equalization is an existing technology, and the specific steps will not be elaborated further. After obtaining the locally enhanced grayscale images of each region, all locally enhanced grayscale images can be stitched together to obtain an enhanced intestinal detection image; for example... Figure 2 An example image of intestinal detection enhancement is shown. Compared with the original grayscale image, the intestinal detection enhancement image can highlight the features of the ulcer area, improve the accuracy of image enhancement and the reliability of assisting doctors in diagnosis.

[0037] In summary, this invention provides a machine vision-based method for detecting intestinal lesions in children. The method involves threshold segmentation of a grayscale image to obtain reference points; clustering the reference points and partitioning the grayscale image according to the shape of the clusters; obtaining edge points and regions to be optimized based on the gradient of pixels in the partitioned regions; obtaining target points based on the grayscale difference features between pixels in the region to be optimized and edge points; obtaining anomalies based on the grayscale difference features between the target points and other target points in their neighborhood, and the grayscale difference features of the neighborhood of edge points; and obtaining a grayscale adjustment range value based on the grayscale difference features between the anomalies in the region to be optimized and the neighborhood of edge points. This invention obtains the final grayscale value based on the grayscale adjustment range value and the grayscale discrete features of the neighborhood of edge points; and performs histogram equalization based on the final grayscale value to obtain an enhanced intestinal detection image, thus improving the accuracy of image enhancement.

[0038] 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.

[0039] 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 intestinal lesion areas in children based on machine vision, characterized in that: The method comprises the following steps: Acquire a grayscale image of the intestine in an endoscope; perform threshold segmentation on the grayscale image to obtain reference points; perform density clustering on the reference points to obtain different clustering clusters; obtain partition side lengths according to shape features of the clustering clusters; partition the grayscale image according to the partition side lengths to obtain different block areas; Obtain edge points and the area to be optimized according to the gradient distribution characteristics of the pixel points in the block area; obtain target points according to the grayscale difference characteristics between the pixel points in the area to be optimized and the edge points, and the grayscale difference characteristics between other pixel points in the neighborhood of the pixel points and the edge points; Obtain an outlier point according to the grayscale difference characteristics between the target point and other target points in the neighborhood and the grayscale difference characteristics of the edge point neighborhood closest to the target point; obtain a grayscale adjustment range value according to the grayscale difference characteristics between the outlier point in the area to be optimized and the nearest edge point neighborhood; obtain a final grayscale value of the outlier point according to the grayscale adjustment range value and the grayscale discrete characteristics of the edge point neighborhood in the area to be optimized; The block area is subjected to histogram equalization processing according to the grayscale value of the pixel point and the final grayscale value of the abnormal point to obtain a local enhanced grayscale image; and all the local enhanced grayscale images are spliced ​​to obtain an intestinal detection enhanced image.

2. The method for detecting intestinal lesion areas in children based on machine vision according to claim 1, characterized in that: The step of performing threshold segmentation on the grayscale image to obtain reference points comprises: The grayscale image is subjected to threshold segmentation according to a preset grayscale threshold, and pixel points in an area exceeding the preset grayscale threshold are used as reference points.

3. The method for detecting intestinal lesion areas in children based on machine vision according to claim 1, characterized in that: The step of obtaining the partition side length according to the shape characteristics of the cluster comprises: Calculate the ratio of the width to the length of the minimum circumscribed rectangle of the cluster to obtain the shape feature value of the cluster; take the cluster whose shape feature value exceeds the preset shape threshold as the preliminary cluster; take the maximum value of the Euclidean distance between any reference point and the cluster center in any preliminary cluster as the partition reference; calculate the product of the partition reference and a preset multiple to obtain the partition side length; the preset multiple exceeds the constant 2.

4. The method for detecting intestinal lesion areas in children based on machine vision according to claim 1, characterized in that: The step of obtaining edge points and areas to be optimized according to the gradient distribution characteristics of the pixels in the block area comprises: Calculate the average value of the gradient values ​​of the first quartile and the second quartile in the block area according to the quartile method to obtain the gradient reference value; calculate the absolute value of the difference between the gradient value of any pixel point in the block area and the gradient reference value and normalize them to obtain the gradient difference characteristic value of the any pixel point; and take the pixel point whose gradient difference characteristic value exceeds the preset gradient threshold as the edge point; The average value of the gradient difference characteristic values ​​of all pixels in the block area and the sum of the maximum value of the gradient difference characteristic value are calculated to obtain a probability characteristic value; and the block area whose probability characteristic value exceeds a preset probability threshold is used as the area to be optimized.

5. The method for detecting intestinal lesion areas in children based on machine vision according to claim 1, characterized in that: The step of obtaining the target point according to the grayscale difference characteristics between the pixel point and the edge point in the area to be optimized and the grayscale difference characteristics between other pixel points in the neighborhood of the pixel point and the edge point comprises: The absolute value of the grayscale difference between the pixel point and the nearest edge point in the area to be optimized is calculated and negatively correlated to obtain a grayscale similarity coefficient; the average value of the absolute value of the grayscale difference between other pixel points that are not edge points in the preset neighborhood range of the pixel point and the nearest edge point is calculated and normalized to obtain a neighborhood grayscale similarity coefficient; the absolute value of the difference between the neighborhood grayscale similarity coefficient and the grayscale similarity coefficient is calculated to obtain a neighborhood difference eigenvalue; the product of a preset first weight and the grayscale similarity coefficient is calculated to obtain a first factor; the product of a preset second weight and the neighborhood difference eigenvalue is calculated to obtain a second factor; the preset first weight is greater than the preset second weight; the sum of the first factor and the second factor is calculated to obtain a target index of the pixel point; the pixel point whose target index exceeds a preset target threshold is taken as the target point.

6. The method for detecting intestinal lesion areas in children based on machine vision according to claim 1, characterized in that: The step of obtaining an outlier point according to the grayscale difference characteristics between the target point and other target points in the neighborhood and the grayscale difference characteristics of the neighborhood of the edge point closest to the target point comprises: Calculate the grayscale average of all target points and all edge points within a preset neighborhood of the edge point closest to the target point to obtain a first average grayscale value; calculate the grayscale average of all non-target points and non-edge points within a preset neighborhood of the edge point closest to the target point to obtain a second average grayscale value; calculate the reciprocal of the absolute value of the difference between the first average grayscale value and the second average grayscale value to obtain a first grayscale difference factor; calculate the variance of the grayscale values ​​within the preset neighborhood of the target point and normalize it to obtain a second grayscale difference factor; calculate the average of the first grayscale difference factor and the second grayscale difference factor to obtain a mutation probability value of the target point; and take the target point whose mutation probability value exceeds a preset mutation threshold as the abnormal point.

7. The method for detecting intestinal lesion areas in children based on machine vision according to claim 1, characterized in that: The step of obtaining the grayscale adjustment range value according to the grayscale difference characteristics between the abnormal point in the area to be optimized and the nearest edge point neighborhood comprises: The minimum value of the grayscale value of the outlier point in the area to be optimized is taken as the lower limit value; the maximum value of the grayscale value of the outlier point in the area to be optimized is taken as the upper limit value; if the upper limit value is less than the minimum grayscale value of the non-target point within the preset neighborhood range of the nearest edge point, the difference between the minimum grayscale value and the upper limit value is calculated to obtain a first adjustment reference; the difference between the lower limit value and the first adjustment reference is calculated to obtain a minimum adjustment range; the difference between the minimum adjustment range and the grayscale value of any outlier point in the area to be optimized is calculated to obtain a grayscale adjustment range value of any outlier point; If the lower limit value is greater than the maximum grayscale value of the non-target point within the preset neighborhood range of the nearest edge point, calculate the difference between the lower limit value and the maximum grayscale value to obtain a second adjustment reference; calculate the difference between the upper limit value and the second adjustment reference to obtain a maximum adjustment range; calculate the difference between the maximum adjustment range and the grayscale value of any outlier point in the area to be optimized to obtain the grayscale adjustment range value of the any outlier point.

8. The method for detecting intestinal lesion areas in children based on machine vision according to claim 1, characterized in that: The step of obtaining the final grayscale value of the outlier point according to the grayscale adjustment range value and the grayscale discrete characteristics of the edge point neighborhood of the area to be optimized comprises: Calculate the average grayscale value of non-outlier points within the preset neighborhood range of the edge point to obtain the neighborhood grayscale average value; calculate the average absolute value of the difference between the grayscale value of non-outlier points within the preset neighborhood range of the edge point and the neighborhood grayscale average value to obtain the grayscale discrete eigenvalue of the edge point; calculate the average grayscale discrete eigenvalue of all edge points in the area to be optimized and normalize them to obtain the average grayscale discrete eigenvalue; calculate the product of the grayscale adjustment range value and the average grayscale discrete eigenvalue to obtain the grayscale adjustment factor; calculate the sum of the grayscale value of the outlier point and the grayscale adjustment factor and round them to obtain the final grayscale value of the outlier point.

Citation Information

Patent Citations

  • Enhancement optimization method for liver ultrasonic image

    CN116523802A

  • General surgical operation image acquisition method based on image enhancement

    CN116883537A

  • CT data processing system for assisting pediatric infectious inflammation detection

    CN117474823A

  • Coronary artery angiography enhancement method for cardiology department interventional therapy

    CN117689552A

  • Endoscopic image processing method and equipment

    CN118628362A

Cited By

  • X-ray image processing system for enteritis prognosis analysis

    CN120339291A

  • Social intervention training method and system for autistic children

    CN120355931A

  • Social intervention training method and system for children with autism

    CN120355931B

  • Intestinal ulcer area intelligent segmentation system based on neural network

    CN120997234A

  • Coal mine robot inspection image acquisition and analysis system based on machine vision

    CN121981894A