Method of converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background plate

By using a method based on perspective transformation and fishing rod measurement of the background plate, combined with affine transformation technology, the camera calibration complexity and applicable scene limitations in traditional pixel-to-world coordinate conversion are solved, achieving higher accuracy and robustness. flexibility, suitable for complex scenes and non-standard camera settings, reducing hardware costs.

CN118274709BActive Publication Date: 2024-08-23HARBIN INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410359726.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2024-08-23
Estimated Expiration
2044-03-27

AI Technical Summary

Technical Problem

The traditional pixel-to-world coordinate conversion method suffers from camera calibration complexity, applicable scene limitations, and the black-box nature of the deep learning model, resulting in inaccurate conversion and high cost.

Method used

Using a method based on perspective transformation and fishing rod measurement of the background plate, world coordinates are obtained by identifying background points, and combined with affine transformation technology, the pixel coordinates are converted into world coordinates, which simplifies the conversion process and improves accuracy.

Benefits of technology

It achieves higher accuracy and robustness, reduces hardware costs, is suitable for complex scenes and non-standard camera settings, and provides more precise position information and distance measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118274709B
    Figure CN118274709B
Patent Text Reader

Abstract

The present invention discloses a method for converting pixel coordinates to world coordinates based on perspective transformation and a fishing rod measurement background plate, and the method is as follows: first, two circular markers with different radius sizes are pasted on a back plate, and the world coordinates of all other small circular markers are determined by the position of the large circular marker, so as to realize the positioning of the coordinates on the background plate; second, by identifying all circular markers on the fishing rod measurement background plate, the pixel coordinates of the large circular markers are judged according to the area of ​​the circular markers, so as to determine the pixel coordinates of the remaining small circular markers; after sorting the small circular markers, the relative positions are compared with the fishing rod measurement background plate to determine the relative positions, and the relative positions are corresponding to the world coordinates; third, by finding the six circular points on the background plate near the conversion point, and calculating the perspective transformation matrix according to the coordinates of these points and the sorting of the feature points; according to the perspective transformation matrix, the input pixel coordinates are converted into the real object coordinates. The present invention can provide more accurate position information and distance measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer vision and image processing, and relates to a method for converting pixel coordinates into world coordinates, and specifically relates to a method for converting pixel coordinates into world coordinates based on perspective transformation and a novel fishing rod measurement background plate. Background Art

[0002] In traditional computer vision and image processing, the conversion between pixel coordinates and world coordinates has always been an important problem. In many applications, such as virtual reality, augmented reality, measurement, and positioning, it is necessary to accurately map the pixels in the image to the coordinates in the real world. However, due to factors such as perspective projection, camera distortion, and scene complexity, the accurate conversion of pixel coordinates to world coordinates has always been a challenging problem.

[0003] Traditional pixel-to-world coordinate conversion methods are usually based on camera calibration and geometric transformation techniques. Camera calibration refers to determining the intrinsic and extrinsic parameters of the camera, including the focal length, principal point, distortion parameters, and the position and orientation of the camera in the world coordinate system. Through camera calibration, a mapping relationship between pixel coordinates and camera coordinates can be established. Then, the camera coordinates are converted to world coordinates through geometric transformation techniques such as perspective transformation, affine transformation, or triangulation.

[0004] However, traditional methods have some limitations. First, camera calibration requires accurate estimation of camera parameters, including focal length, distortion, etc., which can be complex and difficult for general users. Second, traditional methods are usually only applicable to specific scenes and camera settings, and may not provide accurate conversion results for complex scenes and non-standard camera settings. In addition, factors such as perspective projection and distortion can introduce errors, resulting in inaccurate conversion.

[0005] In recent years, with the rapid development of computer vision and deep learning technology, some new methods have been proposed to solve the problem of pixel-to-world coordinate conversion. For example, deep learning-based methods use convolutional neural networks (CNNs) to perform semantic segmentation or depth estimation on images, thereby obtaining the semantic category or depth information of pixels and then inferring world coordinates. These methods can improve the accuracy and robustness of conversion to a certain extent by learning a large amount of image data and annotation information.

[0006] However, these new methods also have some challenges. First, they usually require a lot of training data and computing resources in order to train and optimize deep learning models. Second, these methods may still have limitations for complex scenes and problems such as occlusion. In addition, due to the black-box nature of deep learning models, their interpretability and explainability is also an issue that needs to be considered.

[0007] CN108122254B discloses a three-dimensional image reconstruction method, device and storage medium based on structured light. The three-dimensional image reconstruction method uses structured light projection to obtain depth information in the scene and combines camera parameters for coordinate conversion. It has the following limitations: (1) It requires the use of additional structured light projectors and depth sensor devices, which increases the hardware cost and complexity of the system. This may not be practical for general users and certain application scenarios because it requires the purchase and installation of additional equipment. (2) Calibration and alignment for specific scenes remains a challenge. Before use, precise calibration and alignment steps are required to ensure the accurate correspondence between the depth sensor and the camera. This requires users to have certain professional knowledge and skills, and increases the cost and complexity of use. Summary of the invention

[0008] The purpose of the present invention is to provide a method for converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background board. The method identifies background points on the board and obtains their world coordinates, finds the coordinates of the six nearest background boards of other points, and combines affine transformation technology to convert the pixel coordinates of other points into world coordinates. The present invention has higher accuracy and robustness, and can provide more accurate position information and distance measurement.

[0009] The objective of the present invention is achieved through the following technical solutions:

[0010] A method for converting pixel coordinates to world coordinates based on perspective transformation and a fishing rod measurement background plate comprises the following steps:

[0011] Step 1: Design of fishing rod measurement background board:

[0012] Paste two circular markers with different radius sizes on the standard background plate, and determine the world coordinates of all other small circular markers through the position of the large circular marker, so as to realize the positioning of the coordinates on the background plate of the fishing rod measurement;

[0013] Step 2: Background point identification:

[0014] By identifying all the circular marking points on the fishing rod measurement background plate, the pixel coordinates of the large circular marking points are determined according to the areas of the circular marking points, thereby determining the pixel coordinates of the remaining small circular marking points; after sorting the small circular marking points, they are compared with the fishing rod measurement background plate to determine their relative positions, and correspond to the world coordinates;

[0015] Step 3: Convert pixel coordinates to world coordinates:

[0016] The dots on the background plate are measured by finding six fishing rods near the transformation point, and the perspective transformation matrix is ​​calculated based on the coordinates of these points and the order of the feature points; the input pixel coordinates are converted into real object coordinates according to the perspective transformation matrix.

[0017] Compared with the prior art, the present invention has the following advantages:

[0018] 1. The present invention proposes a method for converting pixel coordinates into real coordinates, which simplifies the conversion process through a pre-designed background plate, is easy to apply, and has a good conversion effect.

[0019] 2. The present invention designs a new background plate, which can improve conversion efficiency, improve conversion accuracy, and effectively reduce costs.

[0020] 3. This invention provides a new solution by combining recognition, background point world coordinate acquisition and affine transformation technologies, which can realize accurate pixel coordinate to world coordinate conversion in applications such as billboard advertising. With the continuous development and improvement of technology, the pixel coordinate to world coordinate conversion method will become more and more accurate and reliable, bringing more possibilities and application scenarios to various fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a flow chart of the method of converting pixel coordinates to world coordinates based on perspective transformation and the background plate of the fishing rod measurement;

[0022] Figure 2 This is a schematic diagram of a standard background plate;

[0023] Figure 3 Measure the background board design for the fishing rod;

[0024] Figure 4 For the background board photo;

[0025] Figure 5 This is a schematic diagram of feature point positioning;

[0026] Figure 6 is the identified background dot;

[0027] Figure 7 The background dots are sorted;

[0028] Figure 8 This is the real coordinate effect diagram. DETAILED DESCRIPTION

[0029] The technical solution of the present invention is further described below in conjunction with the accompanying drawings, but is not limited thereto. Any modification or equivalent replacement of the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention should be included in the protection scope of the present invention.

[0030] The present invention provides a method for converting pixel coordinates to world coordinates based on perspective transformation and a fishing rod measurement background plate. Figure 1 As shown, the method comprises the following steps:

[0031] Step 1: Background board design:

[0032] In the existing measurement scenario, the standard background plate is a grid with fixed intervals. There is no marker on the standard background plate. The traditional manual measurement estimates the length of the fishing rod by reading the horizontal and vertical coordinates. Figure 2 As shown in the figure, the design is carried out on the basis of the standard background plate to obtain the fishing rod measurement background plate. The specific design method is as follows: paste two circular marking points with different radii at specific coordinates on the standard background plate, where the radius of the large circular marking point is 5cm, and the radius of the small circular marking point is 2.5cm. The small circular marking points are pasted at intervals of 20cm, and the large circular marking points are pasted on the edges of the standard background plate. The structure is as shown in the figure. Figure 3 As shown. In order to identify the real coordinates on the grid of the fishing rod measurement background plate at a long distance, the present invention adopts the size and arrangement of the identification and analysis mark points to achieve this. The size of the mark point is the minimum value that can be normally identified at a distance that can cover the normal fishing rod measurement background plate, and it does not interfere with possible manual identification as much as possible. The mark point size provided by the present invention can be applicable to the identification of the fishing rod measurement background plate when the camera is 1 meter to 8 meters away from the fishing rod measurement background plate, and is suitable for most fishing rod tonality analysis scenes. If there is a longer distance, the radius of the mark point needs to be increased depending on the situation. The present invention determines the world coordinates of all other small circle mark points through the position of the large circle mark point, realizes the positioning of the coordinates on the fishing rod measurement background plate, and enables the computer to determine the world coordinates of a certain point. The present invention only needs to know the world coordinates of the large circle mark point, and can infer the remaining coordinates of the remaining small circle mark points based on the world coordinates of the large circle mark point, which solves the problems of high hardware cost and complexity. The specific design is as follows Figure 4 shown.

[0033] Step 2: Background point identification:

[0034] By identifying all the dots on the background plate, the pixel coordinates of the large circle mark points are determined according to the area of ​​the mark points, thereby determining the pixel coordinates of the remaining small circle mark points; after sorting the small circle mark points, they are compared with the background plate to determine their relative positions and correspond to the world coordinates. The specific steps are as follows:

[0035] Step 21: Use spot detection to identify the circular mark points on the background plate of the fishing rod measurement:

[0036] Step 2: grayscale the input image to convert the color image into a grayscale image.

[0037] Step 2-2: Set the threshold range of spot detection, the minimum and maximum areas of spots, the minimum value of roundness, and the concave-convex parameters of the circle, so as to detect according to the characteristics of the circular marker points;

[0038] Step 2-3: Create a blob detector: Based on the preset parameters, implement a custom blob detector through the SimpleBlobDetectorblob method in the OpenCV library;

[0039] Step 214: Use a custom blob detector to perform blob detection in the image, find circular marker points that meet the conditions according to the set parameters, and save the pixel coordinates and area of ​​the circular marker points.

[0040] Step 22. Sort the points according to the area and the Euclidean distance between each pair of circular markers to determine the positions of all large circle markers. For the convenience of calculation, we set a unit length as 10 cm, which corresponds to the length of one grid on the background board measured by the fishing rod, and record it as the scaling factor λ, λ=10.

[0041] Step 2: Calculate the perspective transformation parameters based on the actual coordinates of the great circle marker points and the corresponding pixel coordinates, and use the least squares method to calculate the perspective transformation parameter matrix A based on the results. According to the perspective transformation parameters, the actual coordinates of the feature points are matched with the sorted coordinates.

[0042] Step 24: According to a priori knowledge, the coordinates of the center of the circle where the feature point is located are integer multiples of the minimum scale of the fishing rod measurement background plate, such as (20, 20) (40, 40). The affine matrix of the entire fishing rod measurement background plate space is calculated through the position of the large circle marker point.

[0043] Step 25: Represent two-dimensional affine transformation through matrix operation: Suppose there is a two-dimensional vector Represents the original coordinate point. The new coordinate point obtained after two-dimensional affine transformation is Then the two-dimensional affine transformation can be expressed as the following formula:

[0044]

[0045] This formula represents multiplying the original coordinate point by the linear transformation matrix And add the translation vector Thus, the new coordinate points after transformation are obtained.

[0046] Step 26: Use affine transformation to represent the affine space coordinates corresponding to the center coordinates of all small circle markers, that is, the real coordinates on the fishing rod measurement background plate. Since the coordinates of all feature points are integer multiples of the minimum scale value of the fishing rod measurement background plate, the real coordinates corresponding to all small circle markers on the fishing rod measurement background plate can be determined by rounding off.

[0047] Step 3: Convert pixel coordinates to world coordinates:

[0048] The six fishing rods near the conversion point are used to measure the dots on the background plate, and the perspective transformation matrix is ​​calculated based on the coordinates of these points and the order of the feature points; the input pixel coordinates are converted into real object coordinates based on the perspective transformation matrix. The specific steps are as follows:

[0049] Step 31. For each input point, use KDTree to find the closest feature point: construct the feature points on all fishing rod measurement background plates into KDTree, and query the index of the point closest to the input point.

[0050] Step 32: Construct an affine space in a small area by querying the six nearest feature points. The effect of camera distortion in a smaller area will be reduced, so the affine space constructed in this way can suppress the effect of camera distortion and improve the accuracy of converting pixel coordinates to real coordinates.

[0051] Step 3: After finding the adjacent point, remove it from all indexes to ensure that the next query is the next adjacent point. Repeat this process 6 times to find the 6 adjacent feature points closest to the feature point.

[0052] For example, Figure 5 As shown, points 2 and 3 are the farthest apart, and points 4 and 5 are the closest, so point 1 is determined; the inner product of line 1 and 4 is closer to 0 than that of line 1 and 5 and line 2 and 3, so points 4 and 5 are determined; line 1 and 2 and line 1 and 3 are cross-multiplied with line 1 and 4 respectively, and points 2 and 3 are determined by the positive and negative results. This algorithm is more robust to rotation and affine transformation.

[0053] Step 3: For each close feature point, calculate the parameters of the perspective transformation, and use the least squares method to calculate the parameter matrix A of the perspective transformation.

[0054] Step 35: Extract the parameters of the perspective transformation from the parameter matrix A, and convert the actual coordinates of the feature points into sorted coordinates according to the parameters of the perspective transformation.

[0055] Step 36: Multiply the world coordinates of the sorted feature points by a scaling factor λ to obtain the world coordinates of the input point.

[0056] Example:

[0057] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be described in detail below in conjunction with natural scene images.

[0058] The system development platform is Windows 10 operating system, the GPU is an NVIDIA GeForce GTX TITAN XGPU, the program is written in python 3.9, and uses the PyTorch 1.12 framework.

[0059] Input the background plate image into the system. The system will first automatically identify the dots on the background plate, save the pixel coordinates and areas of all the dots, then read the pixel coordinates and areas of these dots, and sort the points using the Euclidean distance between each pair of feature points to determine the positions of all large circle markers, calculate the parameters of the perspective transformation based on the actual coordinates of the large circle markers and the corresponding pixel coordinates, and calculate the parameter matrix A of the perspective transformation based on the results using the least squares method. The actual coordinates of the feature points are converted to sorted coordinates based on the parameters of the perspective transformation.

[0060] For each input point, use KDTree to find the six closest feature points. For each close feature point, calculate the parameters of the perspective transformation, and use the least squares method to calculate the parameter matrix A of the perspective transformation. Extract the parameters of the perspective transformation from the parameter matrix A. According to the parameters of the perspective transformation, convert the actual coordinates of the feature points into sorted coordinates. Multiply the world coordinates of the sorted feature points by a scaling factor to get the world coordinates of the input point.

[0061] The identified background dots are as follows Figure 6 As shown, the sorted background dots are as follows Figure 7 As shown, the real coordinate effect diagram is as follows Figure 8 As shown. Figure 6-Figure 8 It can be seen that the method of the present invention can realize the conversion of pixel coordinates into world coordinates, and has a very good effect.

Claims

1. A method for converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background plate, characterized in that The method comprises the following steps: Step 1: Design of fishing rod measurement background board: Paste two circular marking points of different radius on the standard background plate to obtain the fishing rod measurement background plate. The world coordinates of all other small circular marking points are determined by the position of the large circular marking point to realize the positioning of the coordinates on the fishing rod measurement background plate. Step 2: Background point identification: By identifying all the circular marking points on the fishing rod measurement background plate, the pixel coordinates of the large circular marking points are determined according to the areas of the circular marking points, thereby determining the pixel coordinates of the remaining small circular marking points; after sorting the small circular marking points, they are compared with the fishing rod measurement background plate to determine their relative positions, and correspond to the world coordinates; Step 3: Convert pixel coordinates to world coordinates: The dots on the background plate are measured by finding six fishing rods near the transformation point, and the perspective transformation matrix is ​​calculated based on the coordinates of these points and the order of the feature points; the input pixel coordinates are converted into real object coordinates according to the perspective transformation matrix.

2. The method for converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background plate according to claim 1, characterized in that The small circle marking points are pasted at intervals of 20 cm, and the large circle marking points are pasted on the edges of the standard background plate.

3. The method for converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background plate according to claim 1 or 2, characterized in that The radius of the large circle mark point is 5 cm, and the radius of the small circle mark point is 2.5 cm.

4. The method for converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background plate according to claim 1, characterized in that The specific steps of step 2 are as follows: Step 21: Use spot detection to identify the circular mark points on the background plate of the fishing rod measurement: Step 2: grayscale the input image to convert the color image into a grayscale image. Step 2-2: Set the threshold range of spot detection, the minimum and maximum areas of spots, the minimum value of roundness, and the concave-convex parameters of the circle, so as to detect according to the characteristics of the circular marker points; Step 2-3: Create a blob detector: Based on the preset parameters, implement a custom blob detector through the SimpleBlobDetectorblob method in the OpenCV library; Step 214: Use a custom spot detector to perform spot detection in the image, find circular marker points that meet the conditions according to the set parameters, and save the pixel coordinates and area of ​​the circular marker points; Step 22: Sort the points according to the area and the Euclidean distance between each pair of circular landmarks to determine the positions of all large circle landmarks; Step 2: Calculate the perspective transformation parameters according to the actual coordinates of the great circle marker points and the corresponding pixel coordinates, and calculate the perspective transformation parameter matrix A using the least squares method based on the results, and correspond the actual coordinates of the feature points to the sorted coordinates according to the perspective transformation parameters; Step 24, calculate the affine matrix of the entire fishing rod measurement background board space through the position of the large circle mark point; Step 25: Represent two-dimensional affine transformation through matrix operation: Suppose there is a two-dimensional vector Represents the original coordinate point, and the new coordinate point obtained after two-dimensional affine transformation is Then the two-dimensional affine transformation can be expressed as the following formula: Step 26: Use affine transformation to represent the affine space coordinates corresponding to the center coordinates of all small circle marking points, and determine the real coordinates corresponding to all small circle marking points on the fishing rod measurement background plate by rounding off.

5. The method for converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background plate according to claim 4, characterized in that In step 22, for the convenience of calculation, a unit length is set to 10 cm, which corresponds to the length of one grid on the background board measured by the fishing rod and is recorded as the scaling factor λ.

6. The method for converting pixel coordinates to world coordinates based on perspective transformation and fishing rod measurement background plate according to claim 1, characterized in that The specific steps of step three are as follows: Step 31. For each input point, use KDTree to find the closest feature point: construct the feature points on all the fishing rod measurement background plates into KDTree, and query the index of the point closest to the input point; Step 32: Construct an affine space in a small area by querying the 6 nearest feature points; Step 3: After finding the adjacent point, remove it from all indexes to ensure that the next query is the next adjacent point. Repeat this process 6 times to find the 6 closest adjacent feature points to the feature point. Step 34: For each close feature point, calculate the parameters of the perspective transformation, and use the least squares method to calculate the parameter matrix A of the perspective transformation; Step 35: Extract the parameters of the perspective transformation from the parameter matrix A, and convert the actual coordinates of the feature points into sorted coordinates according to the parameters of the perspective transformation; Step 36: Multiply the world coordinates of the sorted feature points by a scaling factor λ to obtain the world coordinates of the input point.