How to get the Projection ProjectionMatrixFromCameraIntrinsics

来源:互联网 发布:人工智能技术 知乎 编辑:程序博客网 时间:2024/06/05 19:14


ProjectionMatrixForCameraIntrinsics(float width, float height, float fx, float fy,float cx, float cy,  float near, float far) {  const float xscale = near / fx;  const float yscale = near / fy;  const float xoffset = (cx - (width / 2.0)) * xscale;  const float yoffset = -(cy - (height / 2.0)) * yscale;  return glm::frustum(xscale * -width / 2.0f - xoffset,                      xscale * width / 2.0f - xoffset,                      yscale * -height / 2.0f - yoffset,                      yscale * height / 2.0f - yoffset, near, far);}

原创粉丝点击