Skip to content

Commit

Permalink
Fix out of bounds indexes when retrieving camera matrix for rectified…
Browse files Browse the repository at this point in the history
… images (#47)

* Fix out of bounds indexes when retrieving camera matrix for rectified images

Co-authored-by: Sandip Das <[email protected]>

* Add image_is_rectified parameter to example yaml config

---------

Co-authored-by: Sandip Das <[email protected]>
  • Loading branch information
bjsowa and real-Sandip-Das authored Jun 4, 2024
1 parent 146e912 commit 988501b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions aruco_opencv/config/aruco_tracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

marker_dict: 4X4_50

image_is_rectified: false
image_sub_compressed: false
image_sub_qos:
reliability: 2 # 0 - system default, 1 - reliable, 2 - best effort
Expand Down
4 changes: 2 additions & 2 deletions aruco_opencv/src/aruco_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ class ArucoTracker : public rclcpp_lifecycle::LifecycleNode
std::lock_guard<std::mutex> guard(cam_info_mutex_);

if (image_is_rectified_) {
for (int i = 0; i < 12; ++i) {
camera_matrix_.at<double>(i / 4, i % 4) = cam_info->p[i];
for (int i = 0; i < 9; ++i) {
camera_matrix_.at<double>(i / 3, i % 3) = cam_info->p[i + i / 3];
}
} else {
for (int i = 0; i < 9; ++i) {
Expand Down

0 comments on commit 988501b

Please sign in to comment.