10 #include <gtest/gtest.h> 11 #include <mrpt/config.h> 20 #include <test_mrpt_common.h> 25 #define TEST_RANGEIMG_WIDTH 32 26 #define TEST_RANGEIMG_HEIGHT 24 37 for (
int r = 10;
r < 16;
r++)
46 TEST(CObservation3DRangeScan, Project3D_noFilter)
51 for (
int i = 0; i < 8; i++)
58 <<
" testcase flags: i=" << i << std::endl;
62 TEST(CObservation3DRangeScan, Project3D_filterMinMax1)
77 for (
int i = 0; i < 16; i++)
85 <<
" testcase flags: i=" << i << std::endl;
89 TEST(CObservation3DRangeScan, Project3D_filterMinMaxAllBetween)
94 for (
int r = 10;
r < 16;
r++)
95 for (
int c = 10;
c < 16;
c++)
97 fMin(
r,
c) =
r - 0.1f;
98 fMax(
r,
c) =
r + 0.1f;
106 for (
int i = 0; i < 16; i++)
114 <<
" testcase flags: i=" << i << std::endl;
118 TEST(CObservation3DRangeScan, Project3D_filterMinMaxNoneBetween)
123 for (
int r = 10;
r < 16;
r++)
124 for (
int c = 10;
c < 16;
c++)
126 fMin(
r,
c) =
r + 1.1f;
127 fMax(
r,
c) =
r + 1.2f;
135 for (
int i = 0; i < 16; i++)
143 <<
" testcase flags: i=" << i << std::endl;
147 TEST(CObservation3DRangeScan, Project3D_filterMin)
151 for (
int r = 10;
r < 16;
r++)
152 for (
int c = 10;
c < 16;
c++)
160 for (
int i = 0; i < 8; i++)
167 <<
" testcase flags: i=" << i << std::endl;
171 TEST(CObservation3DRangeScan, Project3D_filterMax)
175 for (
int r = 10;
r < 16;
r++)
176 for (
int c = 10;
c < 16;
c++)
184 for (
int i = 0; i < 8; i++)
191 <<
" testcase flags: i=" << i << std::endl;
199 TEST(CObservation3DRangeScan, LoadAndCheckFloorPoints)
201 const string rawlog_fil =
202 UNITTEST_BASEDIR +
string(
"/tests/test-3d-obs-ground.rawlog");
205 GTEST_FAIL() <<
"ERROR: test due to missing file: " << rawlog_fil
221 std::vector<double> ptsz;
222 std::vector<double> bin_x, bin_count;
227 obs->project3DPointsFromDepthImageInto(pts, pp);
240 EXPECT_LE(bin_count[11], 100);
241 EXPECT_LE(bin_count[12], 1000);
242 EXPECT_GE(bin_count[14], 12000);
243 EXPECT_LE(bin_count[18], 700);
244 EXPECT_LE(bin_count[19], 20);
251 obs->project3DPointsFromDepthImageInto(pts, pp);
273 EXPECT_LE(bin_count[11], 2);
274 EXPECT_LE(bin_count[12], 10);
275 EXPECT_GE(bin_count[14], 100);
276 EXPECT_LE(bin_count[18], 40);
277 EXPECT_LE(bin_count[19], 5);
void fillSampleObs(mrpt::obs::CObservation3DRangeScan &obs, mrpt::obs::T3DPointsProjectionParams &pp, int test_case)
#define TEST_RANGEIMG_WIDTH
This class provides an easy way of computing histograms for unidimensional real valued variables...
void copy_container_typecasting(const src_container &src, dst_container &trg)
Copy all the elements in a container (vector, deque, list) into a different one performing the approp...
mrpt::math::CMatrixF rangeImage
If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters) ...
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto()
TEST(CObservation3DRangeScan, Project3D_noFilter)
const mrpt::math::CMatrixF * rangeMask_max
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream, std::istream, std::ostream, std::stringstream.
const mrpt::aligned_std_vector< float > & getPointsBufferRef_z() const
Provides a direct access to a read-only reference of the internal point buffer.
#define TEST_RANGEIMG_HEIGHT
void add(const double x)
Add an element to the histogram.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
bool hasRangeImage
true means the field rangeImage contains valid data
const mrpt::math::CMatrixF * rangeMask_min
(Default: nullptr) If provided, each data range will be tested to be greater-than (rangeMask_min) or ...
void getHistogram(std::vector< double > &x, std::vector< double > &hits) const
Returns the list of bin centers & hit counts.
GLsizei const GLchar ** string
bool USE_SSE2
(Default:true) If possible, use SSE2 optimized code.
This class is a "CSerializable" wrapper for "CMatrixFloat".
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto()
std::vector< float > points3D_x
If hasPoints3D=true, the (X,Y,Z) coordinates of the 3D point cloud detected by the camera...
void rangeImage_setSize(const int HEIGHT, const int WIDTH)
Similar to calling "rangeImage.setSize(H,W)" but this method provides memory pooling to speed-up the ...
void project3DPointsFromDepthImageInto(POINTMAP &dest_pointcloud, const T3DPointsProjectionParams &projectParams, const TRangeImageFilterParams &filterParams=TRangeImageFilterParams())
Project the RGB+D images into a 3D point cloud (with color if the target map supports it) and optiona...
void clear()
Clear the histogram:
bool PROJ3D_USE_LUT
(Default:true) [Only used when range_is_depth=true] Whether to use a Look-up-table (LUT) to speed up ...
T::Ptr getObservationByClass(const size_t &ith=0) const
Returns the i'th observation of a given class (or of a descendant class), or nullptr if there is no s...
bool takeIntoAccountSensorPoseOnRobot
(Default: false) If false, local (sensor-centric) coordinates of points are generated.
bool rangeCheckBetween
Only used if both rangeMask_min and rangeMask_max are present.