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
00037
00038 #include <pcl/point_types.h>
00039 #include <pcl/impl/instantiate.hpp>
00040 #include <pcl/features/pfhrgb.h>
00041 #include <pcl/features/impl/pfhrgb.hpp>
00042
00044 bool
00045 pcl::computeRGBPairFeatures (const Eigen::Vector4f &p1, const Eigen::Vector4f &n1, const Eigen::Vector4i &colors1,
00046 const Eigen::Vector4f &p2, const Eigen::Vector4f &n2, const Eigen::Vector4i &colors2,
00047 float &f1, float &f2, float &f3, float &f4, float &f5, float &f6, float &f7)
00048 {
00049 Eigen::Vector4f dp2p1 = p2 - p1;
00050 dp2p1[3] = 0.0f;
00051 f4 = dp2p1.norm ();
00052
00053 if (f4 == 0.0f)
00054 {
00055 PCL_DEBUG ("Euclidean distance between points is 0!\n");
00056 f1 = f2 = f3 = f4 = 0.0f;
00057 return (false);
00058 }
00059
00060 Eigen::Vector4f n1_copy = n1,
00061 n2_copy = n2;
00062 n1_copy[3] = n2_copy[3] = 0.0f;
00063 float angle1 = n1_copy.dot (dp2p1) / f4;
00064
00065 f3 = angle1;
00066
00067
00068
00069 Eigen::Vector4f v = dp2p1.cross3 (n1_copy);
00070 v[3] = 0.0f;
00071 float v_norm = v.norm ();
00072 if (v_norm == 0.0f)
00073 {
00074 PCL_DEBUG ("Norm of Delta x U is 0!\n");
00075 f1 = f2 = f3 = f4 = 0.0f;
00076 return (false);
00077 }
00078
00079 v /= v_norm;
00080
00081 Eigen::Vector4f w = n1_copy.cross3 (v);
00082
00083
00084 v[3] = 0.0f;
00085 f2 = v.dot (n2_copy);
00086 w[3] = 0.0f;
00087
00088 f1 = atan2f (w.dot (n2_copy), n1_copy.dot (n2_copy));
00089
00090
00091
00092 f5 = (colors2[0] != 0) ? static_cast<float> (colors1[0] / colors2[0]) : 1.0f;
00093 f6 = (colors2[1] != 0) ? static_cast<float> (colors1[1] / colors2[1]) : 1.0f;
00094 f7 = (colors2[2] != 0) ? static_cast<float> (colors1[2] / colors2[2]) : 1.0f;
00095
00096
00097 if (f5 > 1.0f) f5 = - 1.0f / f5;
00098 if (f6 > 1.0f) f6 = - 1.0f / f6;
00099 if (f7 > 1.0f) f7 = - 1.0f / f7;
00100
00101 return (true);
00102 }
00103
00104
00105 #ifdef PCL_ONLY_CORE_POINT_TYPES
00106 PCL_INSTANTIATE_PRODUCT(PFHRGBEstimation, ((pcl::PointXYZRGBA)(pcl::PointXYZRGB)(pcl::PointXYZRGBNormal))
00107 ((pcl::Normal)(pcl::PointXYZRGBNormal))
00108 ((pcl::PFHRGBSignature250)))
00109 #else
00110 PCL_INSTANTIATE_PRODUCT(PFHRGBEstimation, ((pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal))
00111 (PCL_NORMAL_POINT_TYPES)
00112 ((pcl::PFHRGBSignature250)))
00113 #endif