From c9cc2282f64b9d6274f7f8d471c8cd2009c1f4de Mon Sep 17 00:00:00 2001 From: Krzysztof Wojciechowski <49921081+Kotochleb@users.noreply.github.com> Date: Mon, 27 May 2024 12:21:45 +0200 Subject: [PATCH] Use std::tan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alejandro Hernández Cordero --- image_publisher/src/image_publisher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image_publisher/src/image_publisher.cpp b/image_publisher/src/image_publisher.cpp index ba844c167..96f853bae 100644 --- a/image_publisher/src/image_publisher.cpp +++ b/image_publisher/src/image_publisher.cpp @@ -220,7 +220,7 @@ void ImagePublisher::onInit() camera_info_.d = {0, 0, 0, 0, 0}; // Based on https://learnopencv.com/approximate-focal-length-for-webcams-and-cell-phone-cameras/ - double f_approx = (camera_info_.width / 2) / tan((field_of_view_ * M_PI / 180) / 2); + double f_approx = (camera_info_.width / 2) / std::tan((field_of_view_ * M_PI / 180) / 2); camera_info_.k = {f_approx, 0, static_cast(camera_info_.width / 2), 0, f_approx, static_cast(camera_info_.height / 2), 0, 0, 1}; camera_info_.r = {1, 0, 0, 0, 1, 0, 0, 0, 1};