Skip to content

Instantly share code, notes, and snippets.

@newpolaris
Created February 9, 2022 13:16
Show Gist options
  • Select an option

  • Save newpolaris/e073c2e372a22b6563680ec4feaeac96 to your computer and use it in GitHub Desktop.

Select an option

Save newpolaris/e073c2e372a22b6563680ec4feaeac96 to your computer and use it in GitHub Desktop.
GetProjectFromCameraMtx2
// http://jamesgregson.blogspot.com/2011/11/matching-calibrated-cameras-with-opengl.html
// 결과는 거의 같은데, (3,3), (3,4), (4,3)이 여긴 죄다 양수임
// https://ksimek.github.io/2013/06/03/calibrated_cameras_in_opengl/ 여기서는 음수임
glm::mat4 GetProjectFromCameraMtx2(const glm::mat3& cameraMatrix, float near, float far)
{
float fx = cameraMatrix[0][0];
float fy = cameraMatrix[1][1];
float cx = cameraMatrix[2][0];
float cy = cameraMatrix[2][1];
Eigen::Matrix4d proj;
build_opengl_projection_for_intrinsics(proj, nullptr, fx, fy, 0.f, cx, cy, cx * 2, cy * 2, near, far);
return ToMat(proj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment