Main MRPT website > C++ reference for MRPT 1.5.5
COccupancyGridMap2D_io.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "maps-precomp.h" // Precomp header
11 
12 #include <mrpt/system/os.h>
13 #include <mrpt/math/CMatrix.h>
14 #include <mrpt/utils/CStream.h>
16 #include <mrpt/utils/round.h> // round()
18 #include <mrpt/random.h>
19 
20 using namespace mrpt;
21 using namespace mrpt::maps;
22 using namespace mrpt::math;
23 using namespace mrpt::obs;
24 using namespace mrpt::random;
25 using namespace mrpt::utils;
26 using namespace mrpt::poses;
27 using namespace mrpt::system;
28 using namespace std;
29 
30 
31 /*---------------------------------------------------------------
32  saveAsBitmapFile
33  ---------------------------------------------------------------*/
35 {
37 
38  CImage img;
39  getAsImage(img);
40  return img.saveToFile(file);
41 
42  MRPT_END
43 }
44 
45 
46 
47 
48 /*---------------------------------------------------------------
49  writeToStream
50  Implements the writing to a CStream capability of
51  CSerializable objects
52  ---------------------------------------------------------------*/
54 {
55  if (version)
56  *version = 6;
57  else
58  {
59  // Version 3: Change to log-odds. The only change is in the loader, when translating
60  // from older versions.
61 
62  // Version 2: Save OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS/16BITS
63 #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
64  out << uint8_t(8);
65 #else
66  out << uint8_t(16);
67 #endif
68 
69  out << size_x << size_y << x_min << x_max << y_min << y_max << resolution;
70  ASSERT_(size_x*size_y==map.size());
71 
72 #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
73  out.WriteBuffer(&map[0], sizeof(map[0])*size_x*size_y);
74 #else
75  out.WriteBufferFixEndianness(&map[0], size_x*size_y);
76 #endif
77 
78  // insertionOptions:
79  out << insertionOptions.mapAltitude
80  << insertionOptions.useMapAltitude
81  << insertionOptions.maxDistanceInsertion
82  << insertionOptions.maxOccupancyUpdateCertainty
83  << insertionOptions.considerInvalidRangesAsFreeSpace
84  << insertionOptions.decimation
85  << insertionOptions.horizontalTolerance;
86 
87  // Likelihood:
88  out << (int32_t)likelihoodOptions.likelihoodMethod
89  << likelihoodOptions.LF_stdHit
90  << likelihoodOptions.LF_zHit
91  << likelihoodOptions.LF_zRandom
92  << likelihoodOptions.LF_maxRange
93  << likelihoodOptions.LF_decimation
94  << likelihoodOptions.LF_maxCorrsDistance
95  << likelihoodOptions.LF_alternateAverageMethod
96  << likelihoodOptions.MI_exponent
97  << likelihoodOptions.MI_skip_rays
98  << likelihoodOptions.MI_ratio_max_distance
99  << likelihoodOptions.rayTracing_useDistanceFilter
100  << likelihoodOptions.rayTracing_decimation
101  << likelihoodOptions.rayTracing_stdHit
102  << likelihoodOptions.consensus_takeEachRange
103  << likelihoodOptions.consensus_pow
104  << likelihoodOptions.OWA_weights
105  << likelihoodOptions.enableLikelihoodCache;
106 
107  // Insertion as 3D:
108  out << genericMapParams; // v6
109 
110  // Version 4:
111  out << insertionOptions.CFD_features_gaussian_size
112  << insertionOptions.CFD_features_median_size;
113 
114  // Version: 5;
115  out << insertionOptions.wideningBeamsWithDistance;
116 
117  }
118 }
119 
120 /*---------------------------------------------------------------
121  readFromStream
122  ---------------------------------------------------------------*/
124 {
125  m_is_empty = false;
126 
127  switch(version)
128  {
129  case 0:
130  case 1:
131  case 2:
132  case 3:
133  case 4:
134  case 5:
135  case 6:
136  {
137 # ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
138  const uint8_t MyBitsPerCell = 8;
139 # else
140  const uint8_t MyBitsPerCell = 16;
141 # endif
142 
143  uint8_t bitsPerCellStream;
144 
145  // Version 2: OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS/16BITS
146  if (version>=2)
147  in >> bitsPerCellStream;
148  else bitsPerCellStream = MyBitsPerCell; // Old versinons: hope it's the same...
149 
150  uint32_t new_size_x,new_size_y;
151  float new_x_min,new_x_max,new_y_min,new_y_max;
152  float new_resolution;
153 
154  //resetFeaturesCache();
155 
156  in >> new_size_x >> new_size_y >> new_x_min >> new_x_max >> new_y_min >> new_y_max >> new_resolution;
157 
158  setSize(new_x_min,new_x_max,new_y_min,new_y_max,new_resolution,0.5);
159 
160  ASSERT_(size_x*size_y==map.size());
161 
162  if (bitsPerCellStream==MyBitsPerCell)
163  {
164  // Perfect:
165  #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
166  in.ReadBuffer(&map[0], sizeof(map[0])*map.size());
167  #else
168  in.ReadBufferFixEndianness(&map[0], map.size());
169  #endif
170  }
171  else
172  {
173  // We must do a conversion...
174 # ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
175  // We are 8-bit, stream is 16-bit
176  ASSERT_(bitsPerCellStream==16);
177  std::vector<uint16_t> auxMap( map.size() );
178  in.ReadBuffer(&auxMap[0], sizeof(auxMap[0])*auxMap.size());
179 
180  size_t i, N = map.size();
181  uint8_t *ptrTrg = (uint8_t*)&map[0];
182  const uint16_t *ptrSrc = (const uint16_t*)&auxMap[0];
183  for (i=0;i<N;i++)
184  *ptrTrg++ = (*ptrSrc++) >> 8;
185 # else
186  // We are 16-bit, stream is 8-bit
187  ASSERT_(bitsPerCellStream==8);
188  std::vector<uint8_t> auxMap( map.size() );
189  in.ReadBuffer(&auxMap[0], sizeof(auxMap[0])*auxMap.size());
190 
191  size_t i, N = map.size();
192  uint16_t *ptrTrg = (uint16_t*)&map[0];
193  const uint8_t *ptrSrc = (const uint8_t*)&auxMap[0];
194  for (i=0;i<N;i++)
195  *ptrTrg++ = (*ptrSrc++) << 8;
196 # endif
197  }
198 
199  // If we are converting an old dump, convert from probabilities to log-odds:
200  if (version<3)
201  {
202  size_t i, N = map.size();
203  cellType *ptr = &map[0];
204  for (i=0;i<N;i++)
205  {
206  double p = cellTypeUnsigned(*ptr) * (1.0f/0xFF);
207  if (p<0)
208  p=0;
209  if (p>1)
210  p=1;
211  *ptr++ = p2l( p );
212  }
213  }
214 
215  // For the precomputed likelihood trick:
216  precomputedLikelihoodToBeRecomputed = true;
217 
218  if (version>=1)
219  {
220  // insertionOptions:
221  in >> insertionOptions.mapAltitude
222  >> insertionOptions.useMapAltitude
223  >> insertionOptions.maxDistanceInsertion
224  >> insertionOptions.maxOccupancyUpdateCertainty
225  >> insertionOptions.considerInvalidRangesAsFreeSpace
226  >> insertionOptions.decimation
227  >> insertionOptions.horizontalTolerance;
228 
229  // Likelihood:
230  int32_t i;
231  in >> i; likelihoodOptions.likelihoodMethod = static_cast<TLikelihoodMethod>(i);
232  in >> likelihoodOptions.LF_stdHit
233  >> likelihoodOptions.LF_zHit
234  >> likelihoodOptions.LF_zRandom
235  >> likelihoodOptions.LF_maxRange
236  >> likelihoodOptions.LF_decimation
237  >> likelihoodOptions.LF_maxCorrsDistance
238  >> likelihoodOptions.LF_alternateAverageMethod
239  >> likelihoodOptions.MI_exponent
240  >> likelihoodOptions.MI_skip_rays
241  >> likelihoodOptions.MI_ratio_max_distance
242  >> likelihoodOptions.rayTracing_useDistanceFilter
243  >> likelihoodOptions.rayTracing_decimation
244  >> likelihoodOptions.rayTracing_stdHit
245  >> likelihoodOptions.consensus_takeEachRange
246  >> likelihoodOptions.consensus_pow
247  >> likelihoodOptions.OWA_weights
248  >> likelihoodOptions.enableLikelihoodCache;
249 
250  // Insertion as 3D:
251  if (version>=6)
252  in >> genericMapParams;
253  else
254  {
255  bool disableSaveAs3DObject;
256  in >> disableSaveAs3DObject;
257  genericMapParams.enableSaveAs3DObject = !disableSaveAs3DObject;
258  }
259  }
260 
261  if (version>=4)
262  {
263  in >> insertionOptions.CFD_features_gaussian_size
264  >> insertionOptions.CFD_features_median_size;
265  }
266 
267  if (version>=5)
268  {
269  in >> insertionOptions.wideningBeamsWithDistance;
270  }
271 
272  } break;
273  default:
275 
276  };
277 }
278 
279 /*---------------------------------------------------------------
280  loadFromBitmapFile
281  Load a 8-bits, black & white bitmap file as a grid map. It will be loaded such as coordinates (0,0) falls just in the middle of map.
282 \param file The file to be loaded.
283 \param resolution The size of a pixel (cell), in meters. Recall cells are always squared, so just a dimension is needed.
284 \return False on any error.
285  ---------------------------------------------------------------*/
287  const std::string &file,
288  float resolution,
289  float xCentralPixel,
290  float yCentralPixel)
291 {
292  MRPT_START
293 
294  CImage imgFl;
295  if (!imgFl.loadFromFile(file,0))
296  return false;
297 
298  m_is_empty = false;
299  return loadFromBitmap(imgFl,resolution, xCentralPixel, yCentralPixel);
300 
301  MRPT_END
302 }
303 
304 /*---------------------------------------------------------------
305  loadFromBitmap
306  ---------------------------------------------------------------*/
307 bool COccupancyGridMap2D::loadFromBitmap(const mrpt::utils::CImage &imgFl, float resolution, float xCentralPixel, float yCentralPixel)
308 {
309  MRPT_START
310 
311  // For the precomputed likelihood trick:
312  precomputedLikelihoodToBeRecomputed = true;
313 
314  size_t bmpWidth = imgFl.getWidth();
315  size_t bmpHeight = imgFl.getHeight();
316 
317  if (size_x!=bmpWidth || size_y!=bmpHeight)
318  {
319  // Middle of bitmap?
320  if (xCentralPixel<-1 || yCentralPixel<=-1)
321  {
322  xCentralPixel = imgFl.getWidth() / 2.0f;
323  yCentralPixel = imgFl.getHeight() / 2.0f;
324  }
325 
326  // Resize grid:
327  float new_x_max = (imgFl.getWidth() - xCentralPixel) * resolution;
328  float new_x_min = - xCentralPixel * resolution;
329  float new_y_max = (imgFl.getHeight() - yCentralPixel) * resolution;
330  float new_y_min = - yCentralPixel * resolution;
331 
332  setSize(new_x_min,new_x_max,new_y_min,new_y_max,resolution);
333  }
334 
335  // And load cells content:
336  for (size_t x=0;x<bmpWidth;x++)
337  for (size_t y=0;y<bmpHeight;y++)
338  {
339  float f = imgFl.getAsFloat(x,bmpHeight-1-y);
340  f = std::max(0.01f,f);
341  f = std::min(0.99f,f);
342  setCell(x,y,f);
343  }
344 
345  m_is_empty = false;
346  return true;
347 
348  MRPT_END
349 }
350 
351 
352 
353 /*---------------------------------------------------------------
354  saveAsBitmapTwoMapsWithCorrespondences
355  ---------------------------------------------------------------*/
357  const std::string &fileName,
358  const COccupancyGridMap2D *m1,
359  const COccupancyGridMap2D *m2,
360  const TMatchingPairList &corrs)
361 {
362  MRPT_START
363 
364  CImage img1,img2;
365  CImage img(10,10,3,true);
366  unsigned int i,n , Ay1, Ay2;
367  unsigned int px, py;
368 
369  // The individual maps:
370  // ---------------------------------------------
371  m1->getAsImage( img1, false );
372  m2->getAsImage( img2, false );
373  unsigned int lx1 = img1.getWidth();
374  unsigned int ly1 = img1.getHeight();
375 
376  unsigned int lx2 = img2.getWidth();
377  unsigned int ly2 = img2.getHeight();
378 
379  // The map with the lowest height has to be vertically aligned:
380  if (ly1>ly2)
381  {
382  Ay1 = 0;
383  Ay2 = (ly1-ly2)/2;
384  }
385  else
386  {
387  Ay2 = 0;
388  Ay1 = (ly2-ly1)/2;
389  }
390 
391 
392  // Compute the size of the composite image:
393  // ---------------------------------------------
394  img.resize(lx1 + lx2 + 1, max(ly1,ly2), 3, true );
395  img.filledRectangle(0,0,img.getWidth()-1,img.getHeight()-1, TColor::black ); // background: black
396  img.drawImage(0,Ay1,img1);
397  img.drawImage(lx1+1,Ay2,img2);
398 
399  // Draw the features:
400  // ---------------------------------------------
401  n = corrs.size();
402  TColor lineColor = TColor::black;
403  for (i=0;i<n;i++)
404  {
405  // In M1:
406  px = m1->x2idx( corrs[i].this_x );
407  py = Ay1+ly1-1- m1->y2idx( corrs[i].this_y );
408  img.rectangle(px-10,py-10,px+10,py+10,lineColor);
409  img.rectangle(px-11,py-11,px+11,py+11,lineColor);
410 
411  // In M2:
412  px = lx1+1 + m2->x2idx( corrs[i].other_x );
413  py = Ay2+ly2-1- m2->y2idx( corrs[i].other_y );
414  img.rectangle(px-10,py-10,px+10,py+10,lineColor);
415  img.rectangle(px-11,py-11,px+11,py+11,lineColor);
416  }
417 
418  // Draw the correspondences as lines:
419  // ---------------------------------------------
420  for (i=0;i<n;i++)
421  {
422  lineColor = TColor(
423  static_cast<long>(randomGenerator.drawUniform(0,255.0f)),
424  static_cast<long>(randomGenerator.drawUniform(0,255.0f)),
425  static_cast<long>(randomGenerator.drawUniform(0,255.0f)) );
426 
427  img.line(
428  m1->x2idx( corrs[i].this_x ),
429 // lx1+1+ m1->x2idx( corrs[i].this_x ),
430  Ay1+ly1-1- m1->y2idx( corrs[i].this_y ),
431  lx1+1+ m2->x2idx( corrs[i].other_x ),
432  Ay2+ly2-1-m2->y2idx( corrs[i].other_y ),
433  lineColor);
434  } // i
435 
436  return img.saveToFile(fileName.c_str() );
437 
438  MRPT_END
439 }
440 
441 /*---------------------------------------------------------------
442  saveAsEMFTwoMapsWithCorrespondences
443  ---------------------------------------------------------------*/
445  const std::string &fileName,
446  const COccupancyGridMap2D *m1,
447  const COccupancyGridMap2D *m2,
448  const TMatchingPairList &corrs)
449 {
450  MRPT_START
451 
452  CEnhancedMetaFile emf(fileName,1);
453  CImage img1,img2;
454  TColor lineColor;
455  unsigned int i, Ay1, Ay2;
456  unsigned int px, py;
457 
458 
459  lineColor = TColor::red;
460 
461  // The individual maps:
462  // ---------------------------------------------
463 #ifdef MRPT_OS_WINDOWS
464  m1->getAsImage( img1, true );
465  m2->getAsImage( img2, true );
466 #else
467  m1->getAsImage( img1, false ); // Linux: emulated EMF is different.
468  m2->getAsImage( img2, false );
469 #endif
470  unsigned int lx1 = img1.getWidth();
471  unsigned int ly1 = img1.getHeight();
472  //unsigned int lx2 = img2.getWidth();
473  unsigned int ly2 = img2.getHeight();
474 
475  // The map with the lowest height has to be vertically aligned:
476  if (ly1>ly2)
477  {
478  Ay1 = 0;
479  Ay2 = (ly1-ly2)/2;
480  }
481  else
482  {
483  Ay2 = 0;
484  Ay1 = (ly2-ly1)/2;
485  }
486 
487 
488  // Draw the pair of maps:
489  // ---------------------------------------------
490  emf.drawImage(0,Ay1,img1);
491  emf.drawImage(lx1+1,Ay2,img2);
492 
493  // Draw the features:
494  // ---------------------------------------------
495  const unsigned int n = corrs.size();
496  lineColor = TColor::black;
497  for (i=0;i<n;i++)
498  {
499  // In M1:
500  px = m1->x2idx( corrs[i].this_x );
501  py = Ay1+ly1-1- m1->y2idx( corrs[i].this_y );
502  emf.rectangle(px-10,py-10,px+10,py+10,lineColor);
503  emf.rectangle(px-11,py-11,px+11,py+11,lineColor);
504 
505  // In M2:
506  px = lx1+1 + m2->x2idx( corrs[i].other_x );
507  py = Ay2+ly2-1- m2->y2idx( corrs[i].other_y );
508  emf.rectangle(px-10,py-10,px+10,py+10,lineColor);
509  emf.rectangle(px-11,py-11,px+11,py+11,lineColor);
510  }
511 
512 /** /
513  // Draw the correspondences as lines:
514  // ---------------------------------------------
515  for (i=0;i<n;i++)
516  {
517  lineColor =
518  ((unsigned long)RandomUni(0,255.0f)) +
519  (((unsigned long)RandomUni(0,255.0f)) << 8 ) +
520  (((unsigned long)RandomUni(0,255.0f)) << 16 );
521 
522  emf.line(
523  m1->x2idx( corrs[i].this_x ),
524  Ay1+ly1-1- m1->y2idx( corrs[i].this_y ),
525  lx1+1+ m2->x2idx( corrs[i].other_x ),
526  Ay2+ly2-1-m2->y2idx( corrs[i].other_y ),
527  lineColor);
528  } // i
529 / **/
530 
531  // Draw the correspondences as text labels:
532  // ---------------------------------------------
533  char str[100];
534  for (i=0;i<n;i++)
535  {
536  os::sprintf(str,100,"%i",i);
537 
538  emf.textOut(
539  m1->x2idx( corrs[i].this_x ) - 10 ,
540  Ay1+ly1-1- m1->y2idx( corrs[i].this_y ) - 25,
541  str, TColor::black );
542 
543  emf.textOut(
544  lx1+1+ m2->x2idx( corrs[i].other_x ) - 10,
545  Ay2+ly2-1-m2->y2idx( corrs[i].other_y ) - 25,
546  str,TColor::black );
547  } // i
548 
549  return true;
550 
551  MRPT_END
552 }
553 
554 
555 /*---------------------------------------------------------------
556  auxParticleFilterCleanUp
557  ---------------------------------------------------------------*/
559  const std::string &filNamePrefix
560  ) const
561 {
562  std::string fil( filNamePrefix + std::string(".png") );
563  saveAsBitmapFile( fil );
564 
565  fil = filNamePrefix + std::string("_limits.txt");
566  CMatrix LIMITS(1,4);
567  LIMITS(0,0) = x_min;
568  LIMITS(0,1) = x_max;
569  LIMITS(0,2) = y_min;
570  LIMITS(0,3) = y_max;
571  LIMITS.saveToTextFile( fil, MATRIX_FORMAT_FIXED, false /* add mrpt header */, "% Grid limits: [x_min x_max y_min y_max]\n" );
572 }
573 
574 
A namespace of pseudo-random numbers genrators of diferent distributions.
float getAsFloat(unsigned int col, unsigned int row, unsigned int channel) const
Returns the contents of a given pixel at the desired channel, in float format: [0,255]->[0,1] The coordinate origin is pixel(0,0)=top-left corner of the image.
Definition: CImage.cpp:942
double drawUniform(const double Min, const double Max)
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, scaled to the selected range.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
#define min(a, b)
unsigned __int16 uint16_t
Definition: rptypes.h:46
unsigned char red[10]
Definition: PbMapMaker.cpp:976
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Definition: math_frwds.h:29
static bool saveAsBitmapTwoMapsWithCorrespondences(const std::string &fileName, const COccupancyGridMap2D *m1, const COccupancyGridMap2D *m2, const mrpt::utils::TMatchingPairList &corrs)
Saves a composite image with two gridmaps and lines representing a set of correspondences between the...
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:101
BASE_IMPEXP CRandomGenerator randomGenerator
A static instance of a CRandomGenerator class, for use in single-thread applications.
TLikelihoodMethod
The type for selecting a likelihood computation method.
GLenum GLsizei n
Definition: glext.h:4618
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
Definition: CStream.cpp:67
STL namespace.
void getAsImage(utils::CImage &img, bool verticalFlip=false, bool forceRGB=false, bool tricolor=false) const
Returns the grid as a 8-bit graylevel image, where each pixel is a cell (output image is RGB only if ...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
unsigned char uint8_t
Definition: rptypes.h:43
void WriteBufferFixEndianness(const T *ptr, size_t ElementCount)
Writes a sequence of elemental datatypes, taking care of reordering their bytes from the running arch...
Definition: CStream.h:139
bool saveAsBitmapFile(const std::string &file) const
Saves the gridmap as a graphical file (BMP,PNG,...).
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
#define MRPT_END
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
GLint GLvoid * img
Definition: glext.h:3645
bool loadFromBitmapFile(const std::string &file, float resolution, float xCentralPixel=-1, float yCentralPixel=-1)
Load the gridmap from a image in a file (the format can be any supported by CImage::loadFromFile).
A list of TMatchingPair.
Definition: TMatchingPair.h:78
A RGB color - 8bit.
Definition: TColor.h:26
This namespace contains representation of robot actions and observations.
EIGEN_STRONG_INLINE void setSize(size_t row, size_t col)
Changes the size of matrix, maintaining its previous content as possible and padding with zeros where...
int version
Definition: mrpt_jpeglib.h:898
GLsizei const GLchar ** string
Definition: glext.h:3919
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
static bool saveAsEMFTwoMapsWithCorrespondences(const std::string &fileName, const COccupancyGridMap2D *m1, const COccupancyGridMap2D *m2, const mrpt::utils::TMatchingPairList &corrs)
Saves a composite image with two gridmaps and numbers for the correspondences between them...
A class for storing an occupancy grid map.
#define MRPT_START
__int32 int32_t
Definition: rptypes.h:48
This class represents a Windows Enhanced Meta File (EMF) for generating and saving graphics...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLuint in
Definition: glext.h:6301
bool loadFromBitmap(const mrpt::utils::CImage &img, float resolution, float xCentralPixel=-1, float yCentralPixel=-1)
Load the gridmap from a image in a file (the format can be any supported by CImage::loadFromFile).
#define ASSERT_(f)
GLenum GLint GLint y
Definition: glext.h:3516
int BASE_IMPEXP sprintf(char *buf, size_t bufSize, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
Definition: os.cpp:191
GLenum GLint x
Definition: glext.h:3516
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrix.h:30
unsigned __int32 uint32_t
Definition: rptypes.h:49
GLfloat GLfloat p
Definition: glext.h:5587
int16_t cellType
The type of the map cells:
size_t getWidth() const MRPT_OVERRIDE
Returns the width of the image in pixels.
Definition: CImage.cpp:855
int x2idx(float x) const
Transform a coordinate value into a cell index.
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const MRPT_OVERRIDE
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >...
fixed floating point &#39;f&#39;
Definition: math_frwds.h:66
size_t getHeight() const MRPT_OVERRIDE
Returns the height of the image in pixels.
Definition: CImage.cpp:884



Page generated by Doxygen 1.8.14 for MRPT 1.5.5 Git: e06b63dbf Fri Dec 1 14:41:11 2017 +0100 at lun oct 28 01:31:35 CET 2019