问题
How to convert pixel/screen coordinates to cartesian coordinates(x,y)?
The info I have on the pictures is (see image):
vFov
in degrees, hFov
in degrees, pixel width, pixel height
Basically what I want is to take any pixel on the image, and calculate the relative degrees it is away from the center of the image.
回答1:
You can never - by principal - convert pixel coordinates to 3d-cooridnates since there is not enough information. This has nothing to do with c++ or any language. Just think of a picture you take with a camera. It is 2D, however the real word is 3D and the third dimension is not in contained in the picture (except for blurryness).
回答2:
x - w/2
h/2 - y
where w and h are screen's dimensions. Eh?
来源:https://stackoverflow.com/questions/60835316/convert-pixel-coordinates-to-cartesian-coordinates