Skip to content

Commit

Permalink
Use std::tan
Browse files Browse the repository at this point in the history
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
Kotochleb and ahcorde authored May 27, 2024
1 parent 89c7bc3 commit c9cc228
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion image_publisher/src/image_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(camera_info_.width / 2), 0, f_approx,
static_cast<float>(camera_info_.height / 2), 0, 0, 1};
camera_info_.r = {1, 0, 0, 0, 1, 0, 0, 0, 1};
Expand Down

0 comments on commit c9cc228

Please sign in to comment.