MRPT  2.0.4
COccupancyGridMap2D_io.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "maps-precomp.h" // Precomp header
11 
12 #include <mrpt/config.h>
13 #include <mrpt/core/round.h> // round()
16 #include <mrpt/math/CMatrixF.h>
17 #include <mrpt/random.h>
19 #include <mrpt/system/os.h>
20 #include <iostream>
21 
22 using namespace mrpt;
23 using namespace mrpt::maps;
24 using namespace mrpt::tfest;
25 using namespace mrpt::math;
26 using namespace mrpt::obs;
27 using namespace mrpt::random;
28 using namespace mrpt::poses;
29 using namespace mrpt::img;
30 using namespace mrpt::system;
31 using namespace std;
32 
33 /*---------------------------------------------------------------
34  saveAsBitmapFile
35  ---------------------------------------------------------------*/
36 bool COccupancyGridMap2D::saveAsBitmapFile(const std::string& file) const
37 {
39 #if MRPT_HAS_OPENCV
40 
41  CImage img;
42  getAsImage(img);
43  return img.saveToFile(file);
44 
45 #else
46  std::cerr << "[COccupancyGridMap2D::saveAsBitmapFile] Doing nothing, since "
47  "MRPT was built without OpenCV.\n";
48  return true;
49 #endif
50  MRPT_END
51 }
52 
53 uint8_t COccupancyGridMap2D::serializeGetVersion() const { return 6; }
55 {
56 // Version 3: Change to log-odds. The only change is in the loader, when
57 // translating
58 // from older versions.
59 
60 // Version 2: Save OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS/16BITS
61 #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
62  out << uint8_t(8);
63 #else
64  out << uint8_t(16);
65 #endif
66 
67  out << size_x << size_y << x_min << x_max << y_min << y_max << resolution;
68  ASSERT_(size_x * size_y == map.size());
69 
70 #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
71  out.WriteBuffer(&map[0], sizeof(map[0]) * size_x * size_y);
72 #else
73  out.WriteBufferFixEndianness(&map[0], size_x * size_y);
74 #endif
75 
76  // insertionOptions:
77  out << insertionOptions.mapAltitude << insertionOptions.useMapAltitude
78  << insertionOptions.maxDistanceInsertion
79  << insertionOptions.maxOccupancyUpdateCertainty
80  << insertionOptions.considerInvalidRangesAsFreeSpace
81  << insertionOptions.decimation << insertionOptions.horizontalTolerance;
82 
83  // Likelihood:
84  out << (int32_t)likelihoodOptions.likelihoodMethod
85  << likelihoodOptions.LF_stdHit << likelihoodOptions.LF_zHit
86  << likelihoodOptions.LF_zRandom << likelihoodOptions.LF_maxRange
87  << likelihoodOptions.LF_decimation
88  << likelihoodOptions.LF_maxCorrsDistance
89  << likelihoodOptions.LF_alternateAverageMethod
90  << likelihoodOptions.MI_exponent << likelihoodOptions.MI_skip_rays
91  << likelihoodOptions.MI_ratio_max_distance
92  << likelihoodOptions.rayTracing_useDistanceFilter
93  << likelihoodOptions.rayTracing_decimation
94  << likelihoodOptions.rayTracing_stdHit
95  << likelihoodOptions.consensus_takeEachRange
96  << likelihoodOptions.consensus_pow << likelihoodOptions.OWA_weights
97  << likelihoodOptions.enableLikelihoodCache;
98 
99  // Insertion as 3D:
100  out << genericMapParams; // v6
101 
102  // Version 4:
103  out << insertionOptions.CFD_features_gaussian_size
104  << insertionOptions.CFD_features_median_size;
105 
106  // Version: 5;
107  out << insertionOptions.wideningBeamsWithDistance;
108 }
109 
111  mrpt::serialization::CArchive& in, uint8_t version)
112 {
113  m_is_empty = false;
114 
115  switch (version)
116  {
117  case 0:
118  case 1:
119  case 2:
120  case 3:
121  case 4:
122  case 5:
123  case 6:
124  {
125 #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
126  const uint8_t MyBitsPerCell = 8;
127 #else
128  const uint8_t MyBitsPerCell = 16;
129 #endif
130 
131  uint8_t bitsPerCellStream;
132 
133  // Version 2: OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS/16BITS
134  if (version >= 2)
135  in >> bitsPerCellStream;
136  else
137  bitsPerCellStream =
138  MyBitsPerCell; // Old versinons: hope it's the same...
139 
140  uint32_t new_size_x, new_size_y;
141  float new_x_min, new_x_max, new_y_min, new_y_max;
142  float new_resolution;
143 
144  in >> new_size_x >> new_size_y >> new_x_min >> new_x_max >>
145  new_y_min >> new_y_max >> new_resolution;
146 
147  setSize(
148  new_x_min, new_x_max, new_y_min, new_y_max, new_resolution,
149  0.5);
150 
151  ASSERT_(size_x * size_y == map.size());
152 
153  if (bitsPerCellStream == MyBitsPerCell)
154  {
155 // Perfect:
156 #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
157  in.ReadBuffer(&map[0], sizeof(map[0]) * map.size());
158 #else
159  in.ReadBufferFixEndianness(&map[0], map.size());
160 #endif
161  }
162  else
163  {
164 // We must do a conversion...
165 #ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
166  // We are 8-bit, stream is 16-bit
167  ASSERT_(bitsPerCellStream == 16);
168  std::vector<uint16_t> auxMap(map.size());
169  in.ReadBuffer(&auxMap[0], sizeof(auxMap[0]) * auxMap.size());
170 
171  size_t i, N = map.size();
172  auto* ptrTrg = (uint8_t*)&map[0];
173  const auto* ptrSrc = (const uint16_t*)&auxMap[0];
174  for (i = 0; i < N; i++) *ptrTrg++ = (*ptrSrc++) >> 8;
175 #else
176  // We are 16-bit, stream is 8-bit
177  ASSERT_(bitsPerCellStream == 8);
178  std::vector<uint8_t> auxMap(map.size());
179  in.ReadBuffer(&auxMap[0], sizeof(auxMap[0]) * auxMap.size());
180 
181  size_t i, N = map.size();
182  uint16_t* ptrTrg = (uint16_t*)&map[0];
183  const uint8_t* ptrSrc = (const uint8_t*)&auxMap[0];
184  for (i = 0; i < N; i++) *ptrTrg++ = (*ptrSrc++) << 8;
185 #endif
186  }
187 
188  // If we are converting an old dump, convert from probabilities to
189  // log-odds:
190  if (version < 3)
191  {
192  size_t i, N = map.size();
193  cellType* ptr = &map[0];
194  for (i = 0; i < N; i++)
195  {
196  double p = cellTypeUnsigned(*ptr) * (1.0f / 0xFF);
197  if (p < 0) p = 0;
198  if (p > 1) p = 1;
199  *ptr++ = p2l(p);
200  }
201  }
202 
203  // For the precomputed likelihood trick:
204  m_likelihoodCacheOutDated = true;
205 
206  if (version >= 1)
207  {
208  // insertionOptions:
209  in >> insertionOptions.mapAltitude >>
210  insertionOptions.useMapAltitude >>
211  insertionOptions.maxDistanceInsertion >>
212  insertionOptions.maxOccupancyUpdateCertainty >>
213  insertionOptions.considerInvalidRangesAsFreeSpace >>
214  insertionOptions.decimation >>
215  insertionOptions.horizontalTolerance;
216 
217  // Likelihood:
218  int32_t i;
219  in >> i;
220  likelihoodOptions.likelihoodMethod =
221  static_cast<TLikelihoodMethod>(i);
222  in >> likelihoodOptions.LF_stdHit >>
223  likelihoodOptions.LF_zHit >> likelihoodOptions.LF_zRandom >>
224  likelihoodOptions.LF_maxRange >>
225  likelihoodOptions.LF_decimation >>
226  likelihoodOptions.LF_maxCorrsDistance >>
227  likelihoodOptions.LF_alternateAverageMethod >>
228  likelihoodOptions.MI_exponent >>
229  likelihoodOptions.MI_skip_rays >>
230  likelihoodOptions.MI_ratio_max_distance >>
231  likelihoodOptions.rayTracing_useDistanceFilter >>
232  likelihoodOptions.rayTracing_decimation >>
233  likelihoodOptions.rayTracing_stdHit >>
234  likelihoodOptions.consensus_takeEachRange >>
235  likelihoodOptions.consensus_pow >>
236  likelihoodOptions.OWA_weights >>
237  likelihoodOptions.enableLikelihoodCache;
238 
239  // Insertion as 3D:
240  if (version >= 6)
241  in >> genericMapParams;
242  else
243  {
244  bool disableSaveAs3DObject;
245  in >> disableSaveAs3DObject;
246  genericMapParams.enableSaveAs3DObject =
247  !disableSaveAs3DObject;
248  }
249  }
250 
251  if (version >= 4)
252  {
253  in >> insertionOptions.CFD_features_gaussian_size >>
254  insertionOptions.CFD_features_median_size;
255  }
256 
257  if (version >= 5)
258  {
259  in >> insertionOptions.wideningBeamsWithDistance;
260  }
261  }
262  break;
263  default:
265  };
266 }
267 
269  const std::string& file, float res, const TPoint2D& origin)
270 {
271  MRPT_START
272 
273  CImage imgFl;
274  if (!imgFl.loadFromFile(file, 0)) return false;
275 
276  m_is_empty = false;
277  return loadFromBitmap(imgFl, res, origin);
278 
279  MRPT_END
280 }
281 
283  const mrpt::img::CImage& imgFl, float res,
284  const mrpt::math::TPoint2D& origin_)
285 {
286  MRPT_START
287 
288  // For the precomputed likelihood trick:
289  m_likelihoodCacheOutDated = true;
290 
291  size_t bmpWidth = imgFl.getWidth();
292  size_t bmpHeight = imgFl.getHeight();
293 
294  if (size_x != bmpWidth || size_y != bmpHeight)
295  {
296  auto origin = origin_;
297  // Middle of bitmap?
298  if (origin.x == std::numeric_limits<double>::max())
299  {
300  origin = mrpt::math::TPoint2D(
301  imgFl.getWidth() / 2.0, imgFl.getHeight() / 2.0);
302  }
303 
304  // Resize grid:
305  float new_x_max = (imgFl.getWidth() - origin.x) * res;
306  float new_x_min = -origin.x * res;
307  float new_y_max = (imgFl.getHeight() - origin.y) * res;
308  float new_y_min = -origin.y * res;
309 
310  setSize(new_x_min, new_x_max, new_y_min, new_y_max, res);
311  }
312 
313  // And load cells content:
314  for (size_t x = 0; x < bmpWidth; x++)
315  for (size_t y = 0; y < bmpHeight; y++)
316  {
317  float f = imgFl.getAsFloat(x, bmpHeight - 1 - y);
318  f = std::max(0.01f, f);
319  f = std::min(0.99f, f);
320  setCell(x, y, f);
321  }
322 
323  m_is_empty = false;
324  return true;
325 
326  MRPT_END
327 }
328 
329 /*---------------------------------------------------------------
330  saveAsBitmapTwoMapsWithCorrespondences
331  ---------------------------------------------------------------*/
333  const std::string& fileName, const COccupancyGridMap2D* m1,
334  const COccupancyGridMap2D* m2, const TMatchingPairList& corrs)
335 {
336  MRPT_START
337 
338  CImage img1, img2;
339  unsigned int i, n, Ay1, Ay2;
340  unsigned int px, py;
341 
342  // The individual maps:
343  // ---------------------------------------------
344  m1->getAsImage(img1, false);
345  m2->getAsImage(img2, false);
346  unsigned int lx1 = img1.getWidth();
347  unsigned int ly1 = img1.getHeight();
348 
349  unsigned int lx2 = img2.getWidth();
350  unsigned int ly2 = img2.getHeight();
351 
352  // The map with the lowest height has to be vertically aligned:
353  if (ly1 > ly2)
354  {
355  Ay1 = 0;
356  Ay2 = (ly1 - ly2) / 2;
357  }
358  else
359  {
360  Ay2 = 0;
361  Ay1 = (ly2 - ly1) / 2;
362  }
363 
364  // Compute the size of the composite image:
365  // ---------------------------------------------
366  CImage img(lx1 + lx2 + 1, max(ly1, ly2), mrpt::img::CH_RGB);
367  img.filledRectangle(
368  0, 0, img.getWidth() - 1, img.getHeight() - 1,
369  TColor::black()); // background: black
370  img.drawImage(0, Ay1, img1);
371  img.drawImage(lx1 + 1, Ay2, img2);
372 
373  // Draw the features:
374  // ---------------------------------------------
375  n = corrs.size();
376  TColor lineColor = TColor::black();
377  for (i = 0; i < n; i++)
378  {
379  // In M1:
380  px = m1->x2idx(corrs[i].this_x);
381  py = Ay1 + ly1 - 1 - m1->y2idx(corrs[i].this_y);
382  img.rectangle(px - 10, py - 10, px + 10, py + 10, lineColor);
383  img.rectangle(px - 11, py - 11, px + 11, py + 11, lineColor);
384 
385  // In M2:
386  px = lx1 + 1 + m2->x2idx(corrs[i].other_x);
387  py = Ay2 + ly2 - 1 - m2->y2idx(corrs[i].other_y);
388  img.rectangle(px - 10, py - 10, px + 10, py + 10, lineColor);
389  img.rectangle(px - 11, py - 11, px + 11, py + 11, lineColor);
390  }
391 
392  // Draw the correspondences as lines:
393  // ---------------------------------------------
394  for (i = 0; i < n; i++)
395  {
396  lineColor = TColor(
397  static_cast<long>(getRandomGenerator().drawUniform(0, 255.0f)),
398  static_cast<long>(getRandomGenerator().drawUniform(0, 255.0f)),
399  static_cast<long>(getRandomGenerator().drawUniform(0, 255.0f)));
400 
401  img.line(
402  m1->x2idx(corrs[i].this_x),
403  // lx1+1+ m1->x2idx( corrs[i].this_x ),
404  Ay1 + ly1 - 1 - m1->y2idx(corrs[i].this_y),
405  lx1 + 1 + m2->x2idx(corrs[i].other_x),
406  Ay2 + ly2 - 1 - m2->y2idx(corrs[i].other_y), lineColor);
407  } // i
408 
409  return img.saveToFile(fileName.c_str());
410 
411  MRPT_END
412 }
413 
414 /*---------------------------------------------------------------
415  saveAsEMFTwoMapsWithCorrespondences
416  ---------------------------------------------------------------*/
418  const std::string& fileName, const COccupancyGridMap2D* m1,
419  const COccupancyGridMap2D* m2, const TMatchingPairList& corrs)
420 {
421  MRPT_START
422 
423  CEnhancedMetaFile emf(fileName, 1);
424  CImage img1, img2;
425  TColor lineColor;
426  unsigned int i, Ay1, Ay2;
427  unsigned int px, py;
428 
429  lineColor = TColor::red();
430 
431 // The individual maps:
432 // ---------------------------------------------
433 #ifdef _WIN32
434  m1->getAsImage(img1, true);
435  m2->getAsImage(img2, true);
436 #else
437  m1->getAsImage(img1, false); // Linux: emulated EMF is different.
438  m2->getAsImage(img2, false);
439 #endif
440  unsigned int lx1 = img1.getWidth();
441  unsigned int ly1 = img1.getHeight();
442  // unsigned int lx2 = img2.getWidth();
443  unsigned int ly2 = img2.getHeight();
444 
445  // The map with the lowest height has to be vertically aligned:
446  if (ly1 > ly2)
447  {
448  Ay1 = 0;
449  Ay2 = (ly1 - ly2) / 2;
450  }
451  else
452  {
453  Ay2 = 0;
454  Ay1 = (ly2 - ly1) / 2;
455  }
456 
457  // Draw the pair of maps:
458  // ---------------------------------------------
459  emf.drawImage(0, Ay1, img1);
460  emf.drawImage(lx1 + 1, Ay2, img2);
461 
462  // Draw the features:
463  // ---------------------------------------------
464  const unsigned int n = corrs.size();
465  lineColor = TColor::black();
466  for (i = 0; i < n; i++)
467  {
468  // In M1:
469  px = m1->x2idx(corrs[i].this_x);
470  py = Ay1 + ly1 - 1 - m1->y2idx(corrs[i].this_y);
471  emf.rectangle(px - 10, py - 10, px + 10, py + 10, lineColor);
472  emf.rectangle(px - 11, py - 11, px + 11, py + 11, lineColor);
473 
474  // In M2:
475  px = lx1 + 1 + m2->x2idx(corrs[i].other_x);
476  py = Ay2 + ly2 - 1 - m2->y2idx(corrs[i].other_y);
477  emf.rectangle(px - 10, py - 10, px + 10, py + 10, lineColor);
478  emf.rectangle(px - 11, py - 11, px + 11, py + 11, lineColor);
479  }
480 
481  /** /
482  // Draw the correspondences as lines:
483  // ---------------------------------------------
484  for (i=0;i<n;i++)
485  {
486  lineColor =
487  ((unsigned long)RandomUni(0,255.0f)) +
488  (((unsigned long)RandomUni(0,255.0f)) << 8 ) +
489  (((unsigned long)RandomUni(0,255.0f)) << 16 );
490 
491  emf.line(
492  m1->x2idx( corrs[i].this_x ),
493  Ay1+ly1-1- m1->y2idx( corrs[i].this_y ),
494  lx1+1+ m2->x2idx( corrs[i].other_x ),
495  Ay2+ly2-1-m2->y2idx( corrs[i].other_y ),
496  lineColor);
497  } // i
498  / **/
499 
500  // Draw the correspondences as text labels:
501  // ---------------------------------------------
502  char str[100];
503  for (i = 0; i < n; i++)
504  {
505  os::sprintf(str, 100, "%i", i);
506 
507  emf.textOut(
508  m1->x2idx(corrs[i].this_x) - 10,
509  Ay1 + ly1 - 1 - m1->y2idx(corrs[i].this_y) - 25, str,
510  TColor::black());
511 
512  emf.textOut(
513  lx1 + 1 + m2->x2idx(corrs[i].other_x) - 10,
514  Ay2 + ly2 - 1 - m2->y2idx(corrs[i].other_y) - 25, str,
515  TColor::black());
516  } // i
517 
518  return true;
519 
520  MRPT_END
521 }
522 
524  const std::string& filNamePrefix) const
525 {
526  std::string fil(filNamePrefix + std::string(".png"));
527  saveAsBitmapFile(fil);
528 
529  fil = filNamePrefix + std::string("_limits.txt");
530  CMatrixF LIMITS(1, 4);
531  LIMITS(0, 0) = x_min;
532  LIMITS(0, 1) = x_max;
533  LIMITS(0, 2) = y_min;
534  LIMITS(0, 3) = y_max;
535  LIMITS.saveToTextFile(
536  fil, MATRIX_FORMAT_FIXED, false /* add mrpt header */,
537  "% Grid limits: [x_min x_max y_min y_max]\n");
538 }
A namespace of pseudo-random numbers generators of diferent distributions.
This class represents a Windows Enhanced Meta File (EMF) for generating and saving graphics...
void line(int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1, TPenStyle penStyle=psSolid) override
Draws a line.
Definition: CImage.cpp:1123
#define MRPT_START
Definition: exceptions.h:241
TPoint2D_< double > TPoint2D
Lightweight 2D point.
Definition: TPoint2D.h:213
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >...
OccGridCellTraits::cellTypeUnsigned cellTypeUnsigned
TLikelihoodMethod
The type for selecting a likelihood computation method.
void drawImage(int x, int y, const mrpt::img::CImage &img) override
Draws an image as a bitmap at a given position.
Definition: CImage.cpp:1148
size_t getHeight() const override
Returns the height of the image in pixels.
Definition: CImage.cpp:855
bool loadFromBitmapFile(const std::string &file, float resolution, const mrpt::math::TPoint2D &origin=mrpt::math::TPoint2D(std::numeric_limits< double >::max(), std::numeric_limits< double >::max()))
Load the gridmap from a image in a file (the format can be any supported by CImage::loadFromFile).
STL namespace.
static bool saveAsEMFTwoMapsWithCorrespondences(const std::string &fileName, const COccupancyGridMap2D *m1, const COccupancyGridMap2D *m2, const mrpt::tfest::TMatchingPairList &corrs)
Saves a composite image with two gridmaps and numbers for the correspondences between them...
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:899
void saveToTextFile(const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=mrpt::math::MATRIX_FORMAT_ENG, bool appendMRPTHeader=false, const std::string &userHeader=std::string()) const
Saves the vector/matrix to a file compatible with MATLAB/Octave text format.
static bool saveAsBitmapTwoMapsWithCorrespondences(const std::string &fileName, const COccupancyGridMap2D *m1, const COccupancyGridMap2D *m2, const mrpt::tfest::TMatchingPairList &corrs)
Saves a composite image with two gridmaps and lines representing a set of correspondences between the...
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:97
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:120
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
bool saveAsBitmapFile(const std::string &file) const
Saves the gridmap as a graphical file (BMP,PNG,...).
This base provides a set of functions for maths stuff.
size_t getWidth() const override
Returns the width of the image in pixels.
Definition: CImage.cpp:818
virtual void filledRectangle(int x0, int y0, int x1, int y1, const mrpt::img::TColor color)
Draws a filled rectangle.
Definition: CCanvas.cpp:205
A list of TMatchingPair.
Definition: TMatchingPair.h:70
void rectangle(int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1)
Draws a rectangle (an empty rectangle, without filling)
Definition: CCanvas.cpp:161
This namespace contains representation of robot actions and observations.
bool loadFromBitmap(const mrpt::img::CImage &img, float resolution, const mrpt::math::TPoint2D &origin=mrpt::math::TPoint2D(std::numeric_limits< double >::max(), std::numeric_limits< double >::max()))
Load the gridmap from a image in a file (the format can be any supported by CImage::loadFromFile).
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
fixed floating point &#39;f&#39;
A class for storing an occupancy grid map.
void getAsImage(mrpt::img::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 ...
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrixF.h:22
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:54
mrpt::vision::TStereoCalibResults out
#define MRPT_END
Definition: exceptions.h:245
size_t ReadBuffer(void *Buffer, size_t Count)
Reads a block of bytes from the stream into Buffer.
Definition: CArchive.cpp:25
OccGridCellTraits::cellType cellType
The type of the map cells:
bool saveToFile(const std::string &fileName, int jpeg_quality=95) const
Save the image to a file, whose format is determined from the extension (internally uses OpenCV)...
Definition: CImage.cpp:329
A RGB color - 8bit.
Definition: TColor.h:25
size_t ReadBufferFixEndianness(T *ptr, size_t ElementCount)
Reads a sequence of elemental datatypes, taking care of reordering their bytes from the MRPT stream s...
Definition: CArchive.h:94
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
Functions for estimating the optimal transformation between two frames of references given measuremen...
int x2idx(float x) const
Transform a coordinate value into a cell index.
int sprintf(char *buf, size_t bufSize, const char *format,...) noexcept MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:148



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020