10 #include <gtest/gtest.h> 11 #include <mrpt/config.h> 30 #define TEST_RANGEIMG_WIDTH 32 31 #define TEST_RANGEIMG_HEIGHT 24 40 for (
int r = 10;
r < 16;
r++)
41 for (
int c = 10;
c <=
r;
c++)
50 TEST(CObservation3DRangeScan, Project3D_noFilter) {
54 for (
int i = 0; i < 8; i++)
61 <<
" testcase flags: i=" << i << std::endl;
65 TEST(CObservation3DRangeScan, Project3D_filterMinMax1) {
79 for (
int i = 0; i < 16; i++)
87 <<
" testcase flags: i=" << i << std::endl;
91 TEST(CObservation3DRangeScan, Project3D_filterMinMaxAllBetween) {
95 for (
int r = 10;
r < 16;
r++)
96 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) {
122 for (
int r = 10;
r < 16;
r++)
123 for (
int c = 10;
c < 16;
c++) {
124 fMin(
r,
c) =
r + 1.1f;
125 fMax(
r,
c) =
r + 1.2f;
133 for (
int i = 0; i < 16; i++)
141 <<
" testcase flags: i=" << i << std::endl;
145 TEST(CObservation3DRangeScan, Project3D_filterMin) {
148 for (
int r = 10;
r < 16;
r++)
149 for (
int c = 10;
c < 16;
c++)
156 for (
int i = 0; i < 8; i++)
163 <<
" testcase flags: i=" << i << std::endl;
167 TEST(CObservation3DRangeScan, Project3D_filterMax) {
170 for (
int r = 10;
r < 16;
r++)
171 for (
int c = 10;
c < 16;
c++)
178 for (
int i = 0; i < 8; i++)
185 <<
" testcase flags: i=" << i << std::endl;
193 TEST(CObservation3DRangeScan, LoadAndCheckFloorPoints) {
195 string(
"/tests/test-3d-obs-ground.rawlog");
197 GTEST_FAIL() <<
"ERROR: test due to missing file: " << rawlog_fil <<
"\n";
211 obs->project3DPointsFromDepthImageInto(pts, pp);
213 pts.changeCoordinatesReference(obs->sensorPose);
216 std::vector<double> ptsz;
218 pts.getPointsBufferRef_z(), ptsz);
221 std::vector<double> bin_x, bin_count;
260 EXPECT_LE(bin_count[11], 100);
261 EXPECT_LE(bin_count[12], 1000);
262 EXPECT_GE(bin_count[14], 12000);
263 EXPECT_LE(bin_count[18], 700);
264 EXPECT_LE(bin_count[19], 20);
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...
std::string MRPT_GLOBAL_UNITTEST_SRC_DIR
bool BASE_IMPEXP 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.
const mrpt::math::CMatrix * rangeMask_min
(Default: NULL) If provided, each data range will be tested to be greater-than (rangeMask_min) or les...
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)
mrpt::math::CMatrix rangeImage
If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters) ...
#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
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 is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
const mrpt::math::CMatrix * rangeMask_max
Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto()
std::vector< float > points3D_x
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...
bool PROJ3D_USE_LUT
(Default:true) [Only used when range_is_depth=true] Whether to use a Look-up-table (LUT) to speed up ...
This class is a "CSerializable" wrapper for "CMatrixFloat".
T::Ptr getObservationByClass(const size_t &ith=0) const
Returns the i'th observation of a given class (or of a descendant class), or NULL if there is no such...
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...
bool takeIntoAccountSensorPoseOnRobot
(Default: false) If false, local (sensor-centric) coordinates of points are generated. Otherwise, points are transformed with sensorPose. Furthermore, if provided, those coordinates are transformed with robotPoseInTheWorld
bool rangeCheckBetween
Only used if both rangeMask_min and rangeMask_max are present.