Lesion tissue detection and optimization method based on endoscope

By performing noise reduction processing and feature extraction on the endoscopic image, the problems of low contrast and noise in the endoscopic image are solved, and the accurate detection and positioning of the lesion tissue is achieved, and the accuracy of diagnosis is improved.

CN120047378APending Publication Date: 2025-05-27MEDICAL GRAPHICS TECH (JIANGXI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411849539.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

Low contrast, noise and blur of endoscopic images lead to difficulties in detecting and localizing lesion tissue.

Method used

Images of the lesion area are taken through the endoscope's camera and the images are denoised, including Gaussian filtering, image binarization, edge detection and local texture feature extraction.

Benefits of technology

Improve image quality and clarity, enable more accurate separation of lesion areas and backgrounds, capture subtle lesion features and details, and help doctors make accurate diagnosis and treatment decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047378A_ABST
    Figure CN120047378A_ABST
Patent Text Reader

Abstract

The invention relates to a lesion tissue detection and optimization method based on an endoscope, and relates to the technical field of image processing, an image of a lesion area is shot through a camera of the endoscope, noise reduction processing is carried out on the image, weighted average is carried out on pixels by using Gaussian filtering to smooth the image, the image noise influence is reduced, and the image quality is improved. Converting the noise-reduced image into a grayscale image, carrying out image binaryzation, dividing the grayscale image into a black layer and a white layer, calculating the gradient magnitude and direction of the image according to the binarized image, separating a lesion area from a background by using an edge detection algorithm, and in the lesion area separated from the background, carrying out image segmentation on the lesion area; the local texture features of the lesion area are extracted by counting the number of pixels with different gray values and constructing a gray co-occurrence matrix.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and more specifically, to a method for detecting and optimizing diseased tissues based on an endoscope. Background Art

[0002] With the improvement of medical diagnosis and treatment levels, the demand for the diagnosis and treatment of early diseases is increasing day by day. As a means of directly observing diseased tissues, an endoscope can provide more accurate and intuitive information, which helps to detect and intervene in diseased tissues at an early stage. Through endoscopy, doctors can observe the morphology, color, blood vessel distribution, etc. of diseased tissues in real time, gain a deeper understanding of the condition, and thus make accurate diagnoses and treatment plans.

[0003] However, due to the special nature of endoscope images, such as low contrast, noise, and blurring, it may be difficult to detect and locate diseased tissues. Summary of the Invention

[0004] In view of the technical problems existing in the prior art, the present invention provides a method for detecting and optimizing diseased tissues based on an endoscope. By using the camera of the endoscope to capture images of the diseased area and performing noise reduction processing on the images, the problems raised in the above background art are solved.

[0005] The technical solution of the present invention to solve the above technical problems is as follows: A method for detecting and optimizing diseased tissues based on an endoscope specifically includes the following steps:

[0006] Step 101: Use the camera of the endoscope to capture images of the diseased area and perform noise reduction processing on the images;

[0007] Step 102: Convert the noise-reduced image into a grayscale image and perform image binarization to divide it into two layers of black and white;

[0008] Step 103: According to the binarized image, use an edge detection algorithm to separate the diseased area from the background;

[0009] Step 104: In the diseased area separated from the background, extract the local texture features of the diseased area by counting the number of pixels with different grayscale values.

[0010] In a preferred embodiment, in step 101, the camera of the endoscope is used to capture images of the diseased area, and the collected images are transmitted to an image processing device for noise reduction processing to eliminate the noise in the images, improve the quality and clarity of the images, and smooth the images and reduce the influence of noise by performing weighted averaging on the pixels in the surrounding neighborhood of the pixel (x, y) through Gaussian filtering. The specific steps are as follows:

[0011] Step A1: Use a filtering window of size n. Let (x, y) represent the coordinates of the target pixel. Calculate the Gaussian weights at each pixel position within the filtering window. For each pixel position (i, j) within the filtering window, define the corresponding Gaussian weight W(i, j). The specific calculation formula is as follows:

[0012]

[0013] where W(i, j) represents the weight of the Gaussian function at (i, j), (i, j) represents the coordinates of each pixel within the filtering window, (x, y) represents the coordinates of the target pixel, and σ represents the standard deviation of the Gaussian kernel function;

[0014] Step A2: Multiply each pixel value within the filtering window by the corresponding Gaussian weight and sum the product results to obtain the value of the filtered pixel. The specific calculation formula is as follows:

[0015]

[0016] where I'(x, y) represents the value of the filtered pixel, I(x + i, y + j) represents the original pixel value at the current pixel position (x + i, y + j) within the filtering window, n represents the size of the filtering window, W(i, j) represents the weight of the Gaussian function at (i, j), and K represents the normalization factor.

[0017] In a preferred embodiment, in step 102, the captured color image is converted into a grayscale image, and the converted grayscale image is binarized using the local threshold method, divided into two parts: black and white. The specific steps are as follows:

[0018] Step B1: Convert the captured color image into a grayscale image. Let the pixel value of the color image be represented as (R, G, B). The specific calculation formula is as follows:

[0019] Gray = 0.299×R + 0.587×G + 0.114×B

[0020] where Gray represents the pixel value of the grayscale image, and R, G, B respectively represent the pixel values of the red, green, and blue channels of the corresponding pixel points in the color image;

[0021] Step B2: Use the local threshold method to divide the image into several sub-regions. Calculate a local threshold within each sub-region for binarization. For each pixel (x, y), select a local neighborhood of size m×m, and calculate the average value λ and standard deviation of its local pixels Calculate the threshold based on the average grayscale value and standard deviation of the neighborhood. The specific calculation formula is as follows:

[0022]

[0023]

[0024] Among them, G(x, y) represents the gray value at the pixel (x, y) in the original image, m is the size of the local neighborhood, λ(x, y) represents the average gray value within the local neighborhood, and T(x, y) represents the local threshold at the pixel (x, y). represents the local standard deviation at the pixel (x, y), and η represents an adjustable parameter with a value range of 0.8 to 1.2;

[0025] Apply the calculated local threshold T(x, y) to the image. Set the pixel gray values greater than or equal to the threshold to white and those less than the threshold to black to obtain a binary image.

[0026] In a preferred embodiment, in step 103, according to the binary image, divide it into black and white layers, and use an edge detection algorithm to extract the edges and contours of the lesion area. The specific steps are as follows:

[0027] Step C1: Calculate the gradient magnitude and direction of the image: Use the Sobel operator to calculate the gradients in the horizontal and vertical directions of the image to obtain a gradient image. Set the horizontal direction gradient L x and the vertical direction gradient L y , and the specific calculation formulas are:

[0028] L x (x, y) = G(x + 1, y) - G(x - 1, y)

[0029] L y (x, y) = G(x, y + 1) - G(x, y - 1)

[0030] Among them, L x (x, y) and L y (x, y) represent the horizontal and vertical direction gradients of the image at the position (x, y), and G(x, y) represents the gray value of the image at the position (x, y);

[0031] Step C2: Calculate the gradient magnitude and direction based on the gradients in the horizontal and vertical directions. The specific calculation formulas for the gradient magnitude L and direction θ are as follows:

[0032] L(x, y) = sqrt(L x (x, y) 2 + L y (x, y) 2 )

[0033] θ(x, y) = arctan2(L y (x, y) + L x(x,y))

[0034] Among them, L(x,y) represents the gradient magnitude of the image at the position (x,y); θ(x,y) represents the gradient direction of the image at the position (x,y), expressed in radians;

[0035] Step C3, non-maximum suppression: For the gradient magnitude image, perform non-maximum suppression operation to refine the edges to single-pixel width. For each pixel (x,y), compare its gradient direction θ(x,y) with the gradient directions of two adjacent pixels. When the gradient magnitude L(x,y) is not a local maximum, set this pixel to 0;

[0036] Step C4, double-threshold processing: Perform threshold processing on the non-maximum suppression image according to the set high threshold and low threshold to obtain strong edges and weak edges. All pixels with gradient magnitudes greater than the high threshold are considered strong edges, all pixels with gradient magnitudes less than the low threshold are considered non-edges, and pixels between the high threshold and the low threshold are regarded as weak edges;

[0037] Step C5, edge connection: Use connectivity to determine whether weak edges are connected to strong edges. When a weak edge is adjacent to another weak edge and the gradient magnitude is greater than the high threshold, it is identified as a strong edge. By connecting strong edges and weak edges, complete edges are formed.

[0038] In a preferred embodiment, in step 104, within the lesion area separated from the background, count the number of pixels with different gray values, construct a gray-level co-occurrence matrix, and extract the local texture features of the lesion area. The specific steps are as follows:

[0039] Step D1, count the number of pixels with different gray values: For the already separated lesion area, traverse all pixels in this area and count the gray values. By creating a histogram of gray value statistics, the distribution of the number of pixels at different gray levels can be clearly viewed. The calculation formula for the number of pixels at different gray levels is as follows:

[0040]

[0041] Where N i represents the number of pixels with gray value G i , (x,y) represents the coordinates of the image, G(x,y) is the gray value of the image at the coordinates (x,y), W and H are the width and height of the image respectively, and δ is an indicator function that takes the value of 1 when the expression in the parentheses holds, otherwise 0;

[0042] Step D2, construct the gray-level co-occurrence matrix: By counting the number of occurrences of adjacent pixel pairs at different gray levels, calculate the gray-level co-occurrence matrix. The specific calculation formula is as follows:

[0043]

[0044] Among them, GLCM(a, b) represents the value of the (a, b)-th element in the gray-level co-occurrence matrix. W and H are the width and height of the image respectively. (a, b) represents the number of times that pixels with gray-level a and pixels with gray-level b appear simultaneously in the whole image. δ is an indicator function, which takes the value of 1 when the expression in the parentheses holds, otherwise 0. G(x, y) is the gray value of the image at the coordinate (x, y), and d x and d y are the direction and distance of the gray-level co-occurrence matrix;

[0045] Step D3: Extract the local texture features of the lesion area: According to the constructed gray-level co-occurrence matrix, extract the contrast texture features of the image. By calculating the contrast degree of adjacent pixel pairs at different gray levels, the greater the contrast, the more obvious the difference in gray levels within the lesion area. The specific calculation formula is as follows:

[0046]

[0047] Among them, Contrast represents the contrast, GLCM(a, b) represents the value of the (a, b)-th element in the gray-level co-occurrence matrix, and W and H are the width and height of the image respectively.

[0048] The beneficial effects of the present invention are as follows: Take pictures of the lesion area through the camera of the endoscope, and perform noise reduction processing on the image. Use Gaussian filtering to perform weighted averaging on pixels to smooth the image and reduce the influence of image noise. Convert the noise-reduced image into a grayscale image and perform image binarization to divide it into black and white layers. According to the binarized image, calculate the gradient magnitude and direction of the image, and use the edge detection algorithm to separate the lesion area from the background. Within the lesion area separated from the background, by counting the number of pixels with different gray values and constructing a gray-level co-occurrence matrix, extract the local texture features of the lesion area, which can capture subtle lesion features and details, help doctors make accurate diagnosis and treatment decisions, and are of great significance for the early detection and treatment of diseases. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is the system flow chart of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0050] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present application.

[0051] In the description of the present application, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the said features. In the description of the present application, "a plurality of" means two or more unless otherwise specifically defined.

[0052] In the description of the present application, the term "for example" is used to mean "serving as an example, illustration, or explanation". Any embodiment described as "for example" in the present application is not necessarily construed as being more preferred or advantageous than other embodiments. The following description is given to enable any person skilled in the art to implement and use the present invention. In the following description, details are set forth for purposes of explanation. It should be understood that those of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope that conforms to the principles and features disclosed in the present application.

[0053] Embodiment 1

[0054] This embodiment provides a method for detecting and optimizing diseased tissues based on an endoscope as shown in Figure 1 and specifically includes the following steps:

[0055] Step 101, capture an image of the diseased area through the camera of the endoscope and perform noise reduction processing on the image;

[0056] Furthermore, capture an image of the diseased area through the camera of the endoscope, transmit the acquired image to an image processing device, perform noise reduction processing on the image, eliminate the noise in the image, improve the quality and clarity of the image, and achieve image smoothing and reduce the influence of noise by performing weighted averaging on the pixels in the surrounding neighborhood of the pixel (x, y) through Gaussian filtering. The specific steps are as follows:

[0057] Step A1, use a filtering window of size n, where (x, y) represents the coordinates of the target pixel, calculate the Gaussian weights of each pixel position within the filtering window, and for each pixel position (i, j) within the filtering window, define the corresponding Gaussian weight W(i, j). The specific calculation formula is as follows:

[0058]

[0059] Among them, W(i,j) represents the weight of the Gaussian function at (i,j), (i,j) represents the coordinates of each pixel within the filtering window, (x,y) represents the coordinates of the target pixel, and σ represents the standard deviation of the Gaussian kernel function;

[0060] Step A2: Multiply each pixel value within the filtering window by the corresponding Gaussian weight, and sum the product results to obtain the value of the filtered pixel. The specific calculation formula is as follows:

[0061]

[0062] Among them, I'(x,y) represents the value of the filtered pixel, I(x+i,y+j) represents the original pixel value at the current pixel position (x+i,y+j) within the filtering window, n represents the size of the filtering window, W(i,j) represents the weight of the Gaussian function at (i,j), and K represents the normalization factor.

[0063] Step 102: Convert the image after noise reduction processing into a grayscale image, and perform image binarization to divide it into black and white layers;

[0064] Furthermore, convert the captured color image into a grayscale image, and use the local threshold method to perform image binarization on the converted grayscale image, dividing it into black and white parts. The specific steps are as follows:

[0065] Step B1: Convert the captured color image into a grayscale image. Let the pixel value of the color image be represented as (R,G,B). The specific calculation formula is as follows:

[0066] Gray = 0.299×R + 0.587×G + 0.114×B

[0067] Among them, Gray represents the pixel value of the grayscale image, and R, G, and B respectively represent the pixel values of the red, green, and blue channels of the corresponding pixel points in the color image;

[0068] Step B2: Use the local threshold method to divide the image into several sub-regions, calculate a local threshold within each sub-region for binarization. For each pixel (x,y), select a local neighborhood of size m×m, and calculate the average value λ and standard deviation of its local pixels Calculate the threshold according to the average gray value and standard deviation of this neighborhood. The specific calculation formula is as follows:

[0069]

[0070]

[0071] Among them, G(x, y) represents the gray value at pixel (x, y) in the original image, m is the size of the local neighborhood, λ(x, y) represents the average gray value within the local neighborhood, and T(x, y) represents the local threshold at pixel (x, y). represents the local standard deviation at pixel (x, y), η represents an adjustable parameter, and its value range is 0.8 to 1.2;

[0072] Apply the calculated local threshold T(x, y) to the image. Set the pixel gray values greater than or equal to the threshold to white and those less than the threshold to black to obtain a binary image.

[0073] Step 103: According to the binary image, use an edge detection algorithm to separate the lesion area from the background;

[0074] Furthermore, according to the binary image, divide it into black and white layers, and use an edge detection algorithm to extract the edges and contours of the lesion area. The specific steps are as follows:

[0075] Step C1: Calculate the gradient magnitude and direction of the image: Use the Sobel operator to calculate the horizontal and vertical gradients of the image to obtain a gradient image. Set the horizontal gradient L of the image x and the vertical gradient L y , and the specific calculation formulas are:

[0076] L x (x, y) = G(x + 1, y) - G(x - 1, y)

[0077] L y (x, y) = G(x, y + 1) - G(x, y - 1)

[0078] Among them, L x (x, y) and L y (x, y) represent the horizontal and vertical gradients of the image at position (x, y), and G(x, y) represents the gray value of the image at position (x, y);

[0079] Step C2: According to the horizontal and vertical gradients, calculate the gradient magnitude and direction. The specific calculation formulas for the gradient magnitude L and direction θ are as follows:

[0080] L(x, y) = sqrt(L x (x, y) 2 + L y (x, y) 2 )

[0081] θ(x, y) = arctan2(L y (x, y) + L x (x, y))

[0082] Among them, L(x, y) represents the gradient magnitude of the image at the position (x, y); θ(x, y) represents the gradient direction of the image at the position (x, y), expressed in radians;

[0083] Step C3, non-maximum suppression: For the gradient magnitude image, perform non-maximum suppression operation to refine the edge into a single-pixel width. For each pixel (x, y), compare its gradient direction θ(x, y) with the gradient directions of two adjacent pixels. When the gradient magnitude L(x, y) is not a local maximum, set this pixel to 0;

[0084] Step C4, double-threshold processing: Perform threshold processing on the non-maximum suppression image according to the set high threshold and low threshold to obtain strong edges and weak edges. All pixels with gradient magnitudes greater than the high threshold are considered strong edges, all pixels with gradient magnitudes less than the low threshold are considered non-edges, and pixels between the high threshold and the low threshold are regarded as weak edges;

[0085] Step C5, edge connection: Use connectivity to determine whether a weak edge is connected to a strong edge. When a weak edge is adjacent to another weak edge and the gradient magnitude is greater than the high threshold, it is identified as a strong edge. By connecting strong edges and weak edges, a complete edge is formed.

[0086] Step 104, within the lesion area separated from the background, extract the local texture features of the lesion area by counting the number of pixels with different gray values;

[0087] Furthermore, within the lesion area separated from the background, count the number of pixels with different gray values, construct a gray-level co-occurrence matrix, and extract the local texture features of the lesion area. The specific steps are as follows:

[0088] Step D1, count the number of pixels with different gray values: For the already separated lesion area, traverse all the pixels in this area and count the gray values. By creating a histogram of gray value statistics, the distribution of the number of pixels at different gray levels can be clearly viewed. The calculation formula for the number of pixels at different gray levels is as follows:

[0089]

[0090] where N i represents the number of pixels with gray value G i , (x, y) represents the coordinates of the image, G(x, y) is the gray value of the image at the coordinates (x, y), W and H are the width and height of the image respectively, and δ is an indicator function, which takes the value of 1 when the expression in the parentheses holds, otherwise 0;

[0091] Step D2: Construct the gray-level co-occurrence matrix: Calculate the gray-level co-occurrence matrix by counting the number of occurrences of adjacent pixel pairs at different gray levels. The specific calculation formula is as follows:

[0092]

[0093] Among them, GLCM(a, b) represents the value of the (a, b)-th element in the gray-level co-occurrence matrix, W and H are the width and height of the image respectively, (a, b) represents the number of times that pixels with gray level a and pixels with gray level b appear simultaneously in the entire image, δ is an indicator function, which takes the value of 1 when the expression in the parentheses holds, otherwise 0, G(x, y) is the gray value of the image at the coordinate (x, y), d x and d y are the direction and distance of the gray-level co-occurrence matrix;

[0094] Step D3: Extract the local texture features of the lesion area: According to the constructed gray-level co-occurrence matrix, extract the contrast texture features of the image. By calculating the contrast degree of adjacent pixel pairs at different gray levels, the greater the contrast, the more obvious the difference in gray levels within the lesion area. The specific calculation formula is as follows:

[0095]

[0096] Among them, Contrast represents the contrast, GLCM(a, b) represents the value of the (a, b)-th element in the gray-level co-occurrence matrix, and W and H are the width and height of the image respectively.

[0097] It should be noted that in the above embodiments, the descriptions of each embodiment have their own emphases. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0098] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.

[0099] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices produce a means for implementing the functions specified in one or more flows Figure 1 one or more flows and / or blocks Figure 1 or a means for implementing the functions specified in one or more blocks.

[0100] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the functions specified in one or more flows Figure 1 one or more flows and / or blocks Figure 1 or a means for implementing the functions specified in one or more blocks.

[0101] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flows Figure 1 one or more flows and / or blocks Figure 1 or a means for implementing the functions specified in one or more blocks.

[0102] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.

[0103] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.

Claims

1. A method for detecting and optimizing diseased tissue based on endoscope, characterized in that: The specific steps include: Step 101: capture an image of the lesion area through the camera of the endoscope, and perform noise reduction processing on the image; Step 102: convert the denoised image into a grayscale image and perform image binarization to divide it into two layers, black and white. Step 103: Separate the lesion area from the background using an edge detection algorithm based on the binarized image; Step 104: In the lesion area separated from the background, local texture features of the lesion area are extracted by counting the number of pixels with different gray values.

2. The method for detecting and optimizing diseased tissue based on endoscope according to claim 1, characterized in that: In step 101, an image of the lesion area is captured by the camera of the endoscope, and the collected image is transmitted to an image processing device, and a noise reduction process is performed on the image to eliminate the noise in the image. The image is smoothed by weighted averaging the pixels in the neighborhood around the pixel (x, y) through Gaussian filtering. A filter window of size n is used, (x, y) represents the coordinates of the target pixel, and the Gaussian weight of each pixel position in the filter window is calculated. For each pixel position (i, j) in the filter window, the corresponding Gaussian weight W(i, j) is defined, and the specific calculation formula is as follows: Among them, W(i,j) represents the weight of the Gaussian function at (i,j), (i,j) represents the coordinates of each pixel in the filter window, (x,y) represents the coordinates of the target pixel, and σ represents the standard deviation of the Gaussian kernel function.

3. The method for detecting and optimizing diseased tissue based on endoscope according to claim 2, characterized in that: The step of performing noise reduction processing on the image also includes: multiplying each pixel value in the filtering window by the Gaussian weight of the corresponding position, and adding the product results to obtain the value of the pixel after filtering. The specific calculation formula is as follows: Among them, I'(x,y) represents the pixel value after filtering, I(x+i,y+j) represents the original pixel value at the current pixel position (x+i,y+j) in the filtering window, n represents the size of the filtering window, W(i,j) represents the weight of the Gaussian function at (i,j), and K represents the normalization factor.

4. The method for detecting and optimizing diseased tissue based on endoscope according to claim 1, characterized in that: In step 102, the captured color image is converted into a grayscale image, and the converted grayscale image is binarized using a local threshold method to be divided into two parts, black and white; The step of converting the captured color image into a grayscale image includes: assuming that the pixel value of the color image is represented by (R, G, B), the specific calculation formula is as follows: Gray=0.299×R+0.587×G+0.114×B Among them, Gray represents the pixel value of the grayscale image, and R, G, and B represent the pixel values ​​of the red, green, and blue channels of the corresponding pixel points in the color image, respectively.

5. The method for detecting and optimizing diseased tissue based on endoscope according to claim 4, characterized in that: The step of using the local threshold method to binarize the converted grayscale image includes: dividing the image into several sub-regions, calculating a local threshold in each sub-region for binarization, and for each pixel (x, y), selecting a local neighborhood of size m×m, calculating the average value λ and standard deviation of its local pixels The threshold is calculated based on the average gray value and standard deviation of the neighborhood. The specific calculation formula is as follows: Among them, G(x,y) represents the gray value at the pixel (x,y) in the original image, m is the size of the local neighborhood, λ(x,y) represents the average gray value in the local neighborhood, T(x,y) represents the local threshold at the pixel (x,y), represents the local standard deviation at the pixel (x, y), η represents an adjustable parameter, and its value range is 0.8~1.2; The calculated local threshold T(x, y) is applied to the image, and the pixel grayscale values ​​greater than or equal to the threshold are set to white, and the pixels less than the threshold are set to black, to obtain a binary image.

6. The method for detecting and optimizing diseased tissue based on endoscope according to claim 1, characterized in that: In step 103, the binarized image is divided into black and white layers, and an edge detection algorithm is used to extract the edge and contour of the lesion area. The specific steps are as follows: Step C1, calculate the gradient amplitude and direction of the image: use the Sobel operator to calculate the horizontal and vertical gradients of the image to obtain a gradient image, and set the horizontal gradient L of the image x and the vertical gradient L y , the specific calculation formula is: L x (x,y)=G(x+1,y)-G(x-1,y) L y (x,y)=G(x,y+1)-G(x,y-1) Among them, L x (x,y) and L y (x, y) represents the horizontal and vertical gradients of the image at position (x, y), and G(x, y) represents the grayscale value of the image at position (x, y); Step C2: Calculate the gradient amplitude and direction according to the gradients in the horizontal and vertical directions. The specific calculation formulas for the gradient amplitude L and direction θ are as follows: L(x,y)=sqrt(L x (x,y) 2 +L y (x,y) 2 ) θ(x,y)=arctan2(L y (x,y)+L x (x,y)) Among them, L(x,y) represents the gradient amplitude of the image at the position (x,y); θ(x,y) represents the gradient direction of the image at the position (x,y), expressed in radians.

7. The method for detecting and optimizing diseased tissue based on endoscope according to claim 6, characterized in that: The step of using an edge detection algorithm to extract the edge and contour of the lesion area includes: Step C1, non-maximum suppression: For the gradient magnitude image, perform non-maximum suppression operation to refine the edge to a single pixel width. For each pixel (x, y), compare its gradient direction θ(x, y) with the gradient directions of the two adjacent pixels. When the gradient magnitude L(x, y) is not a local maximum, set the pixel to 0. Step C2, double threshold processing: threshold processing is performed on the non-maximum suppression image according to the set high threshold and low threshold to obtain strong edges and weak edges. All pixels with gradient amplitudes greater than the high threshold are considered strong edges, all pixels with gradient amplitudes less than the low threshold are considered non-edges, and pixels between the high threshold and the low threshold are considered weak edges. Step C3: Edge connection: forming a complete edge by connecting strong edges and weak edges.

8. The method for detecting and optimizing diseased tissue based on endoscope according to claim 1, characterized in that: In step 104, the number of pixels with different gray values ​​is counted in the lesion area separated from the background, a gray level co-occurrence matrix is ​​constructed, and local texture features of the lesion area are extracted; The step of counting the number of pixels with different grayscale values ​​includes: for the separated lesion area, traversing all pixels in the area and counting the grayscale values, and creating a histogram of grayscale value statistics to clearly view the distribution of the number of pixels with different grayscale levels. The calculation formula for the number of pixels with different grayscale levels is as follows: Among them, N i Indicates the gray value is G i where (x, y) represents the coordinates of the image, G(x, y) is the grayscale value of the image at the coordinate (x, y), W and H are the width and height of the image respectively, and δ is an indicator function that takes a value of 1 when the expression in the brackets holds, otherwise it takes a value of 0.

9. The method for detecting and optimizing diseased tissue based on endoscope according to claim 8, characterized in that: The step of constructing the gray level co-occurrence matrix includes: calculating the gray level co-occurrence matrix by counting the number of times adjacent pixel pairs appear at different gray levels. The specific calculation formula is as follows: Where GLCM(a,b) represents the value of the (a,b)th element in the gray-level co-occurrence matrix, W and H are the width and height of the image, respectively, (a,b) represents the number of times a pixel with gray level a and a pixel with gray level b appear simultaneously in the entire image, δ is an indicator function, which takes the value of 1 when the expression in the brackets holds, otherwise it takes the value of 0, G(x,y) is the gray value of the image at the coordinate (x,y), and d x and d y is the direction and distance of the gray-level co-occurrence matrix.

10. The method for detecting and optimizing diseased tissue based on endoscope according to claim 8, characterized in that: The step of extracting the local texture features of the lesion area includes: extracting the contrast texture features of the image according to the constructed gray level co-occurrence matrix, and calculating the contrast degree of adjacent pixel pairs at different gray levels. The greater the contrast, the more obvious the difference in gray levels in the lesion area. The specific calculation formula is as follows: Among them, Contrast represents contrast, GLCM(a,b) represents the value of the (a,b)th element in the gray-level co-occurrence matrix, and W and H are the width and height of the image, respectively.