Convert pixel coordinates to cartesian coordinates [closed]

北城余情 提交于 2021-02-20 04:51:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!