camera_info_definitions.hpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2015 Aldebaran
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 
00018 #ifndef CAMERA_INFO_DEF_HPP
00019 #define CAMERA_INFO_DEF_HPP
00020 
00021 #include <sensor_msgs/CameraInfo.h>
00022 #include <boost/assign/list_of.hpp>
00023 
00024 namespace naoqi
00025 {
00026 namespace converter
00027 {
00028 namespace camera_info_definitions
00029 {
00030 
00034 inline sensor_msgs::CameraInfo createCameraInfoTOPVGA()
00035 {
00036   sensor_msgs::CameraInfo cam_info_msg;
00037 
00038   cam_info_msg.header.frame_id = "CameraTop_optical_frame";
00039 
00040   cam_info_msg.width = 640;
00041   cam_info_msg.height = 480;
00042   cam_info_msg.K = boost::array<double, 9>{{ 556.845054830986, 0, 309.366895338178, 0, 555.898679730161, 230.592233628776, 0, 0, 1 }};
00043 
00044   cam_info_msg.distortion_model = "plumb_bob";
00045   cam_info_msg.D = boost::assign::list_of(-0.0545211535376379)(0.0691973423510287)(-0.00241094929163055)(-0.00112245009306511)(0).convert_to_container<std::vector<double> >();
00046 
00047   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00048 
00049   cam_info_msg.P = boost::array<double, 12>{{ 551.589721679688, 0, 308.271132841983, 0, 0, 550.291320800781, 229.20143668168, 0, 0, 0, 1, 0 }};
00050 
00051   return cam_info_msg;
00052 }
00053 
00054 
00055 inline sensor_msgs::CameraInfo createCameraInfoTOPQVGA()
00056 {
00057   sensor_msgs::CameraInfo cam_info_msg;
00058 
00059   cam_info_msg.header.frame_id = "CameraTop_optical_frame";
00060 
00061   cam_info_msg.width = 320;
00062   cam_info_msg.height = 240;
00063   cam_info_msg.K = boost::array<double, 9>{{ 274.139508945831, 0, 141.184472810944, 0, 275.741846757374, 106.693773654172, 0, 0, 1 }};
00064 
00065   cam_info_msg.distortion_model = "plumb_bob";
00066   cam_info_msg.D = boost::assign::list_of(-0.0870160932911717)(0.128210165050533)(0.003379500659424)(-0.00106205540818586)(0).convert_to_container<std::vector<double> >();
00067 
00068   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00069 
00070   cam_info_msg.P = boost::array<double, 12>{{ 272.423675537109, 0, 141.131930791285, 0, 0, 273.515747070312, 107.391746054313, 0, 0, 0, 1, 0 }};
00071 
00072   return cam_info_msg;
00073 }
00074 
00075 
00076 inline sensor_msgs::CameraInfo createCameraInfoTOPQQVGA()
00077 {
00078   sensor_msgs::CameraInfo cam_info_msg;
00079 
00080   cam_info_msg.header.frame_id = "CameraTop_optical_frame";
00081 
00082   cam_info_msg.width = 160;
00083   cam_info_msg.height = 120;
00084   cam_info_msg.K = boost::array<double, 9>{{ 139.424539568966, 0, 76.9073669920582, 0, 139.25542782325, 59.5554242026743, 0, 0, 1 }};
00085 
00086   cam_info_msg.distortion_model = "plumb_bob";
00087   cam_info_msg.D = boost::assign::list_of(-0.0843564504845967)(0.125733083790192)(0.00275901756247071)(-0.00138645823460527)(0).convert_to_container<std::vector<double> >();
00088 
00089   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00090 
00091   cam_info_msg.P = boost::array<double, 12>{{ 137.541534423828, 0, 76.3004646597892, 0, 0, 136.815216064453, 59.3909799751191, 0, 0, 0, 1, 0 }};
00092 
00093   return cam_info_msg;
00094 }
00095 
00096 
00100 inline sensor_msgs::CameraInfo createCameraInfoBOTTOMVGA()
00101 {
00102   sensor_msgs::CameraInfo cam_info_msg;
00103 
00104   cam_info_msg.header.frame_id = "CameraBottom_optical_frame";
00105 
00106   cam_info_msg.width = 640;
00107   cam_info_msg.height = 480;
00108   cam_info_msg.K = boost::array<double, 9>{{ 558.570339530768, 0, 308.885375457296, 0, 556.122943034837, 247.600724811385, 0, 0, 1 }};
00109 
00110   cam_info_msg.distortion_model = "plumb_bob";
00111   cam_info_msg.D = boost::assign::list_of(-0.0648763971625288)(0.0612520196884308)(0.0038281538281731)(-0.00551104078371959)(0).convert_to_container<std::vector<double> >();
00112 
00113   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00114 
00115   cam_info_msg.P = boost::array<double, 12>{{ 549.571655273438, 0, 304.799679526441, 0, 0, 549.687316894531, 248.526959297022, 0, 0, 0, 1, 0 }};
00116 
00117   return cam_info_msg;
00118 }
00119 
00120 
00121 inline sensor_msgs::CameraInfo createCameraInfoBOTTOMQVGA()
00122 {
00123   sensor_msgs::CameraInfo cam_info_msg;
00124 
00125   cam_info_msg.header.frame_id = "CameraBottom_optical_frame";
00126 
00127   cam_info_msg.width = 320;
00128   cam_info_msg.height = 240;
00129   cam_info_msg.K = boost::array<double, 9>{{ 278.236008818534, 0, 156.194471689706, 0, 279.380102992049, 126.007123836447, 0, 0, 1 }};
00130 
00131   cam_info_msg.distortion_model = "plumb_bob";
00132   cam_info_msg.D = boost::assign::list_of(-0.0481869853715082)(0.0201858398559121)(0.0030362056699177)(-0.00172241952442813)(0).convert_to_container<std::vector<double> >();
00133 
00134   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00135 
00136   cam_info_msg.P = boost::array<double, 12>{{ 273.491455078125, 0, 155.112454709117, 0, 0, 275.743133544922, 126.057357467223, 0, 0, 0, 1, 0 }};
00137 
00138   return cam_info_msg;
00139 }
00140 
00141 
00142 inline sensor_msgs::CameraInfo createCameraInfoBOTTOMQQVGA()
00143 {
00144   sensor_msgs::CameraInfo cam_info_msg;
00145 
00146   cam_info_msg.header.frame_id = "CameraBottom_optical_frame";
00147 
00148   cam_info_msg.width = 160;
00149   cam_info_msg.height = 120;
00150   cam_info_msg.K = boost::array<double, 9>{{ 141.611855886672, 0, 78.6494086288656, 0, 141.367163830175, 58.9220646201529, 0, 0, 1 }};
00151 
00152   cam_info_msg.distortion_model = "plumb_bob";
00153   cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0).convert_to_container<std::vector<double> >();
00154 
00155   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00156 
00157   cam_info_msg.P = boost::array<double, 12>{{ 138.705535888672, 0, 77.2544255212306, 0, 0, 138.954086303711, 58.7000861760043, 0, 0, 0, 1, 0 }};
00158 
00159   return cam_info_msg;
00160 }
00161 
00162 
00166 inline sensor_msgs::CameraInfo createCameraInfoDEPTHVGA()
00167 {
00168   sensor_msgs::CameraInfo cam_info_msg;
00169 
00170   cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
00171 
00172   cam_info_msg.width = 640;
00173   cam_info_msg.height = 480;
00174   cam_info_msg.K = boost::array<double, 9>{{ 525, 0, 319.5000000, 0, 525, 239.5000000000000, 0, 0, 1  }};
00175 
00176   //cam_info_msg.distortion_model = "plumb_bob";
00177   //cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0);
00178 
00179   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00180 
00181   cam_info_msg.P = boost::array<double, 12>{{ 525, 0, 319.500000, 0, 0, 525, 239.5000000000, 0, 0, 0, 1, 0 }};
00182 
00183   return cam_info_msg;
00184 }
00185 
00186 
00187 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQVGA()
00188 {
00189   sensor_msgs::CameraInfo cam_info_msg;
00190 
00191   cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
00192 
00193   cam_info_msg.width = 320;
00194   cam_info_msg.height = 240;
00195   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  }};
00196 
00197   //cam_info_msg.distortion_model = "plumb_bob";
00198   //cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0);
00199 
00200   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00201 
00202   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 }};
00203 
00204   return cam_info_msg;
00205 }
00206 
00207 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQVGA()
00208 {
00209   sensor_msgs::CameraInfo cam_info_msg;
00210 
00211   cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
00212 
00213   cam_info_msg.width = 160;
00214   cam_info_msg.height = 120;
00215   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  }};
00216 
00217   //cam_info_msg.distortion_model = "plumb_bob";
00218   //cam_info_msg.D = boost::assign::list_of(-0.0688388724945936)(0.0697453843669642)(0.00309518737071049)(-0.00570486993696543)(0);
00219 
00220   cam_info_msg.R = boost::array<double, 9>{{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }};
00221 
00222   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 }};
00223 
00224   return cam_info_msg;
00225 }
00226 
00230 inline sensor_msgs::CameraInfo createCameraInfoStereo(
00231         const int &width,
00232         const int &height,
00233         const float &reductionFactor) {
00234 
00235   sensor_msgs::CameraInfo cam_info_msg;
00236 
00237   cam_info_msg.header.frame_id = "CameraDepth_optical_frame";
00238 
00239   const size_t nK = 9;
00240   const size_t nD = 5;
00241   const size_t nR = 9;
00242   const size_t nP = 12;
00243 
00244   float kTab[nK] = {703.102356f/reductionFactor, 0, 647.821594f/reductionFactor,
00245                     0, 702.432312f/reductionFactor, 380.971680f/reductionFactor,
00246                     0, 0, 1 };
00247 
00248   float dTab[nD] = {-0.168594331,
00249                     .00881872326,
00250                     -0.000182721298,
00251                     -0.0000145479062,
00252                     0.0137237618};
00253 
00254   float rTab[nR] = {0.999984741, 0.000130843779, 0.00552622462,
00255                     -0.000111592424, 0.999993920, -0.00348380185,
00256                     -0.00552664697, 0.00348313176, 0.999978662};
00257 
00258   float pTab[nP] = {569.869568f/reductionFactor, 0, 644.672058f/reductionFactor, 0,
00259                     0, 569.869568f/reductionFactor, 393.368958f/reductionFactor, 0,
00260                     0, 0, 1, 0 };
00261 
00262 
00263   cam_info_msg.width = width;
00264   cam_info_msg.height = height;
00265 
00266   for (int i = 0; i < nK; ++i)
00267     cam_info_msg.K.at(i) = kTab[i];
00268 
00269   cam_info_msg.distortion_model = "plumb_bob";
00270   cam_info_msg.D.assign(dTab, dTab + nD);
00271 
00272   for (int i = 0; i < nR; ++i)
00273     cam_info_msg.R.at(i) = rTab[i];
00274 
00275   for (int i = 0; i < nP; ++i)
00276     cam_info_msg.P.at(i) = pTab[i];
00277 
00278   return cam_info_msg;
00279 }
00280 
00281 inline sensor_msgs::CameraInfo createCameraInfoDEPTH720P()
00282 {
00283   return createCameraInfoStereo(1280, 720, 1.0);
00284 }
00285 
00286 
00287 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQ720P()
00288 {
00289   return createCameraInfoStereo(640, 360, 2.0);
00290 }
00291 
00292 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQ720P()
00293 {
00294   return createCameraInfoStereo(320, 180, 4.0);
00295 }
00296 
00297 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQQ720P()
00298 {
00299   return createCameraInfoStereo(160, 90, 8.0);
00300 }
00301 
00302 inline sensor_msgs::CameraInfo createCameraInfoDEPTHQQQQ720P()
00303 {
00304   return createCameraInfoStereo(80, 45, 16.0);
00305 }
00306 
00307 // Complete methods for stereo image parameteres
00308 inline sensor_msgs::CameraInfo createCameraInfoStereo720PX2()
00309 {
00310   return createCameraInfoStereo(2560, 720, 1.0);
00311 }
00312 
00313 inline sensor_msgs::CameraInfo createCameraInfoStereoQ720PX2()
00314 {
00315     return createCameraInfoStereo(1280, 360, 2.0);
00316 }
00317 
00318 inline sensor_msgs::CameraInfo createCameraInfoStereoQQ720PX2()
00319 {
00320     return createCameraInfoStereo(640, 180, 4.0);
00321 }
00322 
00323 inline sensor_msgs::CameraInfo createCameraInfoStereoQQQ720PX2()
00324 {
00325     return createCameraInfoStereo(320, 90, 8.0);
00326 }
00327 
00328 inline sensor_msgs::CameraInfo createCameraInfoStereoQQQQ720PX2()
00329 {
00330     return createCameraInfoStereo(160, 45, 16.0);
00331 }
00332 
00333 } // camera_info_definitions
00334 } //publisher
00335 } //naoqi
00336 
00337 
00338 #endif


naoqi_driver
Author(s): Karsten Knese
autogenerated on Tue Jul 9 2019 03:21:56