10 #include <gtest/gtest.h>    11 #include <mrpt/config.h>    20 #include <test_mrpt_common.h>    51     for (
unsigned int r = 10; r < 16; r++)
    52         for (
unsigned int c = 10; c <= r; c++)
    70 TEST(CObservation3DRangeScan, Project3D_noFilter)
    75     for (
int i = 0; i < 4; i++)  
    82             << 
" testcase flags: i=" << i << std::endl;
    86 TEST(CObservation3DRangeScan, Project3D_filterMinMax1)
   101     for (
int i = 0; i < 8; i++)  
   109             << 
" testcase flags: i=" << i << std::endl;
   113 TEST(CObservation3DRangeScan, Project3D_additionalLayers)
   120     for (
int i = 0; i < 4; i++)  
   128             << 
" testcase flags: i=" << i << std::endl;
   132 TEST(CObservation3DRangeScan, Project3D_filterMinMaxAllBetween)
   137     for (
int r = 10; r < 16; r++)
   138         for (
int c = 10; c < 16; c++)
   140             fMin(r, c) = r - 0.1f;  
   141             fMax(r, c) = r + 0.1f;
   149     for (
int i = 0; i < 16; i++)  
   157             << 
" testcase flags: i=" << i << std::endl;
   161 TEST(CObservation3DRangeScan, Project3D_filterMinMaxNoneBetween)
   166     for (
int r = 10; r < 16; r++)
   167         for (
int c = 10; c < 16; c++)
   169             fMin(r, c) = r + 1.1f;  
   170             fMax(r, c) = r + 1.2f;
   178     for (
int i = 0; i < 16; i++)  
   186             << 
" testcase flags: i=" << i << std::endl;
   190 TEST(CObservation3DRangeScan, Project3D_filterMin)
   194     for (
int r = 10; r < 16; r++)
   195         for (
int c = 10; c < 16; c++)
   203     for (
int i = 0; i < 8; i++)  
   210             << 
" testcase flags: i=" << i << std::endl;
   214 TEST(CObservation3DRangeScan, Project3D_filterMax)
   218     for (
int r = 10; r < 16; r++)
   219         for (
int c = 10; c < 16; c++)
   227     for (
int i = 0; i < 8; i++)  
   234             << 
" testcase flags: i=" << i << std::endl;
   238 TEST(CObservation3DRangeScan, LoadAndCheckFloorPoints)
   240     const string rawlog_fil =
   241         UNITTEST_BASEDIR + string(
"/tests/test-3d-obs-ground.rawlog");
   244         GTEST_FAIL() << 
"ERROR: test due to missing file: " << rawlog_fil
   260     std::vector<double> ptsz;
   261     std::vector<double> bin_x, bin_count;
   266         obs->unprojectInto(pts, pp);
   279         EXPECT_LE(bin_count[11], 100);
   280         EXPECT_LE(bin_count[12], 1000);
   281         EXPECT_GE(bin_count[14], 12000);
   282         EXPECT_LE(bin_count[18], 700);
   283         EXPECT_LE(bin_count[19], 20);
   290         obs->unprojectInto(pts, pp);
   312         EXPECT_LE(bin_count[11], 2);
   313         EXPECT_LE(bin_count[12], 10);
   314         EXPECT_GE(bin_count[14], 100);
   315         EXPECT_LE(bin_count[18], 40);
   316         EXPECT_LE(bin_count[19], 5);
   320 TEST(CObservation3DRangeScan, SyntheticRange)
   322     for (
int i = 0; i < 4; i++)  
   327         const float R = 15.0f;
   341         for (
size_t j = 0; j < pts.
size(); j++)
   357 TEST(CObservation3DRangeScan, SyntheticDepth)
   359     for (
int i = 0; i < 4; i++)  
   364         const float R = 15.0f;
   378         for (
size_t j = 0; j < pts.
size(); j++)
 void fillSampleObs(mrpt::obs::CObservation3DRangeScan &obs, mrpt::obs::T3DPointsProjectionParams &pp, int test_case)
 
void getPoint(size_t index, float &x, float &y, float &z) const
Access to a given point from map, as a 2D point. 
 
This class provides an easy way of computing histograms for unidimensional real valued variables...
 
std::map< std::string, mrpt::math::CMatrix_u16 > rangeImageOtherLayers
Additional layer range/depth images. 
 
mrpt::img::TCamera cameraParams
Projection parameters of the depth camera. 
 
void unprojectInto(POINTMAP &dest_pointcloud, const T3DPointsProjectionParams &projectParams=T3DPointsProjectionParams(), const TRangeImageFilterParams &filterParams=TRangeImageFilterParams())
Unprojects the RGB+D image pair into a 3D point cloud (with color if the target map supports it) and ...
 
static CPose3D FromString(const std::string &s)
 
double fx() const
Get the value of the focal length x-value (in pixels). 
 
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...
 
void fill(const Scalar &val)
 
void inverseComposePoint(const double gx, const double gy, const double gz, double &lx, double &ly, double &lz, mrpt::optional_ref< mrpt::math::CMatrixDouble33 > out_jacobian_df_dpoint=std::nullopt, mrpt::optional_ref< mrpt::math::CMatrixDouble36 > out_jacobian_df_dpose=std::nullopt, mrpt::optional_ref< mrpt::math::CMatrixDouble36 > out_jacobian_df_dse3=std::nullopt) const
Computes the 3D point L such as . 
 
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists. 
 
double fy() const
Get the value of the focal length y-value (in pixels). 
 
A range or depth 3D scan measurement, as from a time-of-flight range camera or a structured-light dep...
 
T::Ptr getObservationByClass(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...
 
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
 
Used in CObservation3DRangeScan::unprojectInto() 
 
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. 
 
double cy() const
Get the value of the principal point y-coordinate (in pixels). 
 
const mrpt::aligned_std_vector< float > & getPointsBufferRef_z() const
Provides a direct access to a read-only reference of the internal point buffer. 
 
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 
 
mrpt::math::CMatrix_u16 rangeImage
If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters)...
 
TPoint3D_< double > TPoint3D
Lightweight 3D point. 
 
constexpr float SECOND_LAYER_CONSTANT_RANGE
 
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. 
 
bool USE_SSE2
(Default:true) If possible, use SSE2 optimized code. 
 
double cx() const
Get the value of the principal point x-coordinate (in pixels). 
 
constexpr unsigned int TEST_RANGEIMG_WIDTH
 
This class is a "CSerializable" wrapper for "CMatrixFloat". 
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot. 
 
Used in CObservation3DRangeScan::unprojectInto() 
 
EXPECT_EQ(out.image_pair_was_used.size(), NUM_IMGS)
 
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 clear()
Clear the histogram: 
 
constexpr unsigned int TEST_RANGEIMG_HEIGHT
 
T norm() const
Point norm: |v| = sqrt(x^2+y^2+z^2) 
 
EXPECT_NEAR(out.cam_params.rightCameraPose.x, 0.1194, 0.005)
 
bool range_is_depth
true: Kinect-like ranges: entries of rangeImage are distances along the +X axis; false: Ranges in ran...
 
size_t size() const
Save the point cloud as a PCL PCD file, in either ASCII or binary format. 
 
std::string layer
If empty, the main rangeImage layer will be unprojected. 
 
uint32_t ncols
Camera resolution. 
 
float rangeUnits
The conversion factor from integer units in rangeImage and actual distances in meters. 
 
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.