camera_info.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Fetch Robotics Inc.
3  * Copyright (C) 2013-2014 Unbounded Robotics Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 // Author: Michael Ferguson
19 
20 #ifndef ROBOT_CALIBRATION_CAMERA_INFO_H
21 #define ROBOT_CALIBRATION_CAMERA_INFO_H
22 
23 #include <ros/ros.h>
24 #include <sensor_msgs/CameraInfo.h>
25 
26 namespace robot_calibration
27 {
28 
33 
38 
44 
51 
52 
54 inline sensor_msgs::CameraInfo updateCameraInfo(double camera_fx, double camera_fy,
55  double camera_cx, double camera_cy,
56  const sensor_msgs::CameraInfo& info)
57 {
58  sensor_msgs::CameraInfo new_info = info;
59 
60  new_info.P[CAMERA_INFO_P_CX_INDEX] *= camera_cx + 1.0; // CX
61  new_info.P[CAMERA_INFO_P_CY_INDEX] *= camera_cy + 1.0; // CY
62  new_info.P[CAMERA_INFO_P_FX_INDEX] *= camera_fx + 1.0; // FX
63  new_info.P[CAMERA_INFO_P_FY_INDEX] *= camera_fy + 1.0; // FY
64 
65  new_info.K[CAMERA_INFO_K_CX_INDEX] *= camera_cx + 1.0; // CX
66  new_info.K[CAMERA_INFO_K_CY_INDEX] *= camera_cy + 1.0; // CY
67  new_info.K[CAMERA_INFO_K_FX_INDEX] *= camera_fx + 1.0; // FX
68  new_info.K[CAMERA_INFO_K_FY_INDEX] *= camera_fy + 1.0; // FY
69 
70  return new_info;
71 }
72 
73 } // namespace robot_calibration
74 
75 #endif // ROBOT_CALIBRATION_CAMERA_INFO_H
sensor_msgs::CameraInfo updateCameraInfo(double camera_fx, double camera_fy, double camera_cx, double camera_cy, const sensor_msgs::CameraInfo &info)
Update the camera calibration with the new offsets.
Definition: camera_info.h:54
Calibration code lives under this namespace.


robot_calibration
Author(s): Michael Ferguson
autogenerated on Tue Nov 3 2020 17:30:30