Commit f8ad3c02 authored by ozantonkal's avatar ozantonkal

fix field of view computation in setWindowSize

parent 119d97f1
......@@ -189,10 +189,10 @@ void cv::viz::Camera::setWindowSize(const Size &window_size)
// Vertical field of view is fixed!
// Horizontal field of view is expandable based on the aspect ratio
float aspect_ratio_new = window_size.width / window_size.height;
float aspect_ratio_new = static_cast<float>(window_size.width) / static_cast<float>(window_size.height);
if (principal_point_[0] < 0.0f)
fov_[0] = 2 * atan2(tan(fov_[1] * 0.5), aspect_ratio_new); // This assumes that the lens is symmetric!
fov_[0] = 2.f * atan(tan(fov_[1] * 0.5) * aspect_ratio_new); // This assumes that the lens is symmetric!
else
fov_[0] = (atan2(principal_point_[0],focal_[0]) + atan2(window_size.width-principal_point_[0],focal_[0])) * 180 / CV_PI;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment