00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2010 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 00029 #ifndef mrpt_vision_pinhole_H 00030 #define mrpt_vision_pinhole_H 00031 00032 #include <mrpt/utils/TCamera.h> 00033 #include <mrpt/vision/utils.h> 00034 00035 namespace mrpt 00036 { 00037 namespace vision 00038 { 00039 /** Functions related to pinhole camera models, point projections, etc. */ 00040 namespace pinhole 00041 { 00042 /** Project a set of 3D points into a camera at an arbitrary 6D pose using its calibration matrix (undistorted projection model) 00043 * \param in_points_3D [IN] The list of 3D points in world coordinates (meters) to project. 00044 * \param cameraPose [IN] The pose of the camera in the world. 00045 * \param intrinsicParams [IN] The 3x3 calibration matrix. See http://www.mrpt.org/Camera_Parameters 00046 * \param projectedPoints [OUT] The list of image coordinates (in pixels) for the projected points. At output this list is resized to the same number of input points. 00047 * \param accept_points_behind [IN] See the note below. 00048 * 00049 * \note Points "behind" the camera (which couldn't be physically seen in the real world) are marked with pixel coordinates (-1,-1) to detect them as invalid, unless accept_points_behind is true. In that case they'll be projected normally. 00050 * 00051 * \sa projectPoints_with_distortion 00052 */ 00053 void VISION_IMPEXP projectPoints_no_distortion( 00054 const std::vector<mrpt::poses::CPoint3D> &in_points_3D, 00055 const mrpt::poses::CPose3D &cameraPose, 00056 const mrpt::math::CMatrixDouble33 & intrinsicParams, 00057 std::vector<mrpt::vision::TPixelCoordf> &projectedPoints, 00058 bool accept_points_behind = false 00059 ); 00060 00061 /** Project a set of 3D points into a camera at an arbitrary 6D pose using its calibration matrix and distortion parameters (radial and tangential distortions projection model) 00062 * \param in_points_3D [IN] The list of 3D points in world coordinates (meters) to project. 00063 * \param cameraPose [IN] The pose of the camera in the world. 00064 * \param intrinsicParams [IN] The 3x3 calibration matrix. See http://www.mrpt.org/Camera_Parameters 00065 * \param distortionParams [IN] The 4-length vector with the distortion parameters [k1 k2 p1 p2]. See http://www.mrpt.org/Camera_Parameters 00066 * \param projectedPoints [OUT] The list of image coordinates (in pixels) for the projected points. At output this list is resized to the same number of input points. 00067 * \param accept_points_behind [IN] See the note below. 00068 * 00069 * \note Points "behind" the camera (which couldn't be physically seen in the real world) are marked with pixel coordinates (-1,-1) to detect them as invalid, unless accept_points_behind is true. In that case they'll be projected normally. 00070 * 00071 * \sa projectPoint_with_distortion, projectPoints_no_distortion 00072 */ 00073 void VISION_IMPEXP projectPoints_with_distortion( 00074 const std::vector<mrpt::poses::CPoint3D> &in_points_3D, 00075 const mrpt::poses::CPose3D &cameraPose, 00076 const mrpt::math::CMatrixDouble33 & intrinsicParams, 00077 const std::vector<double> & distortionParams, 00078 std::vector<mrpt::vision::TPixelCoordf> &projectedPoints, 00079 bool accept_points_behind = false 00080 ); 00081 00082 /** Project one 3D point into a camera using its calibration matrix and distortion parameters (radial and tangential distortions projection model) 00083 * \param in_point_wrt_cam [IN] The 3D point wrt the camera focus, with +Z=optical axis, +X=righthand in the image plane, +Y=downward in the image plane. 00084 * \param in_cam_params [IN] The camera parameters. See http://www.mrpt.org/Camera_Parameters 00085 * \param out_projectedPoints [OUT] The projected point, in pixel units. 00086 * \param accept_points_behind [IN] See the note below. 00087 * 00088 * \note Points "behind" the camera (which couldn't be physically seen in the real world) are marked with pixel coordinates (-1,-1) to detect them as invalid, unless accept_points_behind is true. In that case they'll be projected normally. 00089 * 00090 * \sa projectPoints_with_distortion 00091 */ 00092 void VISION_IMPEXP projectPoint_with_distortion( 00093 const mrpt::math::TPoint3D &in_point_wrt_cam, 00094 const mrpt::utils::TCamera &in_cam_params, 00095 mrpt::vision::TPixelCoordf &out_projectedPoints, 00096 bool accept_points_behind = false 00097 ); 00098 00099 void VISION_IMPEXP projectPoints_with_distortion( 00100 const std::vector<mrpt::math::TPoint3D> &P, 00101 const mrpt::utils::TCamera ¶ms, 00102 const CPose3DQuat &cameraPose, 00103 std::vector<mrpt::vision::TPixelCoordf> &pixels, 00104 bool accept_points_behind = false 00105 ); 00106 00107 00108 /** Undistort a list of points given by their pixel coordinates, provided the camera matrix and distortion coefficients. 00109 * \param srcDistortedPixels [IN] The pixel coordinates as in the distorted image. 00110 * \param dstUndistortedPixels [OUT] The computed pixel coordinates without distortion. 00111 * \param intrinsicParams [IN] The 3x3 calibration matrix. See http://www.mrpt.org/Camera_Parameters 00112 * \param distortionParams [IN] The 4-length vector with the distortion parameters [k1 k2 p1 p2]. See http://www.mrpt.org/Camera_Parameters 00113 */ 00114 void VISION_IMPEXP undistort_points( 00115 const std::vector<mrpt::vision::TPixelCoordf> &srcDistortedPixels, 00116 std::vector<mrpt::vision::TPixelCoordf> &dstUndistortedPixels, 00117 const mrpt::math::CMatrixDouble33 & intrinsicParams, 00118 const std::vector<double> & distortionParams ); 00119 00120 /** Undistort a list of points given by their pixel coordinates, provided the camera matrix and distortion coefficients. 00121 * \param inputPixels [IN] The pixel coordinates as in the distorted image. 00122 * \param dstUndistortedPixels [OUT] The computed pixel coordinates without distortion. 00123 * \param intrinsicParams [IN] The 3x3 calibration matrix. See http://www.mrpt.org/Camera_Parameters 00124 * \param distortionParams [IN] The 4-length vector with the distortion parameters [k1 k2 p1 p2]. See http://www.mrpt.org/Camera_Parameters 00125 */ 00126 //void VISION_IMPEXP undistort_points( 00127 // const std::vector<mrpt::vision::TPixelCoordf> &inputPixels, /* distorted pixels in image */ 00128 // const mrpt::math::CMatrixDouble33 &intrinsicParams, /* intrinsic parameters of the camera */ 00129 // const std::vector<double> &distortionParams, /* k1 k2 p1 p2 */ 00130 // const unsigned int &resX, /* X-resolution of the image */ 00131 // const unsigned int &resY, /* Y-resolution of the image */ 00132 // std::vector<mrpt::vision::TPixelCoordf> &outputPixels /* estimated undistorted pixels in image */ 00133 // ); 00134 00135 00136 } 00137 } 00138 } 00139 00140 #endif
| Page generated by Doxygen 1.7.1 for MRPT 0.9.1 SVN:exported at Fri Aug 6 10:31:35 UTC 2010 |
