41 img.resize(size_x,size_y,1,
true);
43 unsigned char *destPtr;
44 for (
unsigned int y=0;
y<size_y;
y++)
47 destPtr =
img(0,size_y-1-
y);
48 else destPtr =
img(0,
y);
49 for (
unsigned int x=0;
x<size_x;
x++)
51 *destPtr++ = l2p_255(*srcPtr++);
57 img.resize(size_x,size_y,3,
true);
59 unsigned char *destPtr;
60 for (
unsigned int y=0;
y<size_y;
y++)
63 destPtr =
img(0,size_y-1-
y);
64 else destPtr =
img(0,
y);
65 for (
unsigned int x=0;
x<size_x;
x++)
80 img.resize(size_x,size_y,1,
true);
82 unsigned char *destPtr;
83 for (
unsigned int y=0;
y<size_y;
y++)
86 destPtr =
img(0,size_y-1-
y);
87 else destPtr =
img(0,
y);
88 for (
unsigned int x=0;
x<size_x;
x++)
102 img.resize(size_x,size_y,3,
true);
104 unsigned char *destPtr;
105 for (
unsigned int y=0;
y<size_y;
y++)
108 destPtr =
img(0,size_y-1-
y);
109 else destPtr =
img(0,
y);
110 for (
unsigned int x=0;
x<size_x;
x++)
134 bool forceRGB )
const 136 getAsImage(
img,verticalFlip,forceRGB);
143 if (insertionOptions.CFD_features_gaussian_size!=0)
img.filterGaussianInPlace(
round( insertionOptions.CFD_features_gaussian_size ) );
144 if (insertionOptions.CFD_features_median_size!=0)
img.filterMedianInPlace(
round( insertionOptions.CFD_features_median_size ) );
146 cout <<
"[COccupancyGridMap2D::getAsImageFiltered] Filtered in: " <<
t.Tac()*1000 <<
" ms" << endl;
157 if (!genericMapParams.enableSaveAs3DObject)
return;
163 outObj->setPlaneCorners(x_min,x_max,y_min,y_max);
165 outObj->setLocation(0,0, insertionOptions.mapAltitude );
168 CImage imgColor(size_x,size_y,1);
169 CImage imgTrans(size_x,size_y,1);
174 for (
unsigned int y=0;
y<size_y;
y++)
176 unsigned char *destPtr_color = imgColor(0,
y);
177 unsigned char *destPtr_trans = imgTrans(0,
y);
178 for (
unsigned int x=0;
x<size_x;
x++)
180 uint8_t cell255 = l2p_255(*srcPtr++);
181 *destPtr_color++ = cell255;
184 *destPtr_trans++ = auxC>0 ? (auxC << 1) : ((-auxC) << 1);
188 outObj->assignImage_fast( imgColor,imgTrans );
189 outSetOfObj->insert( outObj );
203 for (
size_t i=1; i+1<size_x; i++)
206 for (
size_t j=1; j+1<size_y; j++)
209 bool is_surrounded =
true;
210 for (
int di=-1;di<=1 && is_surrounded;di++)
211 for (
int dj=-1;dj<=1 && is_surrounded;dj++)
212 if ((di!=0 || dj!=0) && getCell(i+di,j+dj)>occup_threshold)
215 if (getCell(i,j)<occup_threshold && !is_surrounded)
void clear()
Erase all the contents of the map.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
A class for storing images as grayscale or RGB bitmaps.
static CTexturedPlanePtr Create()
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
void insertPoint(float x, float y, float z=0)
Provides a way to insert (append) individual points into the map: the missing fields of child classes...
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 ...
This class implements a high-performance stopwatch.
This namespace contains representation of robot actions and observations.
void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Returns a 3D plane with its texture being the occupancy grid and transparency proportional to "uncert...
void getAsPointCloud(mrpt::maps::CSimplePointsMap &pm, const float occup_threshold=0.5f) const
Get a point cloud with all (border) occupied cells as points.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void getAsImageFiltered(utils::CImage &img, bool verticalFlip=false, bool forceRGB=false) const
Returns the grid as a 8-bit graylevel image, where each pixel is a cell (output image is RGB only if ...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
int round(const T value)
Returns the closer integer (int) to x.
virtual void reserve(size_t newLength) MRPT_OVERRIDE
Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.
int16_t cellType
The type of the map cells: