Virtual ruler construction method, system, and measurement method for video image measurement
By constructing a virtual ruler on the endoscopic image, the measurement inaccuracy caused by endoscopic barrel distortion is solved, and a higher accuracy of lesion area measurement is achieved, which is suitable for lesion area measurement during endoscopic exploration and treatment.
Patent Information
- Application Number
- CN202210973582.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-08-15
AI Technical Summary
Images taken by the endoscopic are inaccurate in the measurement data due to barrel distortion, and traditional methods cannot accurately read the length, width or diameter of the lesion area.
By constructing a virtual ruler method, including obtaining endoscope image data, framing processing, extracting end cap contours, establishing relative coordinate systems, scale marks, and using Canny edge detection and Hough gradient calculation, a virtual ruler is constructed to correct barrel distortion.
It improves the accuracy of endoscopic measurement data, can directly read the length, width or diameter of the object to be measured without affecting normal use, reduces reading errors, and is suitable for real-time video and static image measurements.
Smart Images

Figure CN115311239B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of shape and position measurement of lesion areas, and in particular to a method for constructing a virtual ruler for video image measurement, a system for constructing a virtual ruler for video image measurement, a computer terminal for implementing the functions of the method for constructing a virtual ruler for video image measurement, and a measurement method for video images. Background Art
[0002] Endoscopy uses the principle of physical imaging to pass a lighted tube through the mouth into the stomach or other natural orifices to examine or treat diseases. It can penetrate into externally accessible organs (such as the digestive tract, respiratory tract, and urinary tract) and closed endoscopy sites (such as the chest, abdominal, and joint cavities) for observation, diagnosis, and biopsy. It can also perform intracavitary surgeries (such as tumor removal, clearing cancerous obstructions, cholecystectomy, and Oddi sphincterotomy), utilize advanced technologies (such as microwaves and lasers) for interventional treatment, and has multiple functions, including photography and videography.
[0003] For example, during endoscopic exploration and treatment of the digestive tract, it is necessary to measure the length and width of lesions or internal tissues such as blood vessels, polyps, and adenomas. The traditional method is to measure through visual inspection or instrument rulers. However, due to technical problems of the endoscope itself, reading data directly from images and videos taken by the endoscope is inaccurate. In order to obtain more visual fields in the cavity, endoscopes usually use wide-angle lenses, which will cause the relative size of the image to gradually decrease from the center point to the edge point of the image. It looks like a normal-sized picture wrapped in a ball, forming barrel distortion. Directly reading from images and videos with barrel distortion will be less than the true value, resulting in low measurement accuracy. Summary of the Invention
[0004] Based on this, it is necessary to provide a virtual ruler construction method for video image measurement, a virtual ruler construction system for video image measurement, a computer terminal that implements the function of the virtual ruler construction method for video image measurement, and a measurement method for video images to address the problem of barrel distortion of image videos causing the read data to be smaller than the true value.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for constructing a virtual ruler for video image measurement includes the following steps:
[0007] S1. Acquire image data of the target area captured by the endoscope;
[0008] S2. Frame the image data and extract the corresponding end cap contours in each frame. The process of extracting the end cap contours is as follows:
[0009] S21 performs noise reduction processing on each frame of the image data;
[0010] S22. Identify edge regions with gradient differences in each frame of the denoised image using the Canny edge detection algorithm;
[0011] S23. Identify regions with circular edge features in each frame image after edge detection using a circle detection algorithm, and then obtain the end cap contour;
[0012] S3. Calculate the geometric center and radius of the end cap profile using the Hough gradient;
[0013] S4. Establish a relative coordinate system as a blank scale on each frame of the image data. The relative coordinate system has the following characteristics:
[0014] (1) The geometric center of the end cap outline is taken as the origin;
[0015] (2) The horizontal direction is the X-axis and the vertical direction is the Y-axis;
[0016] (3) Determine the limits of each axis based on the geometric radius of the end cap;
[0017] S5. Mark the blank ruler to obtain the desired virtual ruler; the marking process is as follows:
[0018] S51. Perform preliminary scale division on the blank ruler to obtain scale lines;
[0019] S52. Mark a real reference ruler with scale marks on a blank paper to obtain a reference ruler paper;
[0020] S53. The reference ruler paper is photographed through an endoscope, and the origin of the reference ruler coincides with the origin of the blank ruler to obtain a test image;
[0021] S54. Numerically mark the scale lines in the blank ruler according to the scale values of the reference ruler in the test image to obtain the desired virtual ruler.
[0022] Furthermore, the noise reduction processing method includes any one of Gaussian filtering, median filtering, mean filtering, PM equation or TV model.
[0023] Furthermore, the edge area recognition method includes the following steps:
[0024] Calculate the gradient magnitude and gradient direction of each pixel in each frame of the image data;
[0025] Perform non-maximum suppression on the gradient amplitude of the pixel point according to the gradient direction;
[0026] Double threshold processing is performed on the gradient amplitude of the pixel points, and the edges are connected to obtain the edge area.
[0027] Furthermore, the calculation method of the gradient intensity and gradient direction of the pixel point includes a Sobel filter operator or a Prewitt operator.
[0028] In one embodiment, a method for marking scale values on a blank ruler includes the following steps:
[0029] S100. Extract a reference scale on a test image.
[0030] S200: Using the origin of the reference ruler extracted in the previous step as a fixed point, the scale is adjusted according to a preset ratio, so that the scale lines of the reference ruler partially overlap with the scale lines of the blank ruler.
[0031] S300. Calculate the scale values of the overlapping scale lines of the blank ruler according to the ratio.
[0032] S400. Repeat step S200 until all the scales on the blank ruler are marked.
[0033] Furthermore, the method for extracting the true scale includes the following steps:
[0034] Perform Gaussian downsampling on the test image;
[0035] Perform gradient calculation on each pixel of the downsampled test image to obtain the gradient magnitude and gradient direction of each pixel;
[0036] A gradient threshold is preset, and the gradient amplitude of each pixel is compared with the preset gradient threshold. Pixels with gradient amplitudes greater than the gradient threshold are marked as associated pixels, and pixels with gradient amplitudes less than the gradient threshold are marked as isolated pixels.
[0037] The associated pixels are constructed into a line segment support domain, and the gradient direction of the associated pixels is integrated to obtain a line segment support domain direction;
[0038] Calculate the directional error between the gradient direction of the isolated pixel points around the line segment support domain and the direction of the line segment support domain;
[0039] If the direction error is less than a preset tolerance error value, then determine whether the direction error is greater than the gradient threshold;
[0040] If it is greater than, the isolated pixel point corresponding to the direction error is changed to a related pixel point and included in the line segment support domain;
[0041] Update the line segment support domain, and approximate the updated line segment support domain rectangle to obtain an estimated rectangle;
[0042] Determine whether the pixel density of the estimated rectangle is greater than a preset density value;
[0043] If yes, the estimated rectangle is determined to be a line segment, and the interconnected line segments are retained to obtain the true ruler.
[0044] Furthermore, the pixel density calculation method includes the following steps:
[0045] Count and estimate the number of associated pixels in the rectangle to obtain the number of associated points m;
[0046] Determine whether the gradient magnitude of the pixel associated with the previous step is greater than the gradient threshold;
[0047] Mark the associated pixels whose values are greater than the gradient threshold, and calculate the number of marks n.
[0048] The pixel density is obtained by calculating the ratio of the number of markers n to the number of associated points m.
[0049] The present invention also includes a virtual ruler construction system for video image measurement, which is applied to the aforementioned virtual ruler construction method for video image measurement. The virtual ruler construction system for video image measurement includes a data acquisition module and an image processing module.
[0050] The data acquisition module is used to collect image data of the target area captured by the endoscope.
[0051] The image processing module is used to frame the image data and extract the corresponding end cap contour in each frame image; it is also used to calculate the geometric center and geometric radius of the end cap contour using the Hough gradient; it is also used to establish a relative coordinate system as a blank ruler on each frame image in the image data; it is also used to mark the blank ruler with scale to obtain the required virtual ruler.
[0052] The present invention also provides a video image-oriented measurement method, comprising the following steps:
[0053] The aforementioned virtual ruler construction method for video image measurement is used to construct a virtual ruler for the end cap of the endoscope.
[0054] Place the end cap of the endoscope close to the surface of the object to be measured and take a picture of the object to be measured.
[0055] The length, width or diameter of the object being measured can be directly read based on the image taken by the endoscope.
[0056] The present invention also provides a computer terminal, which includes a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, the steps of the aforementioned method for constructing a virtual ruler for video image measurement are implemented.
[0057] The technical solution provided by the present invention has the following beneficial effects:
[0058] 1. By constructing a virtual ruler on the end cap of the endoscope, the present invention can directly read the length, width, or diameter of the object being measured from the image captured by the endoscope. The value of the virtual ruler is re-adjusted according to the barrel distortion, reducing reading errors and improving the accuracy of obtaining the length, width, or diameter of the object being measured.
[0059] 2. The present invention constructs a virtual ruler on the image captured by the endoscope, which does not affect the normal use of the endoscope and facilitates the direct reading of the length, width or diameter of the measured object without the need for additional tools such as instrument rulers. It is suitable for dynamic measurement of real-time video sequence images and static measurement of images captured by exploration.
[0060] 3. The present invention adjusts the parameters of the virtual ruler and thus changes the setting of the conventional digital scale, so as to facilitate clear reading in areas with severe barrel distortion and further reduce reading errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A flowchart of a method for constructing a virtual ruler for video image measurement according to the present invention;
[0062] Figure 2 Based on Figure 1 Flowchart of the video image-oriented measurement method;
[0063] Figure 3 Take a real picture of the object being tested without any processing for the endoscope;
[0064] Figure 4 Based on Figure 1 The actual image of the object being measured taken by the endoscope after processing. DETAILED DESCRIPTION
[0065] 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.
[0066] Example 1
[0067] The present invention's method for constructing a virtual ruler for video image measurement solves the existing problem of inaccurate data reading caused by barrel-distorted images captured by endoscopes, thereby improving the accuracy of data reading. The present invention fully utilizes the characteristics of barrel distortion and constructs a virtual ruler based on this distortion, resulting in a virtual ruler that conforms to endoscopic measurement, providing a virtual tool for subsequent measurement of the object being measured.
[0068] like Figure 1 As shown, the virtual ruler construction method for video image measurement of this embodiment is used to build a virtual ruler on the image of the internal area of the end cap captured by the endoscope. By constructing a virtual ruler that takes into account barrel distortion, it is convenient to read the length, width or diameter of the measured object. The virtual ruler construction method includes the following steps:
[0069] S1. Acquire image data of a target area captured by an endoscope.
[0070] Regarding the end cap of the endoscope, it should be emphasized that the end cap is located at the front end of the endoscope. In order to prevent the endoscope lens from directly contacting the object to be measured and being blocked by the object to be measured, which will cause the endoscope to be unable to shoot normally, an end cap will be installed at the front end of the endoscope. The outer wall of the endoscope is circular, so the overall shape of the end cap is also cylindrical.
[0071] S2. Frame the image data and extract the corresponding end cap contours in each frame. The process of extracting the end cap contours is as follows:
[0072] S21. Perform noise reduction on each frame of the image data. The noise reduction method can be any of Gaussian filtering, median filtering, mean filtering, PM equation, or TV model. Taking Gaussian filtering as an example, a template (also called convolution or mask) is used to scan each pixel in each frame of the image. The weighted average grayscale value of the pixels in the neighborhood determined by the template is used to replace the value of the center pixel of the template.
[0073] S22. Use the Canny edge detection algorithm to identify edge regions with gradient differences in each frame of the denoised image. The specific steps are as follows:
[0074] The gradient magnitude and gradient direction of each pixel in each frame of the image data are calculated using the Sobel filter operator or the Prewitt operator;
[0075] Perform non-maximum suppression on the gradient amplitude of the pixel point according to the gradient direction;
[0076] Double threshold processing is performed on the gradient amplitude of the pixel points, and the edges are connected to obtain the edge area.
[0077] S23. Using a circle detection algorithm, identify regions with circular edge features in each frame of the image after edge detection, thereby obtaining the end cap contour. Circle detection algorithms include, but are not limited to, the Hough circle detection algorithm, the RCD algorithm, and the RHT algorithm. Taking the RHT algorithm as an example, several points are randomly selected, and circles are drawn based on the centers found at these points. Several iterations are then performed to find the optimal circle within a preset tolerance threshold.
[0078] S3. Use the Hough gradient to calculate the geometric center and geometric radius of the end cap contour. The specific steps are as follows: First, detect the center (geometric center) of the end cap contour. The center is the intersection of the circumference normals. Set a threshold. If the number of intersecting straight lines at a certain point exceeds this threshold, the intersection point is considered to be the center of the circle. Then, use the center of the circle to derive the circle radius (geometric radius). The distance from the center to the circumference is uniform. Set a threshold. As long as the number of uniform distances exceeds this threshold, the distance is considered to be the radius of the center of the circle.
[0079] S4. Establish a relative coordinate system as a blank scale on each frame of the image data. The relative coordinate system has the following characteristics:
[0080] (1) The geometric center of the end cap outline is taken as the origin;
[0081] (2) The horizontal direction is the X-axis and the vertical direction is the Y-axis;
[0082] (3) Determine the limits of each axis based on the geometric radius of the end cap. Different endoscopes use different geometric radii for their end caps. Therefore, the geometric radius of the end cap used in this step is determined based on the geometric radius of the end cap used in the actual endoscope. The limits of the X / Y axis also need to be adjusted based on the different geometric radius of the end cap.
[0083] S5. Mark the blank ruler to obtain the desired virtual ruler; the marking process is as follows:
[0084] S51. Perform preliminary scale division on the blank ruler to obtain scale lines. The spacing between scale lines can refer to the geometric radius of the end cap to make reasonable divisions.
[0085] S52. Mark a real reference ruler with scale markings on a blank paper surface to obtain a reference ruler paper surface. Selecting a blank paper surface not only allows the reference ruler to be highlighted, but also facilitates subsequent image processing. The reference ruler can be a cross-shaped ruler, which can be directly matched with the relative coordinate system. The scale markings of the reference ruler can also refer to the geometric radius of the end cap, or a conventional ruler scale can be used.
[0086] S53. Photograph the reference ruler paper surface through the endoscope, aligning the reference ruler origin with the blank ruler origin to obtain a test image. When photographing the reference ruler paper surface, it is important to emphasize that, in order to ensure that the acquired image matches the relative coordinate system, the photograph must be centered on the reference ruler origin to obtain the test image.
[0087] S54. Numerically mark the scale lines on the blank ruler according to the scale values of the reference ruler in the mapping image to obtain the desired virtual ruler. Numerically mark the scale lines on the blank ruler based on the distortion of the reference ruler in the test image. The numerical markings on the blank ruler account for barrel distortion, thereby obtaining a virtual ruler that accounts for errors and makes subsequent readings more accurate.
[0088] The method for marking the scale values of a blank ruler comprises the following steps:
[0089] S100. Extract the reference scale on the test image. The specific steps of extraction are as follows:
[0090] Perform Gaussian downsampling on the test image.
[0091] Perform a gradient calculation on each pixel of the downsampled test image to obtain the gradient magnitude and gradient direction of each pixel. Specifically, the gradient calculation can be performed on the four pixels to the right and below of each pixel in the test image. Using the smallest possible template, the calculation reduces inter-pixel dependencies during the gradient calculation process. Based on the grayscale value of the pixel's position in the image, the pixel gradient can be calculated, and the gradient direction and gradient magnitude can be obtained.
[0092] A gradient threshold is preset and the gradient amplitude of each pixel is compared with the preset gradient threshold. Pixels with gradient amplitudes greater than the gradient threshold are marked as associated pixels, while pixels with gradient amplitudes less than the gradient threshold are marked as isolated pixels. Some pixels have small gradient amplitudes, which may represent noise in the image. The gradient threshold is set to filter the gradient amplitudes of these pixels. If the gradient amplitude of a pixel is less than the set gradient threshold, the pixel will not be considered when constructing the line segment region.
[0093] The associated pixels are constructed into a line segment support domain, and are integrated according to the gradient direction of the associated pixels to obtain a line segment support domain direction.
[0094] Calculate the directional error between the gradient direction of isolated pixels around the line segment support region and the direction of the line segment support region.
[0095] If the directional error is less than a preset tolerance value, the directional error is then determined to be greater than the gradient threshold. The tolerance value represents the allowable error between the line segment support domain direction and the gradient direction of the pixel point. Errors less than this value are tolerated and considered to be error-free.
[0096] If it is greater than, the isolated pixel point corresponding to the direction error is changed to a related pixel point and included in the line segment support domain.
[0097] The line segment support region is updated, and the updated line segment support region rectangle is approximated to obtain an estimated rectangle. The purpose of the update is to obtain the line segment support region with the newly associated pixel points added.
[0098] Determine whether the pixel density of the estimated rectangle is greater than a preset density value. The calculation process for the estimated rectangle's pixel density is as follows: Count the number of associated pixels within the estimated rectangle to obtain the number of associated points m; determine whether the gradient amplitude of the associated pixels in the previous step is greater than a gradient threshold; mark the associated pixels that are greater than the gradient threshold and calculate the number of marked pixels n; calculate the ratio of the number of marked pixels n to the number of associated points m to obtain the pixel density.
[0099] If yes, the estimated rectangle is determined to be a line segment, and the interconnected line segments are retained to obtain the true ruler.
[0100] S200. Adjust the reference scale according to a preset ratio using the origin of the reference scale extracted in the previous step as a fixed point; and make the scale lines of the reference scale partially overlap with the scale area of the blank scale.
[0101] S300. Calculate the scale value of the overlapping area of the blank ruler according to the ratio.
[0102] S400. Repeat step S200 until all the graduations on the blank ruler are marked. When the blank ruler has digitally marked graduations, it constitutes a virtual ruler. Barrel distortion means that the relative size of the image gradually decreases from the center point of the image to the edge point of the image, which looks like a normal-sized picture wrapped in a ball. Fisheye cameras use this type of distortion to map an infinitely wide object plane into a limited image area to present a hemispherical effect. When using a zoom lens, barrel distortion will appear if the focal length is adjusted to the middle of the lens. In addition, the effect of barrel distortion is most obvious when using a wide-angle lens. Therefore, if a ruler is constructed directly, the data read from the ruler is inaccurate. Constructing a virtual ruler based on barrel distortion can reduce the problem of vertical inaccuracy of the ruler caused by barrel distortion.
[0103] The scale numerical marking method of this embodiment can accurately mark the scale lines of a blank ruler with low error rates. This embodiment is suitable for clinical medicine, primarily for use in morphological and positional measurement of lesions during gastrointestinal endoscopic exploration and treatment, such as measuring the length, width, and diameter of lesions or internal tissues such as blood vessels, polyps, and adenomas. It is suitable for both dynamic measurement of real-time video sequences and static measurement of images captured during exploration.
[0104] The virtual ruler construction method for video image measurement of this embodiment can be designed as an application software, such as a virtual ruler construction system for video image measurement, which can be loaded into the required electronic equipment to implement the corresponding virtual ruler construction method for video image measurement.
[0105] In this embodiment, the virtual ruler construction system for video image measurement includes a data acquisition module and an image processing module.
[0106] The data acquisition module is used to collect image data of the target area captured by the endoscope.
[0107] The image processing module is used to frame the image data and extract the corresponding end cap contour in each frame image; it is also used to calculate the geometric center and geometric radius of the end cap contour using the Hough gradient; it is also used to establish a relative coordinate system as a blank ruler on each frame image in the image data; it is also used to mark the blank ruler with scale to obtain the required virtual ruler.
[0108] When executed, the system for constructing a virtual ruler for video image measurement implements the steps of the above-mentioned method for constructing a virtual ruler for video image measurement. Therefore, the system for constructing a virtual ruler for video image measurement will not be described in detail.
[0109] When the device application system is used, the above system can be realized through the cooperation of a video card and a controller. Image data is collected through the video card, and the above software is loaded through the controller for image processing, thereby realizing the construction of a virtual ruler.
[0110] like Figure 2 As shown, based on the aforementioned method for constructing a virtual ruler for video image measurement, this embodiment further provides a method for measuring video images, which includes the following steps: placing the end cap of the endoscope close to the surface of the object to be measured and photographing the object to be measured; directly reading the length, width or diameter of the object to be measured based on the image photographed by the endoscope; and constructing a virtual ruler for the end cap before the end cap of the endoscope is close to the surface of the object to be measured. The method for constructing the virtual ruler adopts the aforementioned method for constructing a virtual ruler for video image measurement, and therefore, it will not be introduced in detail.
[0111] By constructing a virtual ruler directly on the image taken by the endoscope, users can read the readings directly without having to measure by visual inspection or with the help of an instrument ruler, which improves the measurement efficiency or accuracy to a certain extent.
[0112] The application software can be applied to various terminals such as a computer terminal, which includes a memory, a processor, and a computer program stored in the memory and run on the processor. When the processor executes the program, the steps of the aforementioned method for constructing a virtual ruler for video image measurement are implemented.
[0113] Example 2
[0114] This embodiment provides a method for constructing a virtual ruler for video image measurement. This method is similar to the construction method in Example 1, except that this embodiment directly uses a reference ruler with a scale line whose graduation is much smaller than the scale lines of the blank ruler. For example, the number of scale lines of the reference ruler at the same range is 200, and the number of scale lines of the blank ruler at the same range is 20. Therefore, in the step of numerically marking the scale lines of the blank ruler according to the scale values of the reference ruler in the test image to obtain the desired virtual ruler, the scale lines of the blank ruler can be numerically marked directly according to the overlapping scale line area.
[0115] The method of this embodiment can quickly mark the scale lines in a blank ruler with numerical values, without the need to adopt the method for marking the scale numerical values of a blank ruler in Example 1, and can reduce the number of calculation steps.
[0116] 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.
[0117] The above-described embodiments merely illustrate several implementations of the present invention, and while their 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 numerous variations 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 method for constructing a virtual ruler for video image measurement, which is used to construct a virtual ruler on an image of the internal area of an end cap captured by an endoscope, characterized in that: The virtual ruler construction method comprises the following steps: S1. Acquire image data of the target area captured by the endoscope; S2. The image data is frame-processed to extract the corresponding end cap contour in each frame image. The process of extracting the end cap contour is as follows: S21 performs noise reduction processing on each frame of the image data; S22. Identify edge regions with gradient differences in each frame of the denoised image using the Canny edge detection algorithm; S23. Identify regions with circular edge features in each frame image after edge detection using a circle detection algorithm, and then obtain the end cap contour; S3. Calculating the geometric center and geometric radius of the end cap profile using Hough gradient; S4. Establish a relative coordinate system as a blank ruler on each frame of the image data, wherein the relative coordinate system has the following characteristics: (1) The geometric center of the end cap profile is taken as the origin; (2) The horizontal direction is the X-axis and the vertical direction is the Y-axis; (3) Determine the limits of each axis based on the geometric radius of the end cap; S5. Mark the blank ruler to obtain the desired virtual ruler; the marking process of the scale mark is as follows: S51. Perform preliminary scale division on the blank ruler to obtain scale lines; S52. Mark a real reference ruler with scale marks on a blank paper to obtain a reference ruler paper; S53. The reference ruler paper is photographed through the endoscope, and the origin of the reference ruler coincides with the origin of the blank ruler to obtain a test image; S54. Numerically mark the scale lines in the blank ruler according to the scale values of the reference ruler in the test image to obtain the desired virtual ruler.
2. The method for constructing a virtual ruler for video image measurement according to claim 1, characterized in that: The noise reduction processing method includes any one of Gaussian filtering, median filtering, mean filtering, PM equation or TV model.
3. The method for constructing a virtual ruler for video image measurement according to claim 1, characterized in that: The edge area recognition method comprises the following steps: Calculating the gradient magnitude and gradient direction of each pixel in each frame of the image data; Performing non-maximum suppression on the gradient amplitude of the pixel point according to the gradient direction; Double threshold processing is performed on the gradient amplitude of the pixel points, and the edges are connected to obtain the edge area.
4. The method for constructing a virtual ruler for video image measurement according to claim 3, characterized in that: The method for calculating the gradient intensity and gradient direction of the pixel point includes a Sobel filter operator or a Prewitt operator.
5. The method for constructing a virtual ruler for video image measurement according to claim 4, characterized in that: The scale value marking method of the blank ruler comprises the following steps: S100. Extracting a reference scale on the test image; S200. The origin of the reference scale extracted in the previous step is adjusted according to a preset ratio; and the scale lines of the reference scale partially overlap with the scale lines of the blank scale; S300. Calculate the scale value of the blank scale that coincides with the scale line according to the ratio; S400. Repeat step S200 until all the scales on the blank ruler are marked.
6. The method for constructing a virtual ruler for video image measurement according to claim 5, characterized in that: The method for extracting the real scale comprises the following steps: Performing Gaussian downsampling on the test image; Perform gradient calculation on each pixel of the downsampled test image to obtain the gradient magnitude and gradient direction of each pixel; Preset a gradient threshold, compare the gradient amplitude of each pixel with the preset gradient threshold, mark the pixels with gradient amplitude greater than the gradient threshold as associated pixels, and mark the pixels with gradient amplitude less than the gradient threshold as isolated pixels; Constructing the associated pixel points into a line segment support domain, and integrating them according to the gradient direction of the associated pixel points to obtain a line segment support domain direction; Calculating a direction error between a gradient direction of isolated pixel points around the line segment support region and a direction of the line segment support region; If the direction error is less than a preset tolerance error value, determining whether the direction error is greater than a gradient threshold; If it is greater than, the isolated pixel point corresponding to the direction error is changed to a related pixel point and included in the line segment support domain; The line segment support domain is updated, and a rectangle of the updated line segment support domain is approximately calculated to obtain an estimated rectangle; Determining whether the pixel density of the estimated rectangle is greater than a preset density value; If yes, the estimated rectangle is determined to be a line segment, and the interconnected line segments are retained to obtain the true scale.
7. The method for constructing a virtual ruler for video image measurement according to claim 6, characterized in that: The pixel density calculation method comprises the following steps: Counting the number of associated pixel points within the estimated rectangle to obtain the number of associated points m; Determine whether the gradient amplitude of the pixel associated with the previous step is greater than the gradient threshold; Mark the associated pixel points whose gradient is greater than the threshold, and perform statistics to obtain the number of marks n; The pixel density is obtained by calculating the ratio of the number of markers n to the number of associated points m.
8. A virtual ruler construction system for video image measurement, which is used to build a virtual ruler on the image of the internal area of the end cap collected by an endoscope, characterized in that: The method for constructing a virtual ruler for video image measurement according to any one of claims 1 to 7 is applied, and the virtual ruler construction system for video image measurement comprises: A data acquisition module, which is used to collect image data of the target area captured by the endoscope; An image processing module is used to perform frame processing on the image data and extract the corresponding end cap contour in each frame image; is also used to calculate the geometric center and geometric radius of the end cap contour using the Hough gradient; is also used to establish a relative coordinate system as a blank ruler on each frame image in the image data; and is also used to mark the blank ruler with scale to obtain the required virtual ruler.
9. A video image measurement method, characterized in that: The measuring method comprises the following steps: Place the end cap of the endoscope close to the surface of the object to be measured and take a picture of the object to be measured; directly reading the length, width or diameter of the object to be measured based on the image captured by the endoscope; It is characterized by: Before the end cap of the endoscope is brought close to the surface of the object to be measured, a virtual ruler is constructed for the end cap, and the method for constructing the virtual ruler adopts the method for constructing a virtual ruler for video image measurement as described in any one of claims 1 to 7.
10. A computer terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method for constructing a virtual ruler for video image measurement according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Object size measurement method based on depth image processing
CN109472822A
Focus three-dimensional size measurement and display method based on binocular endoscope
CN112184653A