Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include <pcl/pcl_macros.h>
00037 #include <pcl/common/eigen.h>
00038
00039 namespace pcl
00040 {
00041
00043 void
00044 RangeImageSpherical::calculate3DPoint (float image_x, float image_y, float range, Eigen::Vector3f& point) const
00045 {
00046 float angle_x, angle_y;
00047 getAnglesFromImagePoint (image_x, image_y, angle_x, angle_y);
00048
00049 float cosY = cosf (angle_y);
00050 point = Eigen::Vector3f (range * sinf (angle_x) * cosY, range * sinf (angle_y), range * cosf (angle_x)*cosY);
00051 point = to_world_system_ * point;
00052 }
00053
00055 inline void
00056 RangeImageSpherical::getImagePoint (const Eigen::Vector3f& point, float& image_x, float& image_y, float& range) const
00057 {
00058 Eigen::Vector3f transformedPoint = to_range_image_system_ * point;
00059 range = transformedPoint.norm ();
00060 float angle_x = atan2LookUp (transformedPoint[0], transformedPoint[2]),
00061 angle_y = asinLookUp (transformedPoint[1]/range);
00062 getImagePointFromAngles (angle_x, angle_y, image_x, image_y);
00063 }
00065 void
00066 RangeImageSpherical::getAnglesFromImagePoint (float image_x, float image_y, float& angle_x, float& angle_y) const
00067 {
00068 angle_y = (image_y+static_cast<float> (image_offset_y_))*angular_resolution_y_ - 0.5f*static_cast<float> (M_PI);
00069 angle_x = ((image_x+ static_cast<float> (image_offset_x_))*angular_resolution_x_ - static_cast<float> (M_PI));
00070 }
00072 void
00073 RangeImageSpherical::getImagePointFromAngles (float angle_x, float angle_y, float& image_x, float& image_y) const
00074 {
00075 image_x = (angle_x + static_cast<float> (M_PI))*angular_resolution_x_reciprocal_ - static_cast<float> (image_offset_x_);
00076 image_y = (angle_y + 0.5f*static_cast<float> (M_PI))*angular_resolution_y_reciprocal_ - static_cast<float> (image_offset_y_);
00077 }
00078 }