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/recognition/quantizable_modality.h>
00039 #include <cstddef>
00040 #include <string.h>
00041
00043 pcl::QuantizableModality::QuantizableModality ()
00044 {
00045 }
00046
00048 pcl::QuantizableModality::~QuantizableModality ()
00049 {
00050 }
00051
00053 pcl::QuantizedMap::QuantizedMap ()
00054 : data_ (0), width_ (0), height_ (0)
00055 {
00056 }
00057
00059 pcl::QuantizedMap::QuantizedMap (const QuantizedMap & copy_me)
00060 : data_ (0), width_ (copy_me.width_), height_ (copy_me.height_)
00061 {
00062 data_.insert (data_.begin (), copy_me.data_.begin (), copy_me.data_.end ());
00063 }
00064
00066 pcl::QuantizedMap::QuantizedMap (const size_t width, const size_t height)
00067 : data_ (width*height), width_ (width), height_ (height)
00068 {
00069 }
00070
00072 pcl::QuantizedMap::~QuantizedMap ()
00073 {
00074 }
00075
00077 void
00078 pcl::QuantizedMap::
00079 resize (const size_t width, const size_t height)
00080 {
00081 data_.resize (width*height);
00082 width_ = width;
00083 height_ = height;
00084 }
00085
00087 void
00088 pcl::QuantizedMap::
00089 spreadQuantizedMap (const QuantizedMap & input_map, QuantizedMap & output_map, const size_t spreading_size)
00090 {
00091
00092 const size_t width = input_map.getWidth ();
00093 const size_t height = input_map.getHeight ();
00094 const size_t half_spreading_size = spreading_size / 2;
00095
00096 QuantizedMap tmp_map (width, height);
00097 output_map.resize (width, height);
00098
00099 for (size_t row_index = 0; row_index < height-spreading_size-1; ++row_index)
00100 {
00101 for (size_t col_index = 0; col_index < width-spreading_size-1; ++col_index)
00102 {
00103 unsigned char value = 0;
00104 const unsigned char * data_ptr = &(input_map (col_index, row_index));
00105 for (size_t spreading_index = 0; spreading_index < spreading_size; ++spreading_index, ++data_ptr)
00106 {
00107 value |= *data_ptr;
00108 }
00109
00110 tmp_map (col_index + half_spreading_size, row_index) = value;
00111 }
00112 }
00113
00114 for (size_t row_index = 0; row_index < height-spreading_size-1; ++row_index)
00115 {
00116 for (size_t col_index = 0; col_index < width-spreading_size-1; ++col_index)
00117 {
00118 unsigned char value = 0;
00119 const unsigned char * data_ptr = &(tmp_map (col_index, row_index));
00120 for (size_t spreading_index = 0; spreading_index < spreading_size; ++spreading_index, data_ptr += width)
00121 {
00122 value |= *data_ptr;
00123 }
00124
00125 output_map (col_index, row_index + half_spreading_size) = value;
00126 }
00127 }
00128 }