A method and device for identifying lesion size based on virtual ruler
Through virtual ruler method and vectorization processing, the problem of inaccurate reading of lesions image clarity affects lesions size is solved, and accurate lesions size measurement is achieved, which reduces errors and improves measurement accuracy.
Patent Information
- Application Number
- CN202210973396.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-08-15
AI Technical Summary
In the prior art, the image clarity of the esophageal varicose lesions affects the reading of the lesions inaccurately, the machine reading error is large, and the image distortion after amplification is severe, and the lesions cannot be accurately obtained.
The lesion size recognition method based on the virtual ruler is adopted, and the circle image of the lesion center is obtained through image recognition processing, the cross-line ruler is established, vectorized processing is performed, error parameters are calculated, the precise size is obtained, and the actual lesion size is calculated using the object-image ratio.
It improves the accuracy of lesion size reading, reduces errors, ensures that image amplification will cause distortion, and provides more accurate lesion size measurement.
Smart Images

Figure CN115345850B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of lesion measurement, and in particular to a lesion size recognition method based on a virtual ruler and a lesion size recognition device based on a virtual ruler. Background Art
[0002] Esophageal varices refers to the abnormal enlargement of the veins in the esophagus, which is generally caused by obstruction of venous return. When the blood vessels in the esophagus rupture and bleed, symptoms such as vomiting blood, black tarry or bloody stools, rapid heartbeat, cold and clammy skin, and dizziness may occur.
[0003] In order to obtain the situation of the lesion in the esophagus, the inside of the esophagus is generally photographed to obtain the lesion image, and the size of the lesion is known by reading the lesion image. This can be read manually or by machine. The manual reading error is larger, while the machine reading error is smaller. However, due to the influence of the clarity of the lesion image, the machine reading still has a certain error, resulting in inaccurate acquisition of the lesion size. Even if the image is enlarged for reading, the enlarged image is severely distorted and the size of the lesion cannot be accurately read. Summary of the Invention
[0004] Based on this, it is necessary to provide a lesion size recognition method based on a virtual ruler and a lesion size recognition device based on a virtual ruler to address the problem that the lesion size cannot be accurately read due to the clarity of the lesion image.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for identifying lesion size based on a virtual ruler, the method comprising the following steps:
[0007] S1. Acquire a lesion image, perform image recognition processing on the lesion image, and obtain an image of the lesion center circle;
[0008] S2. Establish a crosshair with the center of the lesion center circle image as the center point, and set a scale on the crosshair that matches the radius value of the lesion center circle image in the same proportion to obtain a crosshair ruler;
[0009] S3. Stroke the lesion on the lesion center circle image, search for the stroked outline of the lesion center circle image, read the value of the coincidence point of the stroked outline of the lesion center circle image and the crosshair scale, obtain a preliminary size, and add the preliminary size and the error parameter to obtain the virtual lesion size, wherein the calculation of the error parameter comprises the following steps;
[0010] S301. Decompose the lesion center circle image into multiple paths, preset a pixel standard value, and remove paths where the path pixels are smaller than the pixel standard value;
[0011] S302. Approximate each remaining path as a polygon, and perform curve optimization on the polygon to obtain the optimal polygon;
[0012] S303. Convert the optimal polygon into a smooth vector contour, and integrate multiple vector contours to obtain a vector image of the lesion center circle;
[0013] S304. Enlarge the lesion center circle vector diagram at a specified ratio to obtain a vector enlargement diagram, perform stroke processing on the lesion on the vector enlargement diagram, search for the stroked outline of the vector enlargement diagram, read the value of the overlap point between the stroked outline of the vector enlargement diagram and the crosshair scale to obtain the precise size;
[0014] S305. Calculate the difference between the preliminary size and the precise size to obtain the dimensional error;
[0015] S306. Repeat step S301 until the number of repetitions reaches the preset number of times, then stop repeating;
[0016] S307. Calculate the average value of multiple dimensional errors to obtain error parameters.
[0017] S4. Calculate the actual lesion size using the object-image ratio using the virtual lesion size as h / H = f / d, where h is the virtual lesion size, H is the actual lesion size, f is the focal length when the lesion image is taken, and d is the object distance when the lesion image is taken.
[0018] Furthermore, the polygon is curve optimized using a graph theory algorithm to obtain the optimal polygon.
[0019] Furthermore, when the actual lesion size is obtained, the actual lesion size is displayed in real time.
[0020] In one embodiment, the image recognition processing method includes the following steps:
[0021] S101. Scan each pixel in the lesion image using a Gaussian filter template, and replace the value of the central pixel of the template with the weighted average grayscale value of the pixels in the neighborhood determined by the template to obtain a denoised lesion image;
[0022] S102. Calculate the gradient amplitude and gradient direction of the denoised lesion image, perform non-maximum suppression and double threshold processing on the gradient amplitude according to the gradient direction to obtain edge pixels, connect the edge pixels to obtain an edge-detected lesion image;
[0023] S103. Perform Hough circle transform on the edge-detected lesion image to obtain a lesion center circle image.
[0024] In one embodiment, the image recognition processing method includes the following steps:
[0025] S11. Converting the lesion image from RGB mode to Lab mode, extracting blue from the lesion image in Lab mode, and performing binarization processing to obtain a binary lesion image;
[0026] S12. Performing median filtering on the binarized lesion image to reduce noise, thereby obtaining a reduced-noise lesion image;
[0027] S13. Use the region detection algorithm to detect all connected regions in the denoised lesion image, filter out connected regions with smaller areas, mark the remaining connected regions, and connect the marked connected regions in a clockwise order to obtain a lesion center circle image.
[0028] The present invention also includes a lesion size identification device based on a virtual ruler, comprising:
[0029] A lesion center circle image acquisition module is used to acquire a lesion image, perform image recognition processing on the lesion image, and obtain a lesion center circle image;
[0030] A crosshair scale acquisition module is used to establish a crosshair with the center of the lesion center circle image as the center point, and set a scale on the crosshair that matches the radius value of the lesion center circle image in the same proportion to obtain a crosshair scale;
[0031] The virtual lesion size calculation module is used to stroke the lesion on the lesion center circle image, search for the stroke outline of the lesion center circle image, read the value of the coincidence point of the stroke outline of the lesion center circle image and the crosshair ruler, obtain the preliminary size, and add the preliminary size and the error parameter to calculate the virtual lesion size, wherein the error parameter is obtained by decomposing the lesion center circle image into multiple paths, presetting a pixel standard value, removing the path whose path pixels are less than the pixel standard value, approximating each remaining path as a polygon, optimizing the polygon curve, obtaining the optimal polygon, and The optimal polygon is converted into a smooth vector contour, multiple vector contours are integrated to obtain a lesion center circle vector diagram, the lesion center circle vector diagram is enlarged at a rated ratio to obtain a vector enlarged image, the lesion on the vector enlarged image is stroked, the stroke contour of the vector enlarged image is searched, the value of the coincidence point of the stroke contour of the vector enlarged image and the crosshair ruler is read to obtain the precise size, the preliminary size and the precise size are calculated as a difference to obtain a size error, the above operation is repeated until the number of repetitions reaches a preset number, the repetition is stopped, and the multiple size errors are averaged to obtain an error parameter;
[0032] The actual lesion size calculation module is used to calculate the actual lesion size by the object-image ratio of the virtual lesion size. The calculation formula is h / H=f / d, where h is the virtual lesion size, H is the actual lesion size, f is the focal length when taking the lesion image, and d is the object distance when taking the lesion image.
[0033] Furthermore, the polygon is curve optimized using a graph theory algorithm to obtain the optimal polygon.
[0034] Furthermore, the identification device also includes a display module, which is used to obtain the actual lesion size and display the actual lesion size in real time.
[0035] In one embodiment, the recognition device further includes an image recognition processing module, which is configured to:
[0036] Use a Gaussian filter template to scan each pixel in the lesion image, and use the weighted average grayscale value of the pixels in the neighborhood determined by the template to replace the value of the central pixel of the template to obtain a denoised lesion image;
[0037] Calculate the gradient amplitude and gradient direction of the denoised lesion image, perform non-maximum suppression and double threshold processing on the gradient amplitude according to the gradient direction to obtain edge pixels, and connect the edge pixels to obtain the edge detected lesion image;
[0038] Perform Hough circle transform on the edge detected lesion image to obtain the lesion center circle image.
[0039] In one embodiment, the recognition device further includes an image recognition processing module, which is configured to:
[0040] Converting the lesion image from RGB mode to Lab mode, extracting blue from the lesion image in Lab mode, and performing binarization processing to obtain a binary lesion image;
[0041] Perform median filtering on the binarized lesion image to reduce noise, and obtain a denoised lesion image;
[0042] The region detection algorithm is used to detect all connected regions in the denoised lesion image, and the connected regions with smaller areas are filtered out. The remaining connected regions are marked, and the marked connected regions are connected in a clockwise order to obtain the lesion center circle image.
[0043] The technical solution provided by the present invention has the following beneficial effects:
[0044] 1. The present invention performs image recognition and vectorization processing on the lesion image first, so that no distortion occurs when the lesion image is magnified, the clarity of the lesion image is guaranteed, and the size of the lesion in the lesion image is easily read, thereby obtaining a more accurate lesion size.
[0045] 2. The present invention obtains error parameters when reading lesions through multiple experiments, obtains the actual lesion size through the error parameters, reduces the occurrence of accidental events, and improves the accuracy of lesion size reading.
[0046] 3. The present invention improves the clarity of the lesion image by performing image processing on the captured lesion image, and establishes a cross-line ruler on the lesion image to facilitate the acquisition of the size of the lesion. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is a flow chart of a method for identifying lesion size based on a virtual ruler according to the present invention;
[0048] Figure 2 Based on Figure 1 Schematic diagram of a lesion image superimposed with a virtual crosshair ruler. DETAILED DESCRIPTION
[0049] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0050] To address the problem of being unable to accurately read the lesion size due to the clarity of the lesion image, this embodiment provides a lesion size recognition method based on a virtual ruler. By vectorizing the lesion image, no distortion will occur when the lesion image is magnified, making it easier to read the size of the lesion in the lesion image and obtain a more accurate lesion size.
[0051] like Figure 1 As shown, the specific steps of the identification method are:
[0052] S1. Acquire a lesion image, perform image recognition processing on the lesion image, and obtain a lesion center circle image; wherein, the lesion image can be obtained by endoscopy. There are two ways to perform image recognition processing. The first is to use a Gaussian filtered template to scan each pixel in the lesion image, and replace the value of the template center pixel with the weighted average grayscale value of the pixels in the neighborhood determined by the template to obtain a denoised lesion image; calculate the gradient amplitude and gradient direction of the denoised lesion image, perform non-maximum suppression and double threshold processing on the gradient amplitude according to the gradient direction to obtain edge pixel points, connect the edge pixel points to obtain an edge detected lesion image; perform Hough circle transform on the edge detected lesion image to obtain a lesion center circle image. The second method is to convert the lesion image from RGB mode to Lab mode, extract blue from the lesion image in Lab mode, and perform binarization processing to obtain a binary lesion image; perform median filtering on the binary lesion image to reduce noise and obtain a denoised lesion image; use a region detection algorithm to detect all connected regions in the denoised lesion image, filter out connected regions with smaller areas, mark the remaining connected regions, and connect the marked connected regions in a clockwise order to obtain a lesion center circle image. According to the two different image processing methods, the lesion center circle image is finally obtained.
[0053] S2. Establish a crosshair with the center of the lesion center circle image as the center point, set a scale on the crosshair that matches the radius value of the lesion center circle image in the same proportion, and obtain a crosshair scale, such as Figure 2 As shown;
[0054] S3. Stroke the lesion on the lesion center circle image, search for the stroked outline of the lesion center circle image, read the value of the overlap point of the stroked outline of the lesion center circle image and the crosshair scale, obtain the preliminary size, and add the preliminary size and the error parameter to calculate the virtual lesion size. The stroke process can manually draw the lesion edge or directly select the lesion edge, and determine the lesion edge through repeated adjustments;
[0055] The calculation of the error parameter includes the following steps: decomposing the lesion center circle image into multiple paths, presetting a pixel standard value, and removing paths with path pixels smaller than the pixel standard value; approximating each remaining path as a polygon, performing curve optimization on the polygon to obtain an optimal polygon; converting the optimal polygon into a smooth vector contour, integrating multiple vector contours to obtain a lesion center circle vector; amplifying the lesion center circle vector at a rated ratio to obtain a vector magnification image, performing stroke processing on the lesion on the vector magnification image, searching for the stroke contour of the vector magnification image, reading the value of the coincidence point of the stroke contour of the vector magnification image and the crosshair scale to obtain the precise size; performing difference calculation on the preliminary size and the precise size to obtain a size error; repeating step S301 until the number of repetitions reaches a preset number, and then stopping the repetition; calculating the average value of multiple size errors to obtain an error parameter;
[0056] S4. Calculate the actual lesion size using the object-image ratio using the virtual lesion size as h / H = f / d, where h is the virtual lesion size, H is the actual lesion size, f is the focal length when the lesion image is taken, and d is the object distance when the lesion image is taken.
[0057] Geometric optics shows that the object-image ratio on either side of a lens is determined by three factors: focal length, the object's position off the principal optical axis, and object distance. If a fixed endoscope (with a constant focal length) is used and the lesion is kept centered during imaging (with its lateral distance from the principal optical axis at zero), the object distance becomes the only variable influencing the object-image ratio. To determine the actual size of a lesion, simply measure the distance from the end of the endoscope to the lesion (the object distance) and the lesion's size in the image. This allows calculation of the object-image ratio. Alternatively, a sensor can be installed on the endoscope to directly measure the distance. The appropriate acquisition method should be selected based on the actual situation.
[0058] The so-called "object-image ratio" describes the ratio of the overall size of an object and image using the same unit of measurement. If we break it down into smaller units, taking its reciprocal and converting the image's centimeters into pixels, we arrive at a new representation of the object-image ratio: "pixels / cm." This parameter is the basic unit for measuring lesion size.
[0059] By obtaining the object-image ratio and the size of the lesion image, the actual size of the lesion can be known. If you want to know the area of the lesion, you can calculate the area of the lesion image, place the lesion image in a two-dimensional grid, count the two-dimensional grids with the lesion image, and obtain the side length of a single two-dimensional grid based on the crosshair ruler. Calculate the area of a single two-dimensional grid and multiply it by the number to know the imaging area of the lesion. The actual area of the lesion can be known through the object-image ratio. For the number and area of the two-dimensional grids, the number should be as large as possible and the area should be as small as possible, so the actual error will be small.
[0060] The detailed steps for obtaining the error parameters are as follows: The image of the lesion center circle is binarized so that the image is only black and white. The bitmap is placed in a coordinate system where each pixel corner has integer coordinates. It is further assumed that the background is white and the foreground is black. By convention, the area beyond the bitmap boundary is assumed to be filled with white. A bitmap is decomposed into paths, starting from a pair of adjacent pixels with different colors, for example, by selecting the leftmost black pixel in a row. The two selected pixels meet on an edge, and the direction of the edge is changed so that the black pixel is on the left and the white pixel is on the right. The path is continued to expand so that the new edge has a black pixel on its left and a white pixel on its right. Relative to the direction of the path, that is, moving along the edge between pixels, each time a corner is encountered, go straight or turn left or right until you return to the starting point, that is, a point that defines a closed graph. The closed graph is removed from the graph by inverting the colors of all pixels, defining a new bitmap. The recursion is continued on this graph until no black pixels remain, resulting in a set of closed paths.
[0061] De-noising can be done by removing all paths with less than a preset number of pixels inside the path, first finding all straight paths, then approximating all non-valued paths into straight paths, and constructing polygons from closed paths. A variable of a standard graph theory algorithm is used to find the optimal ring in the directed graph, that is, the optimal polygon, and adjust the position of the polygon vertices to make it conform to the source bitmap as much as possible. It mainly calculates corners and curves based on the length of adjacent line segments and the angle between them. A standard graph theory algorithm is used to decompose the given curve segments to an acceptable approximation using the shortest path, optimize the number of segments, and achieve the purpose of curve optimization. The optimal polygon is converted into a smooth vector contour through a linear transformation.
[0062] In actual use, the error parameters of each measurement can be stored and a database can be established. After the data reaches the rated amount, big data analysis is performed on the stored error parameters to obtain an error parameter comparison table. When taking a lesion image, the error parameters can be directly obtained through the error parameter comparison table based on the pixel value of the image, without the need to evaluate the error parameters, thereby obtaining the required virtual lesion size or virtual lesion area, simplifying the steps.
[0063] Based on the aforementioned lesion size recognition method based on a virtual ruler, a lesion size recognition device based on a virtual ruler is also provided, including a lesion center circle image acquisition module, a crosshair ruler acquisition module, a virtual lesion size calculation module, and an actual lesion size calculation module.
[0064] The lesion center circle image acquisition module is used to acquire the lesion image, perform image recognition processing on the lesion image, and obtain the lesion center circle image; wherein, the recognition device also includes an image recognition processing module. The image recognition module includes two methods, which are consistent with the above, but the first method uses Gaussian filtering, Canny edge detection and Hough circle detection. Gaussian filtering is a linear smoothing filter that is suitable for eliminating Gaussian noise and is widely used in the noise reduction process of image processing. Gaussian filter is a linear filter that can effectively suppress noise and smooth the image. Its working principle is similar to that of the mean filter, and both take the mean of the pixels in the filter window as the output. The coefficient of its window template is different from that of the mean filter. The template coefficient of the mean filter is always 1. The template coefficient of the Gaussian filter decreases as the distance from the center of the template increases. Therefore, the Gaussian filter has a smaller blurring effect on the image than the mean filter. In layman's terms, Gaussian filtering is a process of weighted averaging of the entire image. The value of each pixel is obtained by weighted averaging of itself and other pixel values in the neighborhood. Canny edge detection is used to extract image edges. Its working steps are to first calculate the gradient amplitude and direction to estimate the edge strength and direction at each point, and then calculate the gradient amplitude and direction to estimate the edge strength and direction at each point. According to the gradient direction, the gradient amplitude is non-maximum suppressed, which is essentially a further refinement of the results of operators such as Sobel and Prewitt, and finally double threshold processing and edge connection are used; Hough circle detection uses the "Hough gradient method", and its detection idea is to traverse and accumulate the center of the circle corresponding to all non-zero points, and consider the center of the circle. The idea is that every non-zero pixel point on the image may be a potential point on the circle. Like the Hough line transform, it also generates a cumulative coordinate plane through voting, and sets a cumulative weight to locate the circle. The final detection result is the coordinates and radius of the circle in the image.
[0065] The second method is through HSV color binarization, median filter noise reduction, and region detection; HSV color binarization is to convert the color of the video image from RGB mode to Lab mode, and then extract the blue from the image to binarize the image; use the median filter to reduce noise. The median filter is a nonlinear digital filter that is often used to remove noise from images or other signals. Its algorithm is to sort the numbers observed in the filter window and then select the median as the output of the filter window; use the region detection algorithm to find all connected areas in the image. After filtering out the smaller areas, what remains is the marked area on the tube. After sorting the marked areas clockwise, connect the centers of the areas and find the midpoint of the connecting line to get the center of the circle, and the radius is the distance between the intersection of the connecting line from the center of the circle to the boundary of the marked area.
[0066] The crosshair scale acquisition module is used to establish a crosshair with the center of the lesion center circle image as the center point, set a scale on the crosshair that matches the radius value of the lesion center circle image in the same proportion, and obtain a crosshair scale.
[0067] The virtual lesion size calculation module is used to stroke the lesion on the lesion center circle image, search for the stroke outline of the lesion center circle image, read the value of the coincidence point of the stroke outline of the lesion center circle image and the crosshair ruler, obtain the preliminary size, and add the preliminary size and the error parameter to calculate the virtual lesion size, wherein the error parameter is obtained by decomposing the lesion center circle image into multiple paths, presetting a pixel standard value, removing the path whose path pixels are less than the pixel standard value, approximating each remaining path as a polygon, optimizing the polygon curve, obtaining the optimal polygon, and The optimal polygon is converted into a smooth vector contour, multiple vector contours are integrated to obtain a lesion center circle vector diagram, the lesion center circle vector diagram is enlarged at a rated ratio to obtain a vector enlarged image, the lesion on the vector enlarged image is stroked, the stroke contour of the vector enlarged image is searched, the value of the coincidence point of the stroke contour of the vector enlarged image and the crosshair scale is read to obtain the precise size, the preliminary size and the precise size are calculated as a difference to obtain the size error, the above operation is repeated until the number of repetitions reaches a preset number, the repetition is stopped, the multiple size errors are averaged to obtain an error parameter.
[0068] The actual lesion size calculation module is used to calculate the actual lesion size by the object-image ratio of the virtual lesion size. The calculation formula is h / H=f / d, where h is the virtual lesion size, H is the actual lesion size, f is the focal length when taking the lesion image, and d is the object distance when taking the lesion image. It also includes a display module to display the actual lesion size in real time.
[0069] When the recognition device is working, the above-mentioned recognition method is implemented, error parameters are obtained to improve the accuracy of reading, and the establishment of a virtual cross-hair scale can provide a proportional reference. The enlargement and reduction of the image does not affect the reading of the size. At the same time, the lesion size is displayed, which is convenient for the user to know directly and improves the convenience of use.
[0070] The technical features of the above embodiments can be combined arbitrarily. 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.
[0071] The above embodiments merely illustrate several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the patent for this invention shall be determined by the appended claims.
Claims
1. A lesion size identification method based on a virtual ruler, which is used to obtain the lesion size, characterized in that: The identification method comprises the following steps: S1. Acquire a lesion image, perform image recognition processing on the lesion image, and obtain an image of the lesion center circle; S2. Establish a crosshair with the center of the lesion center circle image as the center point, and set a scale on the crosshair that matches the radius value of the lesion center circle image in the same proportion to obtain a crosshair scale; S3. Stroke the lesion on the lesion center circle image, search for the stroked outline of the lesion center circle image, read the value of the overlapping point of the stroked outline of the lesion center circle image and the crosshair scale to obtain a preliminary size, and add the preliminary size and an error parameter to calculate a virtual lesion size, wherein the calculation of the error parameter comprises the following steps; S301. Decompose the lesion center circle image into multiple paths, preset a pixel standard value, and remove paths where the path pixels are smaller than the pixel standard value; S302. Approximate each remaining path as a polygon, and perform curve optimization on each polygon to obtain the optimal polygon; S303. Converting the optimal polygon into a smooth vector contour, integrating multiple vector contours to obtain a vector image of the lesion center circle; S304. Enlarging the lesion center circle vector diagram at a specified ratio to obtain a vector enlargement diagram, performing stroke processing on the lesion on the vector enlargement diagram, searching for the stroked outline of the vector enlargement diagram, and reading the value of the overlap point between the stroked outline of the vector enlargement diagram and the crosshair scale to obtain the precise size; S305. Calculate the difference between the preliminary size and the precise size to obtain a dimensional error; S306. Repeat step S301 until the number of repetitions reaches the preset number of times, then stop repeating; S307. Calculate the average value of multiple dimensional errors to obtain the error parameter; S4. Calculate the actual lesion size using the object-image ratio using the virtual lesion size as h / H=f / d, where h is the virtual lesion size, H is the actual lesion size, f is the focal length when the lesion image is taken, and d is the object distance when the lesion image is taken.
2. The method for identifying lesion size based on a virtual ruler according to claim 1, characterized in that: The polygon is subjected to curve optimization by a graph theory algorithm to obtain an optimal polygon.
3. The method for identifying lesion size based on a virtual ruler according to claim 1, characterized in that: When the actual lesion size is obtained, the actual lesion size is displayed in real time.
4. The method for identifying lesion size based on a virtual ruler according to claim 1, characterized in that: The image recognition processing method comprises the following steps: S101. Scan each pixel in the lesion image using a Gaussian filter template, and replace the value of the central pixel of the template with the weighted average grayscale value of the pixels in the neighborhood determined by the template to obtain a denoised lesion image; S102. Calculating the gradient amplitude and gradient direction of the denoised lesion image, performing non-maximum suppression and double thresholding on the gradient amplitude according to the gradient direction to obtain edge pixels, and connecting the edge pixels to obtain an edge-detected lesion image; S103. Perform Hough circle transform on the edge-detected lesion image to obtain the lesion center circle image.
5. The method for identifying lesion size based on a virtual ruler according to claim 1, characterized in that: The image recognition processing method comprises the following steps: S11. Converting the lesion image from RGB mode to Lab mode, extracting blue from the lesion image in Lab mode, and performing binarization to obtain a binarized lesion image; S12. Performing median filtering on the binarized lesion image to reduce noise, obtaining a denoised lesion image; S13. Use a region detection algorithm to detect all connected regions in the denoised lesion image, filter out connected regions with smaller areas, mark the remaining connected regions, and connect the marked connected regions in a clockwise order to obtain the lesion center circle image.
6. A lesion size recognition device based on a virtual ruler, which is used to obtain the lesion size, characterized in that: The method for identifying lesion size based on a virtual ruler according to any one of claims 1 to 5 is adopted, wherein the identification device comprises: a lesion center circle image acquisition module, which is used to acquire a lesion image, perform image recognition processing on the lesion image, and obtain a lesion center circle image; a crosshair scale acquisition module, configured to establish a crosshair with the center of the lesion center circle image as the center point, and to set a scale on the crosshair that matches the radius value of the lesion center circle image in the same proportion to obtain a crosshair scale; A virtual lesion size calculation module is used to stroke the lesion on the lesion center circle image, search for the stroke outline of the lesion center circle image, read the value of the coincidence point of the stroke outline of the lesion center circle image and the crosshair scale, obtain the preliminary size, and add the preliminary size and the error parameter to calculate the virtual lesion size, wherein the error parameter is obtained by decomposing the lesion center circle image into multiple paths, presetting a pixel standard value, removing the path whose path pixels are less than the pixel standard value, approximating each remaining path as a polygon, performing curve optimization on each polygon, obtaining the optimal polygon, and The optimal polygon is converted into a smooth vector outline, a plurality of the vector outlines are integrated to obtain a lesion center circle vector image, the lesion center circle vector image is enlarged at a rated ratio to obtain a vector enlarged image, the lesion on the vector enlarged image is stroked, the stroke outline of the vector enlarged image is searched, the value of the coincidence point of the stroke outline of the vector enlarged image and the crosshair scale is read to obtain a precise size, the preliminary size and the precise size are calculated as a difference to obtain a size error, the above operation is repeated until the number of repetitions reaches a preset number, the repetitions are stopped, and the multiple size errors are averaged to obtain an error parameter; The actual lesion size calculation module is used to calculate the actual lesion size by the object-image ratio of the virtual lesion size. The calculation formula is h / H=f / d, where h is the virtual lesion size, H is the actual lesion size, f is the focal length when taking the lesion image, and d is the object distance when taking the lesion image.
7. The lesion size identification device based on a virtual ruler according to claim 6, characterized in that: The polygon is subjected to curve optimization by a graph theory algorithm to obtain an optimal polygon.
8. The lesion size identification device based on a virtual ruler according to claim 6, characterized in that: The identification device further includes a display module, which is used to obtain the actual lesion size and display the actual lesion size in real time.
9. The lesion size identification device based on a virtual ruler according to claim 6, characterized in that: The recognition device further includes an image recognition processing module, which is used to: Scanning each pixel in the lesion image with a Gaussian filter template, replacing the value of the central pixel of the template with the weighted average grayscale value of the pixels in the neighborhood determined by the template, to obtain a denoised lesion image; Calculating the gradient amplitude and gradient direction of the denoised lesion image, performing non-maximum suppression and double threshold processing on the gradient amplitude according to the gradient direction to obtain edge pixels, and connecting the edge pixels to obtain an edge-detected lesion image; Performing Hough circle transform on the edge-detected lesion image to obtain the lesion center circle image.
10. The lesion size identification device based on a virtual ruler according to claim 6, characterized in that: The recognition device further includes an image recognition processing module, which is used to: Converting the lesion image from the RGB mode to the Lab mode, extracting blue from the lesion image in the Lab mode, and performing binarization processing to obtain a binarized lesion image; Performing median filtering on the binarized lesion image to reduce noise, to obtain a reduced-noise lesion image; A region detection algorithm is used to detect all connected regions in the denoised lesion image, and connected regions with smaller areas are filtered out. The remaining connected regions are marked, and the marked connected regions are connected in a clockwise order to obtain the lesion center circle image.
Citation Information
Patent Citations
Endoscope measurement method and device based on image recognition
CN115345851A