Image segmentation method and device, computer equipment, storage medium and program product
By determining the confidence of the sampling point in the endoscopic image and screening the boundary sampling point of the effective area, the problem of not high segmentation accuracy in the existing technologies is solved, and the higher segmentation accuracy and lower part are realized. Storage occupation.
Patent Information
- Application Number
- CN202310920073.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-25
- Publication Date
- 2025-01-28
AI Technical Summary
The prior art has low accuracy in effective area segmentation in endoscopic images or videos, resulting in inaccurate processing results and occupies additional storage space.
By obtaining the endoscope image, multiple sampling points are obtained, and the boundary sampling points of the effective area are determined according to the confidence of the sampling point, and the effective areas are divided based on these points. The confidence represents the probability of each sampling point is the border sampling point.
Improve the accuracy of the division of effective areas, reduce the occupation of storage space, and ensure the accuracy of the results of image or video processing.
Smart Images

Figure CN119379706A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image segmentation method, apparatus, computer equipment, storage medium and program product. Background Art
[0002] The images or videos captured by the endoscope device usually include a valid area and a background area. Since the pixels in the background area are very dark and contain interference information, they will affect the processing results of the image or video and occupy additional storage space.
[0003] In order to improve the accuracy of processing results and reduce storage space usage, the related technology mainly uses a trained edge recognition model to identify the outline of the effective area in an image or video, and segments the background area based on the effective area outline to obtain an image or video containing only the effective area.
[0004] However, the related art methods have the problem of low accuracy in effective area segmentation. Summary of the invention
[0005] Based on this, it is necessary to provide an image segmentation method, apparatus, computer equipment, storage medium and program product to improve the accuracy of effective area segmentation in response to the above technical problems.
[0006] In a first aspect, the present application provides an image segmentation method, the method comprising:
[0007] Acquiring an endoscopic image of the target site;
[0008] Sampling the endoscopic image of the target site to obtain a plurality of sampling points;
[0009] According to the confidence of each sampling point, the boundary sampling points of the effective area in the endoscopic image are determined; the confidence indicates the probability that each sampling point is a boundary sampling point;
[0010] The effective area in the endoscopic image is segmented based on the boundary sampling points of the effective area.
[0011] In one embodiment, determining the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point includes:
[0012] The sampling points with confidence levels higher than a preset confidence threshold are determined as boundary sampling points of the effective area in the endoscopic image.
[0013] In one embodiment, before determining the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point, the method further includes:
[0014] Each sampling point is divided to obtain a plurality of sampling point sets; each sampling point set includes any three sampling points among the sampling points;
[0015] Fitting is performed on three sampling points in each sampling point set to obtain multiple fitting circles;
[0016] Based on each fitted circle, the confidence level of the sample point is determined.
[0017] In one embodiment, the confidence level of the sampling point is determined based on each fitted circle, including:
[0018] Obtaining the number of fitted circles whose center positions are within the center range of the endoscope;
[0019] The ratio of the number of fitted circles to the total number of fitted circles is determined as the confidence level of the sampling point.
[0020] In one embodiment, segmenting the effective area in the endoscopic image based on the boundary sampling points of the effective area includes:
[0021] Obtain the distance between each boundary sampling point and the center of the boundary circle; the boundary circle is obtained by performing circle fitting on the boundary sampling points;
[0022] Based on each distance, determine the shape of the effective area;
[0023] The effective area in the endoscopic image is segmented according to the shape of the effective area.
[0024] In one embodiment, determining the shape of the effective area based on the distance includes:
[0025] Calculate the average distance of each distance;
[0026] If the average distance is less than a preset distance threshold, the shape of the effective area is determined to be a circle;
[0027] If the average distance is greater than or equal to the preset distance threshold, it is determined that the shape of the effective area is a polygon.
[0028] In one embodiment, segmenting the effective area in the endoscopic image according to the shape of the effective area includes:
[0029] When the shape of the effective area is circular, the effective area is verified according to the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images;
[0030] If the verification fails, the effective area is corrected based on the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images;
[0031] The corrected effective area in the endoscopic image is segmented.
[0032] In one embodiment, segmenting the effective area in the endoscopic image according to the shape of the effective area includes:
[0033] When the shape of the effective area is a polygon, a plurality of sampling lines are drawn along the longitudinal axis direction on the endoscopic image to determine the upper boundary and the lower boundary of the effective area;
[0034] Based on the boundary circle, determine the left boundary and the right boundary of the valid area;
[0035] The effective area in the endoscopic image is segmented based on the upper boundary and the lower boundary and the left boundary and the right boundary.
[0036] In one embodiment, segmenting a valid area in an endoscopic image based on an upper boundary and a lower boundary and a left boundary and a right boundary includes:
[0037] The valid area is verified according to the center position, the length of the upper boundary and the lower boundary, and the length of the left boundary and the right boundary of the polygonal area in the adjacent multi-frame endoscopic images;
[0038] If the verification fails, the valid area is corrected based on the center position, the length of the upper and lower boundaries, and the length of the left and right boundaries;
[0039] The corrected effective area in the endoscopic image is segmented.
[0040] In one embodiment, obtaining an endoscopic image of a target site includes:
[0041] obtaining an initial endoscopic image of the target site;
[0042] The initial endoscopic image is enhanced, and the enhanced initial endoscopic image is used as the endoscopic image of the target part.
[0043] In a second aspect, the present application further provides an image segmentation device, the device comprising:
[0044] An acquisition module, used for acquiring an endoscopic image of a target site;
[0045] A sampling module, used for sampling the endoscopic image of the target part to obtain multiple sampling points;
[0046] A determination module is used to determine the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point; the confidence indicates the probability that each sampling point is a boundary sampling point;
[0047] The segmentation module is used to segment the effective area in the endoscopic image based on the boundary sampling points of the effective area.
[0048] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the content of any one of the above-mentioned image segmentation method embodiments in the first aspect is implemented.
[0049] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the content of any one of the above-mentioned image segmentation method embodiments in the first aspect is implemented.
[0050] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the content of any one of the above-mentioned image segmentation method embodiments in the first aspect is implemented.
[0051] The above-mentioned image segmentation method, apparatus, computer equipment, storage medium and program product obtain an endoscopic image of the target part, sample the endoscopic image of the target part to obtain multiple sampling points, and determine the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point; the confidence represents each sampling point, and the effective area in the endoscopic image is segmented based on the boundary sampling points of the effective area. This method can accurately evaluate the probability of each sampling point being a boundary sampling point through the confidence of multiple sampling points in the endoscopic image, and based on the probability, the boundary sampling points of the effective area can be accurately screened out from the multiple sampling points. In this way, through the boundary sampling points, the effective area in the endoscopic image can be accurately segmented to improve the accuracy of segmentation of the effective area. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A diagram showing an application environment of an image segmentation method in an embodiment;
[0053] Figure 2 is a schematic flow chart of an image segmentation method in one embodiment;
[0054] Figure 3 is a schematic diagram of an endoscopic image of a circular effective area in one embodiment;
[0055] Figure 4 is a schematic diagram of an endoscopic image of a polygonal effective area in one embodiment;
[0056] Figure 5 A schematic diagram of sampling points of a circular effective area in one embodiment;
[0057] Figure 6 A schematic diagram of sampling points of a polygonal effective area in one embodiment;
[0058] Figure 7 A schematic diagram of boundary sampling points of a circular effective area in one embodiment;
[0059] Figure 8 A schematic diagram of boundary sampling points of a polygonal effective area in one embodiment;
[0060] Fig. 9 is a schematic flow chart of an image segmentation method in one embodiment;
[0061] Fig.10 is a schematic flow chart of an image segmentation method in one embodiment;
[0062] Fig.11 is a schematic flow chart of an image segmentation method in one embodiment;
[0063] Fig.12 is a schematic flow chart of an image segmentation method in one embodiment;
[0064] Fig.13 is a schematic diagram of a circular effective area in one embodiment;
[0065] Fig.14 is a schematic diagram of a polygonal effective area in one embodiment;
[0066] Fig.15 is a schematic flow chart of an image segmentation method in one embodiment;
[0067] Fig.16 is a schematic diagram of a circular effective area after segmentation in one embodiment;
[0068] Fig.17 is a schematic flow chart of an image segmentation method in one embodiment;
[0069] Fig.18 is a schematic diagram of a polygonal effective area in one embodiment;
[0070] Fig.19 A schematic diagram of a polygonal valid area after segmentation in one embodiment;
[0071] Fig. 20 is a schematic flow chart of an image segmentation method in one embodiment;
[0072] Fig.21 is a schematic flow chart of an image segmentation method in one embodiment;
[0073] Fig. 22 is a schematic flow chart of an image segmentation method in one embodiment;
[0074] Fig.23is a flow chart of a method for segmenting a valid area in an endoscope video in one embodiment;
[0075] Fig.24 is a schematic flow chart of an image segmentation method in one embodiment;
[0076] Fig.25 FIG. 4 is a structural block diagram of an image segmentation device in an embodiment. DETAILED DESCRIPTION
[0077] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0078] The image segmentation method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. For example, the computer device may be a server, a personal computer, a laptop, a smart phone, a tablet computer or a smart mobile phone. The computer device may include a processor, a memory and a network interface connected by a system bus or wirelessly. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data in the image segmentation process. The network interface of the computer device is used to communicate with an external terminal through a network connection, and the computer program is executed by the processor to implement an image segmentation method. Among them, the computer device can be implemented by an independent computer device or a computer device cluster composed of multiple computer devices. The applicant wants to explain that the memory of the computer device is not limited to the above-mentioned memory, and may also include a high-speed random access memory and a volatile solid-state memory, etc. In addition, the composition architecture of the computer device is not limited to the above-mentioned situation, and some components may be added or omitted.
[0079] In one embodiment, Figure 2 As shown, an image segmentation method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:
[0080] S201, acquiring an endoscopic image of a target site.
[0081] Among them, the target part can be any part of the human body that can be observed using an endoscope, for example, the target part can be an abdominal part, a thoracic part, a nasal part or a uterine part, etc. The endoscopic image represents an image of the target part collected by an endoscopic device, and different target parts correspond to different endoscopic devices. For example, the endoscopic device may include a laparoscope, a thoracoscope, a nasal scope, a hysteroscope, a neuroendoscope, a gastroscope or a colorectal scope, etc. The endoscopic device corresponding to the abdominal part is a laparoscope, and the endoscopic device corresponding to the thoracic part is a thoracoscope. Different types of endoscopic devices have different shapes of the effective areas collected during the process of collecting target parts. For example, the shape of the effective area is usually circular or polygonal. Figure 3 is a schematic diagram of the endoscopic image of the circular effective area. Figure 3 It can be observed that the shape of the effective area is circular. Figure 4 Schematic diagram of the endoscope image of the polygonal effective area. Figure 4 It can be observed that the shape of the effective area is an octagon.
[0082] Optionally, when the endoscopic image of the target part has been collected and the endoscopic image is stored in the endoscopic image database, the computer device can search the endoscopic image corresponding to the target part from the endoscopic image database to obtain the endoscopic image of the target part. For example, the computer device can search from the endoscopic image database according to the identification information of the target part. Optionally, the computer device can also send an acquisition instruction to the endoscopic device corresponding to the target part. After receiving the acquisition instruction, the endoscopic device collects the image of the target part and sends the collected image to the computer device. The computer device can then obtain the endoscopic image of the target part. This embodiment does not limit the method for obtaining the endoscopic image of the target part.
[0083] S202, sampling the endoscopic image of the target part to obtain a plurality of sampling points.
[0084] The sampling point in the endoscopic image is used to determine the boundary of the effective area, and therefore, the sampling point refers to a pixel point where the difference between the pixel points on both sides of the pixel point is large.
[0085] Optionally, the computer device may perform edge detection on the endoscopic image of the target part using an edge detection algorithm, draw multiple sampling lines at equal intervals along the longitudinal axis, and use the intersections of the sampling lines and the two sides of the detected edges as sampling points. The edge detection algorithm may be a first-order algorithm, for example, the first-order algorithm includes the Roberts algorithm, the Prewitt algorithm, the Sobel algorithm, or the Canny algorithm, etc. It may also be a second-order algorithm, for example, the second-order algorithm includes the Laplacian algorithm.
[0086] Figure 5 is a schematic diagram of the sampling points of the circular effective area, Figure 6 The schematic diagram of the sampling points of the polygonal effective area shows that the edge obtained by the edge detection algorithm includes multiple edge areas, which means that the edge of the effective area cannot be accurately and intuitively detected by the edge detection algorithm. Therefore, the computer device needs to further filter the edge detection results to obtain a more accurate boundary of the effective area.
[0087] Optionally, the computer device may also obtain a parameter value of each pixel in the endoscopic image of the target part, and determine a sampling point in the endoscopic image according to the parameter value of each pixel. For example, the parameter value of each pixel may be depth information, height information, or color information. This embodiment does not limit the method for obtaining multiple sampling points in the endoscopic image of the target part.
[0088] S203, determining the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point; the confidence indicates the probability that each sampling point is a boundary sampling point.
[0089] In this embodiment, before using the confidence of each sampling point, the confidence acquisition method of each sampling point is first introduced. The computer device can determine the confidence of each sampling point according to the parameter value of each sampling point. Alternatively, the computer device can also input each sampling point into a trained confidence estimation model, analyze the confidence of each sampling point through the confidence estimation model, and obtain the confidence corresponding to each sampling point.
[0090] Furthermore, the computer device may sort the sampling points, and select a preset number of sampling points from the sorted sampling points according to the number of boundary sampling points as boundary sampling points of the effective area. Alternatively, the computer device may also compare the confidence of each sampling point with a preset confidence threshold, and determine the sampling points with a confidence greater than the preset confidence threshold as boundary sampling points of the effective area in the endoscopic image. This embodiment does not limit the method of determining the boundary sampling points according to the confidence of each sampling point.
[0091] Figure 7 It is a schematic diagram of the boundary sampling points of the circular effective area, and the shape formed by each boundary sampling point is a circle; Figure 8 It is a schematic diagram of the boundary sampling points of the polygonal effective area, and the shape formed by each boundary sampling point is an octagon.
[0092] S204, segmenting the effective area in the endoscope image based on the boundary sampling points of the effective area.
[0093] In this embodiment, since the shapes of the effective areas corresponding to different types of endoscope devices are different, the shapes of the effective areas can be divided into two shapes: circular and square. The computer device can obtain the shape of the effective area in advance according to the endoscope device corresponding to the target part, and perform boundary fitting on the boundary sampling points of the effective area based on the shape to obtain a fitting shape composed of the boundary of the effective area, and segment the endoscopic image according to the fitting shape to obtain an endoscopic image containing only the effective area.
[0094] In the above-mentioned image segmentation method, an endoscopic image of the target part is acquired, and the endoscopic image of the target part is sampled to obtain multiple sampling points. According to the confidence of each sampling point, the boundary sampling points of the effective area in the endoscopic image are determined; the confidence represents each sampling point, and the effective area in the endoscopic image is segmented based on the boundary sampling points of the effective area. This method can accurately evaluate the probability of each sampling point being a boundary sampling point through the confidence of multiple sampling points in the endoscopic image, and based on the probability, the boundary sampling points of the effective area can be accurately screened out from the multiple sampling points. In this way, through the boundary sampling points, the effective area in the endoscopic image can be accurately segmented to improve the accuracy of segmentation of the effective area.
[0095] Based on the above embodiments, this embodiment is to Figure 2 The relevant contents of step S203 "determining the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point" are introduced and explained. As a non-limiting example, the above step S203 may include the following contents: determining the sampling points with confidence higher than the preset confidence threshold as the boundary sampling points of the effective area in the endoscopic image.
[0096] In this embodiment, for any one of the sampling points, the computer device can compare the confidence of the sampling point with a preset confidence threshold. If the confidence of the sampling point is higher than the preset confidence threshold, the sampling point is determined to be a boundary sampling point of the effective area. If the confidence of the sampling point is lower than or equal to the preset confidence threshold, it means that the probability of the sampling point being a boundary sampling point is low, and the sampling point is removed. In the above manner, the boundary sampling points of the effective area in the endoscopic image can be screened out from multiple sampling points.
[0097] In the above-mentioned image segmentation method, the sampling points with confidence higher than the preset confidence threshold are determined as the boundary sampling points of the effective area in the endoscope image. The method uses the relationship between the confidence of each sampling point and the preset confidence threshold to accurately determine whether each sampling point is a boundary sampling point, so that the boundary sampling points of the effective area can be accurately determined from each sampling point.
[0098] Based on the above embodiments, this embodiment is to Figure 2 The relevant contents of obtaining the confidence of each sampling point are introduced and explained. Fig. 9 As shown, as a non-limiting example, the above method may also include the following content:
[0099] S301, dividing each sampling point to obtain a plurality of sampling point sets; each sampling point set includes any three sampling points among the sampling points.
[0100] In this embodiment, since at least three points can form a circle, for example, when the sampling points are a, b, c and d, a total of 4 circles can be fitted. For point a, the fitting circle associated with it is obtained by fitting points a, b and c, points a, c and d, and points a, b and d, that is, the number of fitting circles corresponding to point a is 3.
[0101] Therefore, the computer device may divide each sampling point into a plurality of sampling point sets including three sampling points, and each sampling point set is different from other sampling point sets in at least one sampling point. For example, the first sampling point set includes sampling points a, b, and c, the sampling point set with one different sampling point may be a, b, and d, the sampling point set with two different sampling points may be a, d, and e, and the sampling point set with three completely different sampling points may be d, e, and f.
[0102] Alternatively, the computer device may also use a permutation and combination algorithm to divide and process each sampling point to obtain multiple sampling point sets corresponding to each sampling point. For example, if the total number of sampling points is n, there are C n 3 A combination of methods.
[0103] S302, fitting three sampling points in each sampling point set to obtain multiple fitting circles.
[0104] In this embodiment, for any sampling point set, the computer device can use the circle fitting algorithm to fit the three sampling points in the sampling point set to obtain the fitting circle corresponding to the sampling point set. And the sampling points in other sampling point sets are fitted in the above manner to obtain multiple fitting circles. The number of the fitting circles is exactly the same as the number of the sampling point sets. Assuming that the coordinates of the three points of the fitting circle are a(x1, y1), b(x2, y2) and c(x3, y3), the complex form of point a can be expressed as a=x1+y1j, the complex form of point b can be expressed as b=x2+y2j, and the complex form of point c can be expressed as c=x3+y3j. The complex form of the center point e corresponding to the fitting circle can be expressed as:
[0105] e=(ab)*((ca) / (ba)-|(ca) / (ba)|2 )|2j|(ca) / (ba)-a
[0106] Wherein, j represents an imaginary unit; the radius of the fitting circle can be expressed as (e+a).
[0107] S303: Determine the confidence level of the sampling points based on each fitted circle.
[0108] In this embodiment, the computer device can determine whether each fitted circle meets the preset conditions, and obtain the number of fitted circles that meet the preset conditions, and determine the confidence of the sampling point based on the number of fitted circles and the total number of fitted circles. Alternatively, the computer device can also obtain the center position of each fitted circle, and calculate the variance between the center positions of each circle, determine the degree of discreteness between each fitted circle, and determine the confidence of the sampling point based on the discreteness. This embodiment does not limit the method of determining the confidence of the sampling point based on each fitted circle.
[0109] In the above-mentioned image segmentation method, each sampling point is divided to obtain multiple sampling point sets; three sampling points in each sampling point set are fitted to obtain multiple fitting circles; based on each fitting circle, the confidence of the sampling point is determined. This method can obtain multiple sampling point sets by dividing each sampling point, each sampling point set contains any three sampling points among the sampling points, and by fitting the three sampling points in each sampling point set, the confidence of the sampling point can be determined more accurately based on the multiple fitting circles obtained by fitting.
[0110] Based on the above embodiments, this embodiment is to Fig. 9 The relevant contents of step S302 "determining the confidence of the sampling point based on each fitted circle" are introduced and explained. Fig.10 As shown, as a non-limiting example, the above step S302 may include the following content:
[0111] S401, obtaining the number of fitted circles whose center positions are within the center range of the endoscope.
[0112] Among them, when using an endoscope device to collect images of the target part, in order to ensure the accuracy of the image, the target part is generally placed as close to the center of the screen as possible. Therefore, the center position of the effective area is within the center range of the endoscope, that is, the center position of the circle corresponding to the sampling point should also be within the center range of the endoscope. Among them, the center range of the endoscope can be circular, polygonal or irregular. The area of the center range of the endoscope can be determined based on experience, for example, the area of the center range of the endoscope is 1 / 3 of the area of the entire range of the endoscope. When the center range of the endoscope is circular, its center is the center of the entire range of the endoscope, and its radius is proportional to the side length of the entire range of the endoscope. For example, its radius can be half of the side length of the entire range of the endoscope. When the center range of the endoscope is square, the side length of the square is proportional to the side length of the entire range of the endoscope. For example, the side length of the square can be half of the side length of the entire range of the endoscope. In general, the center range of the endoscope is a partial area in the entire range of the endoscope, and the size of the area can be set manually.
[0113] In this embodiment, after obtaining multiple fitting circles corresponding to a certain sampling point, the computer device can obtain the center position corresponding to each fitting circle, and determine whether the center position of each fitting circle is within the center range of the endoscope, and calculate the number of fitting circles that meet the conditions.
[0114] S402: Determine the ratio of the number of fitted circles to the total number of fitted circles as the confidence of the sampling point.
[0115] In this embodiment, after obtaining the number of fitted circles whose center positions are within the center range of the endoscope and whose radii are within the limited range, for each sampling point, the computer device can calculate the total number of fitted circles corresponding to the sampling point, and calculate the ratio of the number of fitted circles that meet the conditions to the total number, and determine the ratio as the confidence of the sampling point. For example, if the number of fitted circles that meet the conditions corresponding to the sampling point is 5 and the total number of fitted circles corresponding to the sampling point is 10, the confidence of the sampling point is 50%, that is, the probability that the sampling point is a boundary sampling point is 50%.
[0116] In the above image segmentation method, the number of fitted circles whose center positions are within the center range of the endoscope is obtained, and the ratio of the number of fitted circles to the total number of fitted circles is determined as the confidence of the sampling point. This method can accurately obtain the number of fitted circles within the center range of the endoscope by judging whether the center positions of each fitted circle of the sampling point are within the center range of the endoscope, thereby accurately obtaining the confidence of the sampling point.
[0117] Based on the above embodiments, this embodiment is to Figure 2The relevant contents of step S204 "segmenting the effective area in the endoscope image based on the boundary sampling points of the effective area" are introduced and explained. Fig.11 As shown, as a non-limiting example, the above step S204 may include the following content:
[0118] S501, obtaining the distance between each boundary sampling point and the center of the boundary circle; the boundary circle is obtained by performing circle fitting on the boundary sampling points.
[0119] In this embodiment, the computer device can perform a circle fitting operation on each boundary sampling point to obtain a boundary circle corresponding to each boundary sampling point. For any boundary sampling point, the computer device can calculate the distance between each boundary sampling point and the center position of the boundary circle, and determine the difference between the distance and the radius of the boundary circle as the distance between the boundary sampling point and the boundary circle. The boundary circle can be fitted by the least squares method, that is, the sum of the squares f of the distances between the sampling points and the circle is minimized, and the boundary circle can be expressed as:
[0120]
[0121] Among them, (x i ,y i ) is the coordinate of the i-th sampling point; (C x , C y ) are the coordinates of the center of the boundary circle; r is the radius of the boundary circle.
[0122] The distance between the boundary sampling point and the boundary circle can be expressed as:
[0123]
[0124] Where d is the distance between each boundary sampling point and the point on the boundary circle; (C x , C y ) represents the coordinates of the center of the boundary circle; (x i ,y i ) represents the position coordinates of the i-th sampling point; r represents the radius of the boundary circle.
[0125] In another embodiment, for any boundary sampling point, a line connecting the boundary sampling point and the center of the circle can be obtained, and the intersection of the line and the boundary circle can be determined, and the distance between the intersection and the boundary sampling point can be obtained to obtain the distance between each boundary sampling point and the corresponding intersection. The distance between the intersection and the boundary sampling point can be the difference between the distance between the center of the circle and the boundary sampling point and the radius. For example, if the distance between the center of the circle and the boundary sampling point is 5 and the radius is 2, then the distance between the intersection and the boundary sampling point is 3.
[0126] S502: Determine the shape of the effective area based on each distance.
[0127] In this embodiment, the shape of the effective area includes a circle and a polygon. For example, the polygon can be a rectangle, a square, a parallelogram, a hexagon or an octagon, etc. The computer device can calculate the average value of the distance between each boundary sampling point and the point on the boundary circle. The smaller the average value, the more likely the shape of the effective area is a circle. The larger the average value, the more likely the shape of the effective area is a polygon. Therefore, the computer device can compare the average distance with a preset distance threshold, and determine the shape of the effective area in the endoscopic image according to the comparison result.
[0128] S503, segmenting the effective area in the endoscopic image according to the shape of the effective area.
[0129] In this embodiment, after the shape of the effective area is determined, the computer device can fit each boundary sampling point based on the shape of the effective area to obtain the boundary of the effective area corresponding to each boundary sampling point. Then, based on the boundary of the effective area, the effective area in the endoscopic image is segmented to obtain the effective area in the endoscopic image.
[0130] In the above image segmentation method, the distance between the boundary sampling point and the center of the boundary circle is obtained; the boundary circle is obtained by fitting the boundary sampling point; based on the distance, it is determined; according to the shape of the effective area, the effective area in the endoscopic image is segmented. This method can accurately obtain the boundary circle corresponding to each boundary sampling point by fitting the boundary sampling point, and calculate the distance between the boundary sampling point and the center of the boundary circle. Based on the distance, the shape of the effective area can be accurately determined, so that the effective area in the endoscopic image can be accurately segmented.
[0131] Based on the above embodiments, this embodiment is to Fig.11 The relevant contents of step S502 "determining the shape of the effective area based on the distance" in FIG. Fig.12 As shown, as a non-limiting example, the above step S502 may include the following content:
[0132] S601, calculating the average distance of each distance.
[0133] In this embodiment, after the distances between each boundary sampling point and the points on the boundary circle are obtained, the computer device may calculate an average value for each distance and use the obtained average value as the average distance of each distance.
[0134] S602: If the average distance is less than a preset distance threshold, determine that the shape of the effective area is a circle.
[0135] In this embodiment, the computer device may compare the average distance with a preset distance threshold. When the average distance is less than the preset distance threshold, it indicates that the shape of the valid area corresponding to the boundary sampling point is a circle, and the shape of the valid area is determined to be a circle. Fig.13 It is a schematic diagram of the circular effective area. In the figure, the average distance between each sampling point and the boundary circle is less than the preset distance, and each sampling point is almost evenly distributed on the boundary circle.
[0136] S603: If the average distance is greater than or equal to a preset distance threshold, determine that the shape of the effective area is a polygon.
[0137] In this embodiment, the computer device may compare the average distance with a preset distance threshold. When the average distance is greater than or equal to the preset distance threshold, it indicates that the shape of the valid area corresponding to the boundary sampling point is not a circle, and the shape of the valid area is determined to be a polygon. Fig.14 It is a schematic diagram of the polygonal effective area. In the figure, the average distance between each sampling point and the boundary circle is greater than or equal to the preset distance, and each sampling point is distributed inside the boundary circle.
[0138] In the above image segmentation method, the average distance of each distance is calculated; if the average distance is less than the preset distance threshold, the shape of the effective area is determined to be a circle; if the average distance is greater than or equal to the preset distance threshold, the shape of the effective area is determined to be a polygon. This method obtains the average value of each distance and compares the average value with the preset threshold. According to the comparison result, the shape of the effective area can be determined more accurately.
[0139] Based on the above embodiment, when the shape of the effective area is circular, this embodiment is to Fig.11 The relevant contents of step S503 "segmenting the effective area in the endoscope image according to the shape of the effective area" are introduced and explained. Fig.15 As shown, as a non-limiting example, the above step S503 may include the following content:
[0140] S701 , when the shape of the effective area is circular, verify the effective area according to the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images.
[0141] In this embodiment, when it is determined that the shape of the effective area is a circle, the computer device can further verify whether the circle corresponding to the effective area is correct based on the parameters of the circular area in the adjacent multiple frames of endoscopic images. The computer device can obtain multiple frames of endoscopic images adjacent to the frame of endoscopic image, and obtain the center position and corresponding radius of the circular area in the multiple frames of endoscopic images, and verify whether the boundary circle corresponding to the effective area is correct based on the center position and corresponding radius of the multiple adjacent circular areas. For example, it is determined whether the error between the center position of the boundary circle corresponding to the effective area and the center position of the multiple adjacent circular areas is greater than a preset error, and it is determined whether the error between the radius of the boundary circle corresponding to the effective area and the radius of the multiple adjacent circular areas is greater than a preset error.
[0142] Furthermore, if the valid area verification is passed, the valid area in the endoscopic image is directly segmented based on the boundary circle.
[0143] S702: If the verification fails, the effective area is corrected based on the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images.
[0144] In the case where the verification fails, the computer device can use a regression algorithm to regress the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images, and correct the center position and radius of the boundary circle corresponding to the effective area based on the regression result. The regression algorithm can be a median regression algorithm or a robust regression algorithm. So that the error between the center position of the boundary circle corresponding to the effective area and the center positions of multiple adjacent circular areas is less than a preset error, and the error between the radius of the boundary circle corresponding to the effective area and the radius of multiple adjacent circular areas is less than a preset error.
[0145] S703, segmenting the corrected effective area in the endoscopic image.
[0146] In this embodiment, after the computer device obtains the boundary circle corresponding to the corrected effective area, the effective area in the endoscopic image is segmented using the corrected boundary circle. Fig.16 Schematic diagram of the circular effective area after segmentation. The effective area is a large part of the circle, and the remaining part is not displayed due to image size or image magnification.
[0147] In the above image segmentation method, when the shape of the effective area is a circle, the center position and the corresponding radius of the circular area in the adjacent multi-frame endoscopic image are obtained; based on each center position and the corresponding radius, the effective area is corrected; and the corrected effective area in the endoscopic image is segmented. This method uses the center position and the corresponding radius of the circular area in the adjacent multi-frame endoscopic image to accurately verify the effective area, and when the verification fails, the effective area can be accurately corrected to improve the segmentation accuracy of the effective area.
[0148] Based on the above embodiment, when the shape of the effective area is a polygon, this embodiment is to Figure 5 The relevant contents of step S503 "segmenting the effective area in the endoscope image according to the shape of the effective area" are introduced and explained. Fig.17 As shown, as a non-limiting example, the above step S503 may include the following content:
[0149] S801: When the shape of the effective area is a polygon, a plurality of sampling lines are drawn along the longitudinal axis on the endoscopic image to determine the upper boundary and the lower boundary of the effective area.
[0150] In this embodiment, when the shape of the effective area is determined to be a polygon, the computer device can continue to use the method of determining the sampling points in step S202 to draw multiple sampling lines along the longitudinal axis as sampling points. Perform horizontal straight line fitting on the multiple sampling points, and use the obtained two horizontal fitting straight lines as the upper boundary and the lower boundary of the effective area.
[0151] S802: Determine the left boundary and the right boundary of the effective area based on the boundary circle.
[0152] In this embodiment, the computer device can obtain the four intersection points of the fitting circle and multiple sampling lines on the left and right sides, use the line connecting the two left intersection points as the left side of the valid area, and use the line connecting the two right intersection points as the right side of the valid area, thereby obtaining the left and right boundaries of the valid area.
[0153] S803 , segmenting the effective area in the endoscope image based on the upper boundary and the lower boundary and the left boundary and the right boundary.
[0154] In this embodiment, after the upper boundary and the lower boundary and the left boundary and the right boundary of the effective area are obtained, if the upper boundary and the lower boundary and the left boundary and the right boundary intersect, it is determined that the polygon is a rectangle or a square, and the effective area in the endoscope image is segmented using the rectangle or the square. If the upper boundary and the lower boundary and the left boundary and the right boundary do not intersect, an octagon corresponding to the effective area is fitted based on the upper boundary and the lower boundary and the left boundary and the right boundary, and the effective area in the endoscope image is segmented based on the fitted octagon. Fig.18 This is a schematic diagram of the effective area of the polygon, from which the upper and lower boundaries and the left and right boundaries of the polygon can be seen. Fig.19 Schematic diagram of the polygonal effective area after segmentation. The shape of the effective area in the figure is an octagon.
[0155] In the above-mentioned image segmentation method, when the shape of the effective area is a polygon, the upper and lower boundaries of the effective area are determined along multiple sampling lines on the endoscopic image, and the left and right boundaries of the effective area are determined based on the boundary circle, and the effective area in the endoscopic image is segmented based on the upper and lower boundaries and the left and right boundaries. When the shape of the effective area is a polygon, this method can accurately obtain the upper and lower boundaries and the left and right boundaries of the effective area by drawing sampling lines along the longitudinal axis in combination with the boundary circle, so that the effective area in the endoscopic image can be segmented more accurately based on the upper and lower boundaries and the left and right boundaries.
[0156] Based on the above embodiments, this embodiment is to Fig.17 The relevant contents of step S803 "segmenting the effective area in the endoscope image based on the upper boundary and the lower boundary and the left boundary and the right boundary" are introduced and explained. Fig. 20 As shown, as a non-limiting example, the above step S803 may include the following content:
[0157] S901, verifying the valid area according to the center position, the length of the upper boundary and the lower boundary, and the length of the left boundary and the right boundary of the polygonal area in the adjacent multiple frames of endoscopic images.
[0158] In this embodiment, when it is determined that the shape of the effective area is a polygon, the computer device can further verify whether the polygon corresponding to the effective area is correct based on the parameters of the polygonal area in the adjacent multi-frame endoscopic images. The computer device can obtain multiple frames of endoscopic images adjacent to the frame of endoscopic image, and obtain the center position, the length of the upper boundary and the lower boundary, and the length of the left boundary and the right boundary of the polygonal area in the multiple frames of endoscopic images, and verify whether the polygon corresponding to the effective area is correct based on the length of the upper boundary and the lower boundary and the length of the left boundary and the right boundary of multiple adjacent polygonal areas.
[0159] Furthermore, if the valid area verification is passed, the valid area in the endoscopic image is directly segmented based on the polygon composed of the upper boundary and the lower boundary and the left boundary and the right boundary.
[0160] S902: If the verification fails, the effective area is corrected based on the center positions, the lengths of the upper and lower boundaries, and the lengths of the left and right boundaries.
[0161] If the verification fails, the computer device can correct the center position, the length of the upper and lower boundaries, and the length of the left and right boundaries of the polygon corresponding to the valid area based on the center position and the corresponding radius of the circular area in the adjacent multi-frame endoscopic images, so that the error between the parameters of the polygon corresponding to the valid area and the polygon parameters of the adjacent multi-frame endoscopic images is smaller.
[0162] S903, segmenting the corrected effective area in the endoscopic image.
[0163] In this embodiment, after the computer device obtains the polygon corresponding to the corrected effective area, the effective area in the endoscopic image is segmented using the corrected polygon.
[0164] In the above-mentioned image segmentation method, the effective area is verified according to the center position of the polygonal area in the adjacent multi-frame endoscopic image and the corresponding lengths of the upper and lower boundaries and the lengths of the left and right boundaries; if the verification fails, the effective area is corrected based on each center position and the corresponding lengths of the upper and lower boundaries and the lengths of the left and right boundaries; and the corrected effective area in the endoscopic image is segmented. This method uses the center position of the polygonal area in the adjacent multi-frame endoscopic image and the corresponding lengths of the upper and lower boundaries and the lengths of the left and right boundaries to accurately verify the effective area, and in the case of failure in the verification, the effective area can be accurately corrected to improve the segmentation accuracy of the effective area.
[0165] Based on the above embodiments, this embodiment is to Figure 2 The relevant contents of step S201 "obtaining an endoscopic image of the target part" are introduced and explained. Fig.21 As shown, as a non-limiting example, the above step S201 may include the following content:
[0166] S1001, acquiring an initial endoscopic image of a target site.
[0167] In this embodiment, the computer device may search for the initial endoscopic image of the target part in the endoscopic image database. Alternatively, the computer device may also control the endoscopic device to acquire the initial endoscopic image of the target part through a control instruction. This embodiment does not limit the method for acquiring the initial endoscopic image of the target part.
[0168] S1002, performing image enhancement on the initial endoscopic image, and using the enhanced initial endoscopic image as the endoscopic image of the target part.
[0169] Among them, since the overall endoscopic image is dark, the effective area is mostly red. The purpose of using image enhancement is to enhance the contrast between the effective area and the background area in the initial endoscopic image, so as to widen the gap between the effective area and the background area in the initial endoscopic image, so as to facilitate the subsequent image segmentation process.
[0170] Optionally, the computer device may use color space conversion to convert the initial endoscopic image from the RGB color space to the HSV space, and enhance the S channel to enhance the color saturation to narrow the gap between the bright red corresponding to the effective area and the black corresponding to the background area. Alternatively, the computer device may perform equalization processing on the histogram corresponding to the initial endoscopic image to increase the contrast between the bright red corresponding to the effective area and the black corresponding to the background area. This embodiment does not limit the method of image enhancement.
[0171] In the above-mentioned image segmentation method, an initial endoscopic image of the target part is obtained, the initial endoscopic image is enhanced, and the enhanced initial endoscopic image is used as the endoscopic image of the target part. By enhancing the initial endoscopic image, the method can widen the gap between the effective area and the background area in the endoscopic image, thereby obtaining a more accurate endoscopic image.
[0172] As a specific embodiment of the present application, Fig. 22 As shown, the image segmentation method includes:
[0173] S1101, acquiring an initial endoscopic image of a target site;
[0174] S1102, performing image enhancement on the initial endoscopic image, and using the enhanced initial endoscopic image as the endoscopic image of the target part;
[0175] S1103, sampling the endoscopic image of the target part to obtain a plurality of sampling points;
[0176] S1104, dividing each sampling point to obtain a plurality of sampling point sets; each sampling point set includes any three sampling points among the sampling points;
[0177] S1105, fitting three sampling points in each sampling point set to obtain multiple fitting circles;
[0178] S1106, obtaining the number of fitted circles whose center positions are within the center range of the endoscope;
[0179] S1107, determining the ratio of the number of fitted circles to the total number of fitted circles as the confidence of the sampling point;
[0180] S1108, determining the sampling points with confidence levels higher than a preset confidence threshold as boundary sampling points of the effective area in the endoscopic image;
[0181] S1109, obtaining the distance between each boundary sampling point and the center of the boundary circle;
[0182] S1110, calculating the average distance of each distance;
[0183] S1111, if the distance is less than a preset distance threshold, determining that the shape of the effective area is a circle;
[0184] S1112, verifying the valid area according to the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images;
[0185] S1113, if the verification fails, correcting the effective area based on the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images;
[0186] S1114, segmenting the corrected effective area in the endoscopic image;
[0187] S1115, if the distance is greater than or equal to a preset distance threshold, determining that the shape of the effective area is a polygon;
[0188] S1116, drawing a plurality of sampling lines along the longitudinal axis direction on the endoscopic image to determine the upper boundary and the lower boundary of the effective area;
[0189] S1117, determining the left boundary and the right boundary of the effective area based on the fitted circle;
[0190] S1118, verifying the valid area according to the center position, the length of the upper boundary and the lower boundary, and the length of the left boundary and the right boundary of the polygonal area in the adjacent multiple frames of endoscopic images;
[0191] S1119, if the verification fails, the effective area is corrected based on the center position, the length of the upper boundary and the lower boundary, and the length of the left boundary and the right boundary;
[0192] S1120, segmenting the corrected effective area in the endoscopic image.
[0193] Furthermore, when segmenting an endoscopic video including multiple frames of endoscopic images, since the effective area of the endoscopic video usually does not change over a period of time, in order to improve efficiency, repeated detection is avoided. The enhanced image is point sampled, and the position changes of the obtained sampling points are compared with those of the sampling points during the last area detection and saved as a distance array. The distance array is subjected to median regression. If the distance is close to 0, it is considered that the effective area has not changed and the segmentation position remains unchanged. Otherwise, the effective area changes, and the endoscopic area detection and segmentation are performed again. Point sampling can avoid repeated detection and segmentation, thereby improving the segmentation efficiency of the effective area of the endoscopic video. In the process of segmenting each frame of the endoscopic image, the effective area can be automatically segmented in real time, and the segmentation speed is fast, and the segmentation results obtained are accurate.
[0194] Fig.23 The present invention is a flow chart of a method for segmenting effective areas in an endoscopic video, the method comprising: S1201: acquiring an endoscopic video of a target part; S1202: performing image enhancement on the endoscopic video; S1203: identifying effective areas in the image-enhanced endoscopic video; S1204: correcting the effective areas by using multiple frames of endoscopic images in the endoscopic video; S1205: dividing the effective areas in the endoscopic video according to the correction results.
[0195] Fig.24 The present invention is a flow chart of an image segmentation method, which includes: S1301: obtaining any frame of endoscopic image in an endoscopic video; S1302: performing edge detection on the endoscopic image to obtain multiple sampling points; S1303: selecting boundary sampling points with higher confidence from the multiple sampling points; S1304: performing circle fitting on the boundary sampling points to obtain a boundary circle; S1305: judging whether the distance between the boundary circle and the boundary sampling points is greater than a preset threshold; S1306: if it is greater than the preset threshold, determining that the effective area is a polygon; S1307: segmenting the effective area based on the fitting shape of the polygon; S1308: if it is less than or equal to the preset threshold, determining that the effective area is a circle; S1309: segmenting the effective area according to the boundary circle.
[0196] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0197] Based on the same inventive concept, the embodiment of the present application also provides an image segmentation device for implementing the above-mentioned image segmentation method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more image segmentation device embodiments provided below can refer to the limitations on the image segmentation method above, and will not be repeated here.
[0198] In one embodiment, Fig.25 As shown, an image segmentation device is provided, comprising: an acquisition module 11, a sampling module 12, a determination module 13 and a segmentation module 14, wherein:
[0199] An acquisition module 11 is used to acquire an endoscopic image of a target part;
[0200] A sampling module 12 is used to sample the endoscopic image of the target part to obtain a plurality of sampling points;
[0201] The determination module 13 is used to determine the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point; the confidence indicates the probability that each sampling point is a boundary sampling point;
[0202] The segmentation module 14 is used to segment the effective area in the endoscopic image based on the boundary sampling points of the effective area.
[0203] In one embodiment, the above-mentioned determination module includes a first determination unit, wherein:
[0204] The first determining unit is used to determine the sampling points whose confidence levels are higher than a preset confidence threshold as the boundary sampling points of the effective area in the endoscopic image.
[0205] In one embodiment, the above-mentioned image segmentation device further includes: an acquisition module and a confidence determination module, wherein:
[0206] A division module is used to divide each sampling point to obtain multiple sampling point sets; each sampling point set contains any three sampling points among the sampling points;
[0207] A fitting module, used for fitting three sampling points in each sampling point set to obtain multiple fitting circles;
[0208] The confidence determination module is used to determine the confidence of the sampling point based on each fitting circle.
[0209] In one embodiment, the above confidence determination module includes: a first acquisition unit and a second determination unit, wherein:
[0210] A first acquisition unit is used to acquire the number of fitting circles whose center positions are within the center range of the endoscope;
[0211] The second determining unit is used to determine the ratio of the number of fitted circles to the total number of fitted circles as the confidence of the sampling point.
[0212] In one embodiment, the segmentation module includes: a second acquisition unit, a third determination unit and a segmentation unit, wherein:
[0213] The second acquisition unit is used to acquire the distance between each boundary sampling point and the center of the boundary circle; the boundary circle is obtained by performing circle fitting on the boundary sampling points;
[0214] A third determining unit, configured to determine a shape of the effective area based on each distance;
[0215] The segmentation unit is used to segment the effective area in the endoscope image according to the shape of the effective area.
[0216] In one embodiment, the third determination unit is also used to calculate the average distance of each distance; when the average distance is less than a preset distance threshold, the shape of the effective area is determined to be a circle; when the average distance is greater than or equal to the preset distance threshold, the shape of the effective area is determined to be a polygon.
[0217] In one embodiment, the segmentation unit is also used to verify the effective area based on the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images when the shape of the effective area is circular; if the verification fails, correct the effective area based on the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images; and segment the corrected effective area in the endoscopic image.
[0218] In one embodiment, the segmentation unit is also used to draw a plurality of sampling lines along the longitudinal axis on the endoscopic image when the shape of the effective area is a polygon, so as to determine the upper and lower boundaries of the effective area; determine the left and right boundaries of the effective area based on the boundary circle; and segment the effective area in the endoscopic image based on the upper and lower boundaries and the left and right boundaries.
[0219] In one embodiment, the segmentation unit is also used to verify the effective area according to the center position, the length of the upper and lower boundaries, and the length of the left and right boundaries of the polygonal area in adjacent multiple frames of endoscopic images; if the verification fails, the effective area is corrected based on the center position, the length of the upper and lower boundaries, and the length of the left and right boundaries; and the corrected effective area in the endoscopic image is segmented.
[0220] In one embodiment, the acquisition module includes: a third acquisition unit and an enhancement unit, wherein:
[0221] a third acquisition unit, configured to acquire an initial endoscopic image of the target site;
[0222] The enhancement unit is used to enhance the initial endoscopic image and use the enhanced initial endoscopic image as the endoscopic image of the target part.
[0223] Each module in the above-mentioned image segmentation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0224] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the content of any one of the embodiments of the above-mentioned image segmentation method is implemented.
[0225] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the content of any one of the embodiments of the above-mentioned image segmentation method is implemented.
[0226] In one embodiment, a computer program product is provided, including a computer program, which implements the content of any one of the embodiments of the above-mentioned image segmentation method when executed by a processor.
[0227] It should be noted that the user information (including but not limited to user device information and user personal information, etc.) and data (including but not limited to data used for analysis, stored data and displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0228] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM) and graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, or a data processing logic device based on quantum computing, etc., but are not limited thereto.
[0229] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0230] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An image segmentation method, characterized in that: The method comprises: Acquiring an endoscopic image of the target site; Sampling the endoscopic image of the target part to obtain a plurality of sampling points; Determining the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point; the confidence indicates the probability that each sampling point is the boundary sampling point; The effective area in the endoscopic image is segmented based on the boundary sampling points of the effective area.
2. The method according to claim 1, characterized in that Determining the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point includes: The sampling points whose confidence levels are higher than a preset confidence threshold are determined as boundary sampling points of the effective area in the endoscopic image.
3. The method according to claim 1 or 2, characterized in that: Before determining the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point, the method further includes: Dividing each of the sampling points to obtain a plurality of sampling point sets; each sampling point set includes any three sampling points among the sampling points; Fitting is performed on three sampling points in each sampling point set to obtain multiple fitting circles; Based on each of the fitted circles, the confidence level of the sampling point is determined.
4. The method according to claim 3, characterized in that The step of determining the confidence level of the sampling point based on each of the fitted circles comprises: Obtaining the number of fitted circles whose center positions are within the center range of the endoscope; The ratio of the number of the fitting circles to the total number of the fitting circles is determined as the confidence of the sampling point.
5. The method according to claim 1 or 2, characterized in that: The segmenting of the effective area in the endoscopic image based on the boundary sampling points of the effective area includes: Obtaining the distance between each of the boundary sampling points and the center of a boundary circle; the boundary circle is obtained by performing circle fitting on the boundary sampling points; Based on each of the distances, determining a shape of the effective area; The effective area in the endoscopic image is segmented according to the shape of the effective area.
6. The method according to claim 5, characterized in that The determining the shape of the effective area based on the distance includes: Calculating the average distance of each of the distances; If the average distance is less than a preset distance threshold, determining that the shape of the effective area is a circle; If the average distance is greater than or equal to the preset distance threshold, it is determined that the shape of the effective area is a polygon.
7. The method according to claim 6, characterized in that The segmenting of the effective area in the endoscopic image according to the shape of the effective area includes: When the shape of the effective area is the circle, verifying the effective area according to the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images; If the verification fails, the effective area is corrected based on the center position and the corresponding radius of the circular area in the adjacent multiple frames of endoscopic images; The corrected effective area in the endoscopic image is segmented.
8. The method according to claim 6, characterized in that The segmenting of the effective area in the endoscopic image according to the shape of the effective area includes: In the case where the shape of the effective area is the polygon, a plurality of sampling lines are drawn along the longitudinal axis direction on the endoscopic image to determine the upper boundary and the lower boundary of the effective area; Based on the boundary circle, determining the left boundary and the right boundary of the effective area; The effective area in the endoscopic image is segmented based on the upper boundary and the lower boundary and the left boundary and the right boundary.
9. The method according to claim 8, characterized in that The segmenting of the effective area in the endoscopic image based on the upper boundary and the lower boundary and the left boundary and the right boundary includes: Verifying the valid area according to the center position of the polygonal area in the adjacent multiple frames of endoscopic images, the length of the upper boundary and the lower boundary, and the length of the left boundary and the right boundary; If the verification fails, the effective area is corrected based on the center position, the length of the upper boundary and the lower boundary, and the length of the left boundary and the right boundary; The corrected effective area in the endoscopic image is segmented.
10. The method according to claim 1 or 2, characterized in that: The step of obtaining an endoscopic image of a target part includes: obtaining an initial endoscopic image of the target site; The initial endoscopic image is enhanced, and the enhanced initial endoscopic image is used as the endoscopic image of the target part.
11. An image segmentation device, characterized in that: The device comprises: An acquisition module, used for acquiring an endoscopic image of a target site; A sampling module, used for sampling the endoscopic image of the target part to obtain a plurality of sampling points; A determination module, used to determine the boundary sampling points of the effective area in the endoscopic image according to the confidence of each sampling point; the confidence indicates the probability that each sampling point is the boundary sampling point; The segmentation module is used to segment the effective area in the endoscopic image based on the boundary sampling points of the effective area.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Cited By
Data analysis method based on EGA intelligent slot
CN121158944A