Video image distance measurement method based on feature target
By using feature targets and industrial cameras in video ranging, detecting and identifying feature points edge data and performing feature matching, the problems of complex video ranging operations and unstable measurement results are solved, and high-precision and stable distance measurement are achieved.
Patent Information
- Application Number
- CN202411682039.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
AI Technical Summary
Video ranging operation is complicated, the measurement results are low accuracy and unstable.
Using a video image distance measurement method based on feature targets, the image is collected by setting feature targets and industrial cameras, the edge data of feature points is detected and identified, and the angle and distance between the feature target and the camera lens is calculated.
The video ranging operation is simplified, the accuracy and stability of measurement results are improved, and the dependence on image detail characteristics is reduced.
Smart Images

Figure CN119618070A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of image processing, and in particular relates to a video image distance measurement method based on feature targets. Background Art
[0002] Video image distance measurement is a method of measuring the distance between objects through video images. It uses a video camera to capture images, and then uses digital photogrammetry to determine the position, shape and size of the object. It has good application prospects in geological survey and measurement, intelligent transportation, security monitoring, automatic driving and other fields, but it still faces a series of technical difficulties and defects. When using the video image distance measurement method, it is necessary to first obtain high-resolution high-definition video images and use as many image detail features as possible to achieve accurate distance measurement. The operation is complicated and the corresponding investment cost is high; secondly, high-precision distance measurement requires complex image processing algorithms or machine learning models to complete, and the computer's computing power is required to be high; in addition, to achieve accurate recognition of the target body, machine learning and sample training are required, and the recognition of natural feature bodies is prone to large misjudgments, which ultimately affects the accuracy of the measurement results and also causes unstable measurement results. To solve this problem, a video image distance measurement method based on feature targets is needed. Summary of the invention
[0003] The technical problem solved by the present invention is to provide a video image distance measurement method based on feature targets, which solves the problems of complex video ranging operation, low measurement result accuracy and unstable measurement result.
[0004] The basic solution provided by the present invention is a method for measuring the distance of a video image based on a feature target, comprising:
[0005] S1: Setting a characteristic target at the test site, and setting a characteristic pattern on the characteristic target, wherein the characteristic pattern includes at least two characteristic points that are cocircular, and the distances between adjacent characteristic points are equal;
[0006] S2: collect images through industrial cameras, perform grayscale processing on the images, and obtain the grayscale value change rate of the collected images;
[0007] S3: Processing the gray value change rate of the image through a filter to obtain edge detection data of feature points in the image;
[0008] S4: Detect and identify the edge detection data of the feature points to obtain the detection parameters of each feature point;
[0009] S5: performing feature matching on the actual feature parameters of each feature point and the detection parameters of each feature point to determine the optimal center position of each feature point;
[0010] S6: Taking the optimal center position of each feature point as the coordinate data of each feature point, combining it with the actual diagonal length of the feature point in the feature graph, fitting again, and calculating the center point of the common circle of each feature point;
[0011] S7: Obtaining the angle between the feature target and the camera lens plane according to the actual value and calculated value of the diagonal length of each feature point and the angle between adjacent feature points;
[0012] S8: Calculate the distance between the center point of the common circle of each feature point in the image and the center point of the image using the calculated value of the center point of the common circle of each feature point, obtain the focal length of the lens of the industrial camera, and combine the radius of the common circle of the feature points on the feature target and the radius of the common circle of each feature point in the image to obtain the distance between the industrial camera and the center point of the feature target.
[0013] Preferably, in step S8, the distance between the industrial camera and the center point of the characteristic target is calculated by the following formula:
[0014]
[0015] Where L is the distance between the industrial camera and the center point of the feature target, R is the radius of the common circle of the feature points on the feature target, r is the radius of the common circle of each feature point in the image, f is the focal length of the industrial camera lens, and h is the distance between the center point of the common circle of the feature points in the image and the center point of the image.
[0016] Preferably, in step S1, the number of feature points on the feature target is six, and the six feature points form a regular hexagonal feature pattern, and the diameter of the feature points is 1 / 3 to 2 / 3 of the length of the side of the regular hexagon.
[0017] Preferably, in step S2, the method for grayscale processing of the image comprises the following steps:
[0018] S2-1) using a linear enhancement method to enhance the image contrast and obtain the grayscale of the image after linear enhancement;
[0019] S2-2) Calculate the rate of change of pixel grayscale value through differential operation.
[0020] Further preferably, in step S2-1), the grayscale of the image after linear enhancement is calculated using the following formula:
[0021]
[0022] Where I is the gray level of the original image, O is the gray level of the image after linear enhancement, and O max is the upper limit of image grayscale, O min is the lower limit of image grayscale, I max is the upper limit of the image grayscale level, vmin is the lower limit of the image grayscale level.
[0023] Preferably, in step S4, a convolutional neural network deep learning model is used to extract the edge detection data in S3, and the edge points are fitted using a least squares fitting algorithm to obtain detection parameters of each feature point.
[0024] Preferably, in step S5, the actual characteristic parameters of each characteristic point include the radius of a common circle of each characteristic point, the length of a diagonal line of each characteristic point, the distance between adjacent characteristic points, and the angle between adjacent characteristic points.
[0025] Preferably, in step S3, a filter is used to sequentially perform gradient identification, non-maximum suppression, and double threshold processing on the gray value change rate.
[0026] Preferably, in step S1, the shape of the feature point is a perfect circle.
[0027] The principle and advantage of the present invention are: by setting a characteristic target with a characteristic pattern, and obtaining a scene image through an industrial camera, detecting and identifying the edge data of the characteristic point and performing edge fitting to obtain the detection parameters, and then performing feature matching through the detection parameters and the actual values, determining the optimal center position of the characteristic point, and using the optimal center position of the characteristic point to calculate the center point of the characteristic pattern, and finally calculating the angle and distance between the characteristic target and the industrial camera lens. By setting the characteristic target, it is possible to quickly measure the distance through the video, without obtaining too many image detail features to determine the distance measurement, and it is simple to use and has high measurement accuracy.
[0028] Preferably, grayscale processing and linear enhancement of the image are performed through a filter, which can remove interference and make edge detection data more accurate.
[0029] Preferably, a neural network is used to extract edge detection data, and valuable information is extracted from a large number of diverse data sources. The edge data is highly accurate, more reliable, and the measurement results are relatively stable; and the edge points are fitted using the least squares method to ensure that the edge fitting of the feature points is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a flow chart of the present invention;
[0031] Figure 2 It is a schematic diagram of the target of the present invention;
[0032] Figure 3 This is a calculation principle diagram of the present invention. DETAILED DESCRIPTION
[0033] The following is further described in detail through specific implementation methods:
[0034] The specific implementation process is as follows: Figures 1 to 3 , a video image distance measurement method based on feature targets, comprising:
[0035] S1: Set a characteristic target at the test site, set a characteristic pattern on the characteristic target, the characteristic pattern includes at least two characteristic points in a circle, and the distance between adjacent characteristic points is equal; the shape of the characteristic point is a perfect circle; the number of characteristic points on the characteristic target in step S1 is six, and the six characteristic points form a regular hexagonal characteristic pattern, and the diameter of the characteristic point is 1 / 3 to 2 / 3 of the length of the side of the regular hexagon. In this embodiment, the diameter of the characteristic point is 1 / 2 of the length of the side of the regular hexagon; in other embodiments of the present application, the number of characteristic points can also be 4 or 8. By setting six characteristic points, the calculation complexity can be reduced while improving the accuracy of the measurement.
[0036] like Figure 2 The figure shows a physical schematic diagram of a characteristic target, which includes a sign panel and a vertical pole. The sign panel is a hard square panel, and non-reflective waterproof paper is tightly attached to the panel. Each characteristic point forms a characteristic pattern printed on the non-reflective waterproof paper.
[0037] When in use, first fix the industrial camera at the measuring position, and the measurement personnel place the feature target at the measured point, with the feature pattern facing the direction of the camera, and the angle between the feature target plane and the industrial camera lens plane is no more than 70 degrees.
[0038] S2: The image is collected by an industrial camera, and grayscale processing is performed on the image to obtain the grayscale value change rate of the collected image; through grayscale processing, the image is converted into black and white pixels, which can improve the efficiency of numerical calculation.
[0039] In step S2, the method for grayscale processing of the image includes the following steps:
[0040] S2-1) using a linear enhancement method to enhance the image contrast and obtain the grayscale of the image after linear enhancement;
[0041] In step S2-1), the gray level of the image after linear enhancement is calculated using the following formula:
[0042]
[0043] Where I is the gray level of the original image, O is the gray level of the image after linear enhancement, and O max is the upper limit of image grayscale, O min is the lower limit of image grayscale, I max is the upper limit of the image grayscale level, I min is the lower limit of the image grayscale level.
[0044] S2-2) Calculate the rate of change of pixel grayscale value through differential operation.
[0045] The differential calculation formula in the X direction is:
[0046] ΔI x (x, y) = I (x + 1, y) - I (x, y)
[0047] In the formula, ΔI x is the grayscale difference value in the horizontal x direction, I is the difference function, x is the x coordinate of the pixel point, and y is the y coordinate of the pixel point;
[0048] The differential calculation formula in the Y direction is:
[0049] ΔI y (x, y) = I (x, y + 1) - I (x, y)
[0050] In the formula, I y is the grayscale difference value in the horizontal y direction, I is the difference function, x is the x coordinate of the pixel point, and y is the y coordinate of the pixel point.
[0051] S3: Processing the gray value change rate of the image through a Gaussian filter to obtain edge detection data of feature points in the image;
[0052] In step S3, a Gaussian filter is used to perform gradient recognition, non-maximum suppression, and double threshold processing on the gray value change rate in turn, so that the edges of the feature points are clearer and easier to identify.
[0053] S4: Detect and identify the edge detection data of the feature points to obtain detection parameters of each feature point; the detection parameters include the center of each feature point and the center point of the feature figure formed by the feature points;
[0054] In step S4, CNN convolutional neural network is used to extract features from the edge detection data in S3, and least squares or BP neural network is used to infer and predict the features to obtain parameters such as the center of the circle. The CNN part can use the existing classic CNN architecture and model such as LENET, or it can use the existing network integrating CNN and BP such as YOLO model to identify and output detection parameters. By extracting edge data through the neural network model, the recognition of the target body is more accurate, misjudgment is reduced, the edge data is more accurate, more reliable, and the measurement results are more stable.
[0055] In step S4, based on the center of each feature point and the center point of the feature pattern, the detection parameters of each feature point also include the radius of the common circle of the feature points in the image, the diagonal length of each feature point in the feature pattern, the distance between adjacent feature points, and the angle between adjacent feature points.
[0056] S5: feature matching is performed on the actual feature parameters of each feature point and the detection parameters of each feature point to determine the optimal center position of each feature point; the actual feature parameters of each feature point include the radius of the common circle of each feature point, the length of the diagonal of each feature point, the distance between adjacent feature points, and the angle between adjacent feature points.
[0057] S6: taking the optimal center position of each feature point as the coordinate data of each feature point, combining the actual diagonal length of the feature point in the feature graph, fitting again, and calculating the center point of the further optimized feature graph, that is, the center point of the common circle of each feature point;
[0058] S7: Obtaining the angle between the feature target and the camera lens plane according to the actual value and calculated value of the diagonal length of each feature point and the angle between adjacent feature points;
[0059] S8: Calculate the distance between the center point of the common circle of each feature point in the image and the center point of the image using the calculated value of the center point of the common circle of each feature point, obtain the focal length of the lens of the industrial camera, and combine the radius of the common circle of the feature points on the feature target and the radius of the common circle of each feature point in the image to obtain the distance between the industrial camera and the center point of the feature target.
[0060] In step S8, see Figure 3 , the distance between the industrial camera and the center point of the characteristic target is calculated by the following formula:
[0061]
[0062] Where L is the distance between the industrial camera and the center point of the feature target, R is the radius of the common circle of the feature points on the feature target, r is the radius of the common circle of each feature point in the image, f is the focal length of the camera lens, and h is the distance between the center point of the common circle of the feature points in the image and the center point of the image.
[0063] Take the slope geological disaster investigation site as an example:
[0064] S1: Surveyor 1 holds the characteristic target to the point to be measured on the slope, and surveyor 2 fixes the industrial camera at a distant reference point for measurement. The industrial camera is installed horizontally and connected to the computer. Surveyor 1 places the target at a suitable position along the slope direction according to the orientation of the industrial camera and the on-site conditions;
[0065] S2: Collect the slope image through the industrial camera, perform grayscale processing, and obtain the grayscale level and grayscale value change rate of the image;
[0066] S3: extract edge detection data of each feature point in the image;
[0067] S4: Detect and identify the extracted data to complete fitting optimization, determine the center of each feature point on the feature target, the center point of the common circle, and the radius, diagonal length, distance between adjacent feature points, and angle between adjacent feature points of the common circle of the feature points in the image;
[0068] S5: matching the actual radius of the common circle of the six feature points on the feature target, the diagonal length of each feature point, the distance between adjacent feature points, and the angle between adjacent feature points with the determined data obtained in S4, so as to further obtain the optimal center position of the six feature points;
[0069] S6: Taking the optimal center positions of the six feature points in S5 as coordinate data and combining them with the actual diagonal length, the center points of the optimized six feature points are obtained;
[0070] S7: Calculate the angle between the feature target and the lens plane of the industrial camera;
[0071] S8: Calculate the distance between the industrial camera and the center point of the feature target.
[0072] Record the data of the measuring point and repeat the above steps to measure the next point.
[0073] The above are only embodiments of the present invention. Common knowledge such as the known specific structures and characteristics in the scheme is not described in detail here. Ordinary technicians in the relevant field know all the common technical knowledge in the technical field to which the invention belongs before the application date or priority date, can obtain all the existing technologies in the field, and have the ability to apply conventional experimental means before that date. Ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the scope of protection of the present invention, and these will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.
Claims
1. A method for measuring distance of video images based on feature targets, characterized in that: include: S1: Setting a characteristic target at the test site, and setting a characteristic pattern on the characteristic target, wherein the characteristic pattern includes at least two characteristic points that are cocircular, and the distances between adjacent characteristic points are equal; S2: collect images through industrial cameras, perform grayscale processing on the images, and obtain the grayscale value change rate of the collected images; S3: Processing the gray value change rate of the image through a filter to obtain edge detection data of feature points in the image; S4: Detect and identify the edge detection data of the feature points to obtain the detection parameters of each feature point; S5: performing feature matching on the actual feature parameters of each feature point and the detection parameters of each feature point to determine the optimal center position of each feature point; S6: Taking the optimal center position of each feature point as the coordinate data of each feature point, combining it with the actual diagonal length of the feature point in the feature graph, fitting again, and calculating the center point of the common circle of each feature point; S7: Obtaining the angle between the feature target and the camera lens plane according to the actual value and calculated value of the diagonal length of each feature point and the angle between adjacent feature points; S8: Calculate the distance between the center point of the common circle of each feature point in the image and the center point of the image using the calculated value of the center point of the common circle of each feature point, obtain the focal length of the lens of the industrial camera, and combine the radius of the common circle of the feature points on the feature target and the radius of the common circle of each feature point in the image to obtain the distance between the industrial camera and the center point of the feature target.
2. The method for measuring distance of a video image based on a characteristic target according to claim 1, characterized in that: In step S8, the distance between the industrial camera and the center point of the characteristic target is calculated by the following formula: Where L is the distance between the industrial camera and the center point of the feature target, R is the radius of the common circle of the feature points on the feature target, r is the radius of the common circle of each feature point in the image, f is the focal length of the industrial camera lens, and h is the distance between the center point of the common circle of the feature points in the image and the center point of the image.
3. The method for measuring distance of a video image based on a feature target according to claim 1, characterized in that: In step S1, the number of feature points on the feature target is six, and the six feature points form a regular hexagonal feature pattern, and the diameter of the feature points is 1 / 3 to 2 / 3 of the length of the side of the regular hexagon.
4. The method for measuring distance of a video image based on a characteristic target according to claim 1, characterized in that: In step S2, the method for grayscale processing of the image includes the following steps: S2-1) using a linear enhancement method to enhance the image contrast and obtain the grayscale of the image after linear enhancement; S2-2) Calculate the rate of change of pixel grayscale value through differential operation.
5. The method for measuring distance of a video image based on a characteristic target according to claim 4 is characterized in that: In step S2-1), the gray level of the image after linear enhancement is calculated using the following formula: Where I is the gray level of the original image, O is the gray level of the image after linear enhancement, and O max is the upper limit of image grayscale, O min is the lower limit of image grayscale, I max is the upper limit of the image grayscale level, I min is the lower limit of the image grayscale level.
6. The method for measuring distance of a video image based on a characteristic target according to claim 1, characterized in that: In step S4, a convolutional neural network deep learning model is used to extract the edge detection data in S3, and the edge points are fitted using a least squares fitting algorithm to obtain the detection parameters of each feature point.
7. The method for measuring distance of a video image based on a characteristic target according to claim 1, characterized in that: In step S5, the actual characteristic parameters of each characteristic point include the radius of the common circle of each characteristic point, the length of the diagonal line of each characteristic point, the distance between adjacent characteristic points, and the angle between adjacent characteristic points.
8. The method for measuring distance of a video image based on a characteristic target according to claim 1, characterized in that: In step S3, a filter is used to perform gradient identification, non-maximum suppression, and double threshold processing on the gray value change rate in sequence.
9. The method for measuring distance of a video image based on a characteristic target according to claim 1, characterized in that: In step S1, the shape of the feature point is a perfect circle.
Citation Information
Cited By
Multi-circle target parallel real-time detection and tracking method and system
CN120516684A