From 4762cac9b1e926facd0aa14b6a19e1b79caceab2 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 ea6b7bbdb..46f0dc7c6 100644 --- a/image_publisher/src/image_publisher.cpp +++ b/image_publisher/src/image_publisher.cpp @@ -227,7 +227,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};