fix field of view computation in setWindowSize
This commit is contained in:
parent
119d97f1f6
commit
f8ad3c0204
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user