camera_info_definitions.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Aldebaran
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef CAMERA_INFO_DEF_HPP
19 #define CAMERA_INFO_DEF_HPP
20 
21 #include <sensor_msgs/CameraInfo.h>
22 #include <boost/assign/list_of.hpp>
23 
24 namespace naoqi
25 {
26 namespace converter
27 {
28 namespace camera_info_definitions
29 {
30 
34 inline sensor_msgs::CameraInfo createCameraInfoTOPVGA()
35 {
36  sensor_msgs::CameraInfo cam_info_msg;
37 
38  cam_info_msg.header.frame_id = "CameraTop_optical_frame";
39 
40  cam_info_msg.width = 640;
41  cam_info_msg.height = 480;
42  cam_info_msg.K = boost::array<double, 9>{{ 556.845054830986, 0, 309.366895338178, 0, 555.898679730161, 230.592233628776, 0, 0, 1 }};
43 
44  cam_info_msg.distortion_model = "plumb_bob";
45  cam_info_msg.D = boost::assign::list_of(-0.0545211535376379)(0.0691973423510287)(-0.00241094929163055)(-0.00112245009306511)(0).convert_to_container<std::vector<double> >();
46 
47  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
48 
49  cam_info_msg.P = boost::array<double, 12>{{ 551.589721679688, 0, 308.271132841983, 0, 0, 550.291320800781, 229.20143668168, 0, 0, 0, 1, 0 }};
50 
51  return cam_info_msg;
52 }
53 
54 
55 inline sensor_msgs::CameraInfo createCameraInfoTOPQVGA()
56 {
57  sensor_msgs::CameraInfo cam_info_msg;
58 
59  cam_info_msg.header.frame_id = "CameraTop_optical_frame";
60 
61  cam_info_msg.width = 320;
62  cam_info_msg.height = 240;
63  cam_info_msg.K = boost::array<double, 9>{{ 274.139508945831, 0, 141.184472810944, 0, 275.741846757374, 106.693773654172, 0, 0, 1 }};
64 
65  cam_info_msg.distortion_model = "plumb_bob";
66  cam_info_msg.D = boost::assign::list_of(-0.0870160932911717)(0.128210165050533)(0.003379500659424)(-0.00106205540818586)(0).convert_to_container<std::vector<double> >();
67 
68  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
69 
70  cam_info_msg.P = boost::array<double, 12>{{ 272.423675537109, 0, 141.131930791285, 0, 0, 273.515747070312, 107.391746054313, 0, 0, 0, 1, 0 }};
71 
72  return cam_info_msg;
73 }
74 
75 
76 inline sensor_msgs::CameraInfo createCameraInfoTOPQQVGA()
77 {
78  sensor_msgs::CameraInfo cam_info_msg;
79 
80  cam_info_msg.header.frame_id = "CameraTop_optical_frame";
81 
82  cam_info_msg.width = 160;
83  cam_info_msg.height = 120;
84  cam_info_msg.K = boost::array<double, 9>{{ 139.424539568966, 0, 76.9073669920582, 0, 139.25542782325, 59.5554242026743, 0, 0, 1 }};
85 
86  cam_info_msg.distortion_model = "plumb_bob";
87  cam_info_msg.D = boost::assign::list_of(-0.0843564504845967)(0.125733083790192)(0.00275901756247071)(-0.00138645823460527)(0).convert_to_container<std::vector<double> >();
88 
89  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
90 
91  cam_info_msg.P = boost::array<double, 12>{{ 137.541534423828, 0, 76.3004646597892, 0, 0, 136.815216064453, 59.3909799751191, 0, 0, 0, 1, 0 }};
92 
93  return cam_info_msg;
94 }
95 
96 
100 inline sensor_msgs::CameraInfo createCameraInfoBOTTOMVGA()
101 {
102  sensor_msgs::CameraInfo cam_info_msg;
103 
104  cam_info_msg.header.frame_id = "CameraBottom_optical_frame";
105 
106  cam_info_msg.width = 640;
107  cam_info_msg.height = 480;
108  cam_info_msg.K = boost::array<double, 9>{{ 558.570339530768, 0, 308.885375457296, 0, 556.122943034837, 247.600724811385, 0, 0, 1 }};
109 
110  cam_info_msg.distortion_model = "plumb_bob";
111  cam_info_msg.D = boost::assign::list_of(-0.0648763971625288)(0.0612520196884308)(0.0038281538281731)(-0.00551104078371959)(0).convert_to_container<std::vector<double> >();
112 
113  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
114 
115  cam_info_msg.P = boost::array<double, 12>{{ 549.571655273438, 0, 304.799679526441, 0, 0, 549.687316894531, 248.526959297022, 0, 0, 0, 1, 0 }};
116 
117  return cam_info_msg;
118 }
119 
120 
121 inline sensor_msgs::CameraInfo createCameraInfoBOTTOMQVGA()
122 {
123  sensor_msgs::CameraInfo cam_info_msg;
124 
125  cam_info_msg.header.frame_id = "CameraBottom_optical_frame";
126 
127  cam_info_msg.width = 320;
128  cam_info_msg.height = 240;
129  cam_info_msg.K = boost::array<double, 9>{{ 278.236008818534, 0, 156.194471689706, 0, 279.380102992049, 126.007123836447, 0, 0, 1 }};
130 
131  cam_info_msg.distortion_model = "plumb_bob";
132  cam_info_msg.D = boost::assign::list_of(-0.0481869853715082)(0.0201858398559121)(0.0030362056699177)(-0.00172241952442813)(0).convert_to_container<std::vector<double> >();
133 
134  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
135 
136  cam_info_msg.P = boost::array<double, 12>{{ 273.491455078125, 0, 155.112454709117, 0, 0, 275.743133544922, 126.057357467223, 0, 0, 0, 1, 0 }};
137 
138  return cam_info_msg;
139 }
140 
141 
142 inline sensor_msgs::CameraInfo createCameraInfoBOTTOMQQVGA()
143 {
144  sensor_msgs::CameraInfo cam_info_msg;
145 
146  cam_info_msg.header.frame_id = "CameraBottom_optical_frame";
147 
148  cam_info_msg.width = 160;
149  cam_info_msg.height = 120;
150  cam_info_msg.K = boost::array<double, 9>{{ 141.611855886672, 0, 78.6494086288656, 0, 141.367163830175, 58.9220646201529, 0, 0, 1 }};
151 
152  cam_info_msg.distortion_model = "plumb_bob";
153  cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0).convert_to_container<std::vector<double> >();
154 
155  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
156 
157  cam_info_msg.P = boost::array<double, 12>{{ 138.705535888672, 0, 77.2544255212306, 0, 0, 138.954086303711, 58.7000861760043, 0, 0, 0, 1, 0 }};
158 
159  return cam_info_msg;
160 }
161 
162 
166 inline sensor_msgs::CameraInfo createCameraInfoDEPTHVGA()
167 {
168  sensor_msgs::CameraInfo cam_info_msg;
169 
170  cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
171 
172  cam_info_msg.width = 640;
173  cam_info_msg.height = 480;
174  cam_info_msg.K = boost::array<double, 9>{{ 525, 0, 319.5000000, 0, 525, 239.5000000000000, 0, 0, 1 }};
175 
176  //cam_info_msg.distortion_model = "plumb_bob";
177  //cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0);
178 
179  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
180 
181  cam_info_msg.P = boost::array<double, 12>{{ 525, 0, 319.500000, 0, 0, 525, 239.5000000000, 0, 0, 0, 1, 0 }};
182 
183  return cam_info_msg;
184 }
185 
186 
187 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQVGA()
188 {
189  sensor_msgs::CameraInfo cam_info_msg;
190 
191  cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
192 
193  cam_info_msg.width = 320;
194  cam_info_msg.height = 240;
195  cam_info_msg.K = boost::array<double, 9>{{ 525/2.0f, 0, 319.5000000/2.0f, 0, 525/2.0f, 239.5000000000000/2.0f, 0, 0, 1 }};
196 
197  //cam_info_msg.distortion_model = "plumb_bob";
198  //cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0);
199 
200  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
201 
202  cam_info_msg.P = boost::array<double, 12>{{ 525/2.0f, 0, 319.500000/2.0f, 0, 0, 525/2.0f, 239.5000000000/2.0f, 0, 0, 0, 1, 0 }};
203 
204  return cam_info_msg;
205 }
206 
207 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQVGA()
208 {
209  sensor_msgs::CameraInfo cam_info_msg;
210 
211  cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
212 
213  cam_info_msg.width = 160;
214  cam_info_msg.height = 120;
215  cam_info_msg.K = boost::array<double, 9>{{ 525/4.0f, 0, 319.5000000/4.0f, 0, 525/4.0f, 239.5000000000000/4.0f, 0, 0, 1 }};
216 
217  //cam_info_msg.distortion_model = "plumb_bob";
218  //cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0);
219 
220  cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
221 
222  cam_info_msg.P = boost::array<double, 12>{{ 525/4.0f, 0, 319.500000/4.0f, 0, 0, 525/4.0f, 239.5000000000/4.0f, 0, 0, 0, 1, 0 }};
223 
224  return cam_info_msg;
225 }
226 
230 inline sensor_msgs::CameraInfo createCameraInfoStereo(
231  const int &width,
232  const int &height,
233  const float &reductionFactor) {
234 
235  sensor_msgs::CameraInfo cam_info_msg;
236 
237  cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
238 
239  const size_t nK = 9;
240  const size_t nD = 5;
241  const size_t nR = 9;
242  const size_t nP = 12;
243 
244  float kTab[nK] = {703.102356f/reductionFactor, 0, 647.821594f/reductionFactor,
245  0, 702.432312f/reductionFactor, 380.971680f/reductionFactor,
246  0, 0, 1 };
247 
248  float dTab[nD] = {-0.168594331,
249  .00881872326,
250  -0.000182721298,
251  -0.0000145479062,
252  0.0137237618};
253 
254  float rTab[nR] = {0.999984741, 0.000130843779, 0.00552622462,
255  -0.000111592424, 0.999993920, -0.00348380185,
256  -0.00552664697, 0.00348313176, 0.999978662};
257 
258  float pTab[nP] = {569.869568f/reductionFactor, 0, 644.672058f/reductionFactor, 0,
259  0, 569.869568f/reductionFactor, 393.368958f/reductionFactor, 0,
260  0, 0, 1, 0 };
261 
262 
263  cam_info_msg.width = width;
264  cam_info_msg.height = height;
265 
266  for (int i = 0; i < nK; ++i)
267  cam_info_msg.K.at(i) = kTab[i];
268 
269  cam_info_msg.distortion_model = "plumb_bob";
270  cam_info_msg.D.assign(dTab, dTab + nD);
271 
272  for (int i = 0; i < nR; ++i)
273  cam_info_msg.R.at(i) = rTab[i];
274 
275  for (int i = 0; i < nP; ++i)
276  cam_info_msg.P.at(i) = pTab[i];
277 
278  return cam_info_msg;
279 }
280 
281 inline sensor_msgs::CameraInfo createCameraInfoDEPTH720P()
282 {
283  return createCameraInfoStereo(1280, 720, 1.0);
284 }
285 
286 
287 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQ720P()
288 {
289  return createCameraInfoStereo(640, 360, 2.0);
290 }
291 
292 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQ720P()
293 {
294  return createCameraInfoStereo(320, 180, 4.0);
295 }
296 
297 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQQ720P()
298 {
299  return createCameraInfoStereo(160, 90, 8.0);
300 }
301 
302 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQQQ720P()
303 {
304  return createCameraInfoStereo(80, 45, 16.0);
305 }
306 
307 // Complete methods for stereo image parameteres
308 inline sensor_msgs::CameraInfo createCameraInfoStereo720PX2()
309 {
310  return createCameraInfoStereo(2560, 720, 1.0);
311 }
312 
313 inline sensor_msgs::CameraInfo createCameraInfoStereoQ720PX2()
314 {
315  return createCameraInfoStereo(1280, 360, 2.0);
316 }
317 
318 inline sensor_msgs::CameraInfo createCameraInfoStereoQQ720PX2()
319 {
320  return createCameraInfoStereo(640, 180, 4.0);
321 }
322 
323 inline sensor_msgs::CameraInfo createCameraInfoStereoQQQ720PX2()
324 {
325  return createCameraInfoStereo(320, 90, 8.0);
326 }
327 
328 inline sensor_msgs::CameraInfo createCameraInfoStereoQQQQ720PX2()
329 {
330  return createCameraInfoStereo(160, 45, 16.0);
331 }
332 
333 } // camera_info_definitions
334 } //publisher
335 } //naoqi
336 
337 
338 #endif
sensor_msgs::CameraInfo createCameraInfoStereo(const int &width, const int &height, const float &reductionFactor)


naoqi_driver
Author(s): Karsten Knese
autogenerated on Sat Feb 15 2020 03:24:26