This blog by the Sea to a squealing original, welcome reprint, Reprint please indicate the source of the blog, thank you.
In the AR Technology Network group to see a lot of people ask the virtual button in the instance of the button coordinates are how to calculate, today we will talk about the principle of computing.
Question: How is the virtual button's position coordinates determined.
See above, the origin is in the upper-left corner, the vertical direction is the y axis, the horizontal direction is the x-axis, and the (1500,1050) pixel. The size of the button is (200,75).
The original pixel coordinates in the following table are the coordinate values of the upper-left and lower-right corners of the button's rectangular box respectively.
The right column is the coordinate value of the picture label after the size conversion. So what kind of transformation does it have?
The following illustration shows the 3D coordinate system in the SDK. The data on the right side of the table is the value that the original coordinate system translates into a coordinate system. You can see that the origin of the 3D coordinate system is in the center of the image, so it is not difficult to explain the negative values in the table above.
Here is a list of the corresponding calculation formulas.
Calculation is relatively simple, with a similar ratio on it, but we pay attention to the conversion unit.
Using similar relationships:
90/750 = (123.5-x)/123.5
Use this formula to figure out that X is 108.68.
Similarly, you can calculate the Y value, and then judge positive and negative, so get the coordinate value ( -108.68,-53.52)