MRPT  1.9.9
CObservation3DRangeScan_project3D_impl.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, 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 #pragma once
10 
11 #include <mrpt/core/round.h> // round()
12 #include <mrpt/math/CVectorFixed.h>
13 #include <Eigen/Dense> // block<>()
14 
15 namespace mrpt::obs::detail
16 {
17 // Auxiliary functions which implement SSE-optimized proyection of 3D point
18 // cloud:
19 template <class POINTMAP>
21  const int H, const int W, const float* kys, const float* kzs,
22  const mrpt::math::CMatrixF& rangeImage,
24  std::vector<uint16_t>& idxs_x, std::vector<uint16_t>& idxs_y,
25  const mrpt::obs::TRangeImageFilterParams& fp, bool MAKE_ORGANIZED,
26  const int DECIM);
27 template <class POINTMAP>
29  const int H, const int W, const float* kys, const float* kzs,
30  const mrpt::math::CMatrixF& rangeImage,
32  std::vector<uint16_t>& idxs_x, std::vector<uint16_t>& idxs_y,
33  const mrpt::obs::TRangeImageFilterParams& fp, bool MAKE_ORGANIZED);
34 
35 template <typename POINTMAP, bool isDepth>
36 inline void range2XYZ(
39  const mrpt::obs::TRangeImageFilterParams& fp, const int H, const int W)
40 {
41  /* range_is_depth = false :
42  * Ky = (r_cx - c)/r_fx
43  * Kz = (r_cy - r)/r_fy
44  *
45  * x(i) = rangeImage(r,c) / sqrt( 1 + Ky^2 + Kz^2 )
46  * y(i) = Ky * x(i)
47  * z(i) = Kz * x(i)
48  */
49  const float r_cx = src_obs.cameraParams.cx();
50  const float r_cy = src_obs.cameraParams.cy();
51  const float r_fx_inv = 1.0f / src_obs.cameraParams.fx();
52  const float r_fy_inv = 1.0f / src_obs.cameraParams.fy();
53  TRangeImageFilter rif(fp);
54  size_t idx = 0;
55  for (int r = 0; r < H; r++)
56  for (int c = 0; c < W; c++)
57  {
58  const float D = src_obs.rangeImage.coeff(r, c);
59  if (rif.do_range_filter(r, c, D))
60  {
61  const float Ky = (r_cx - c) * r_fx_inv;
62  const float Kz = (r_cy - r) * r_fy_inv;
63  pca.setPointXYZ(
64  idx,
65  isDepth ? D : D / std::sqrt(1 + Ky * Ky + Kz * Kz), // x
66  Ky * D, // y
67  Kz * D // z
68  );
69  src_obs.points3D_idxs_x[idx] = c;
70  src_obs.points3D_idxs_y[idx] = r;
71  ++idx;
72  }
73  }
74  pca.resize(idx); // Actual number of valid pts
75 }
76 
77 template <typename POINTMAP, bool isDepth>
78 inline void range2XYZ_LUT(
82  const mrpt::obs::TRangeImageFilterParams& fp, const int H, const int W,
83  const int DECIM = 1)
84 {
85  const size_t WH = W * H;
86  if (src_obs.get_3dproj_lut().prev_camParams != src_obs.cameraParams ||
87  WH != size_t(src_obs.get_3dproj_lut().Kys.size()))
88  {
89  src_obs.get_3dproj_lut().prev_camParams = src_obs.cameraParams;
90  src_obs.get_3dproj_lut().Kys.resize(WH);
91  src_obs.get_3dproj_lut().Kzs.resize(WH);
92 
93  const float r_cx = src_obs.cameraParams.cx();
94  const float r_cy = src_obs.cameraParams.cy();
95  const float r_fx_inv = 1.0f / src_obs.cameraParams.fx();
96  const float r_fy_inv = 1.0f / src_obs.cameraParams.fy();
97 
98  float* kys = &src_obs.get_3dproj_lut().Kys[0];
99  float* kzs = &src_obs.get_3dproj_lut().Kzs[0];
100  for (int r = 0; r < H; r++)
101  for (int c = 0; c < W; c++)
102  {
103  *kys++ = (r_cx - c) * r_fx_inv;
104  *kzs++ = (r_cy - r) * r_fy_inv;
105  }
106  } // end update LUT.
107 
108  ASSERT_EQUAL_(WH, size_t(src_obs.get_3dproj_lut().Kys.size()));
109  ASSERT_EQUAL_(WH, size_t(src_obs.get_3dproj_lut().Kzs.size()));
110  float* kys = &src_obs.get_3dproj_lut().Kys[0];
111  float* kzs = &src_obs.get_3dproj_lut().Kzs[0];
112 
113  if (fp.rangeMask_min)
114  { // sanity check:
115  ASSERT_EQUAL_(fp.rangeMask_min->cols(), src_obs.rangeImage.cols());
116  ASSERT_EQUAL_(fp.rangeMask_min->rows(), src_obs.rangeImage.rows());
117  }
118  if (fp.rangeMask_max)
119  { // sanity check:
120  ASSERT_EQUAL_(fp.rangeMask_max->cols(), src_obs.rangeImage.cols());
121  ASSERT_EQUAL_(fp.rangeMask_max->rows(), src_obs.rangeImage.rows());
122  }
123 #if MRPT_HAS_SSE2
124  // if image width is not 8*N, use standard method
125  if ((W & 0x07) == 0 && pp.USE_SSE2 && DECIM == 1)
127  H, W, kys, kzs, src_obs.rangeImage, pca, src_obs.points3D_idxs_x,
128  src_obs.points3D_idxs_y, fp, pp.MAKE_ORGANIZED);
129  else
130 #endif
132  H, W, kys, kzs, src_obs.rangeImage, pca, src_obs.points3D_idxs_x,
133  src_obs.points3D_idxs_y, fp, pp.MAKE_ORGANIZED, DECIM);
134 }
135 
136 template <class POINTMAP>
138  mrpt::obs::CObservation3DRangeScan& src_obs, POINTMAP& dest_pointcloud,
141 {
142  using namespace mrpt::math;
143 
144  if (!src_obs.hasRangeImage) return;
145 
146  mrpt::opengl::PointCloudAdapter<POINTMAP> pca(dest_pointcloud);
147 
148  // ------------------------------------------------------------
149  // Stage 1/3: Create 3D point cloud local coordinates
150  // ------------------------------------------------------------
151  const int W = src_obs.rangeImage.cols();
152  const int H = src_obs.rangeImage.rows();
153  ASSERT_(W != 0 && H != 0);
154  const size_t WH = W * H;
155 
156  if (pp.decimation == 1)
157  {
158  // No decimation: one point per range image pixel
159 
160  // This is to make sure points3D_idxs_{x,y} have the expected sizes
161  src_obs.resizePoints3DVectors(WH);
162  // Reserve memory for 3D points. It will be later resized again to the
163  // actual number of valid points
164  pca.resize(WH);
165  if (pp.MAKE_ORGANIZED) pca.setDimensions(H, W);
166  if (src_obs.range_is_depth)
167  {
168  // range_is_depth = true
169  // Use cached tables?
170  if (pp.PROJ3D_USE_LUT)
171  range2XYZ_LUT<POINTMAP, true>(pca, src_obs, pp, fp, H, W);
172  else
173  range2XYZ<POINTMAP, true>(pca, src_obs, fp, H, W);
174  }
175  else
176  range2XYZ<POINTMAP, false>(pca, src_obs, fp, H, W);
177  }
178  else
179  {
180  // Decimate range image:
181  const auto DECIM = pp.decimation;
182  ASSERTMSG_(
183  (W % DECIM) == 0 && (H % DECIM == 0),
184  "Width/Height are not an exact multiple of decimation");
185  const int Wd = W / DECIM;
186  const int Hd = H / DECIM;
187  ASSERT_(Wd != 0 && Hd != 0);
188  const size_t WHd = Wd * Hd;
189 
190  src_obs.resizePoints3DVectors(WHd);
191  pca.resize(WHd);
192  if (pp.MAKE_ORGANIZED) pca.setDimensions(Hd, Wd);
193  ASSERTMSG_(
194  src_obs.range_is_depth && pp.PROJ3D_USE_LUT,
195  "Decimation only available if range_is_depth && PROJ3D_USE_LUT");
196  range2XYZ_LUT<POINTMAP, true>(pca, src_obs, pp, fp, H, W, DECIM);
197  }
198 
199  // -------------------------------------------------------------
200  // Stage 2/3: Project local points into RGB image to get colors
201  // -------------------------------------------------------------
202  if constexpr (pca.HAS_RGB)
203  {
204  if (src_obs.hasIntensityImage)
205  {
206  const int imgW = src_obs.intensityImage.getWidth();
207  const int imgH = src_obs.intensityImage.getHeight();
208  const bool hasColorIntensityImg = src_obs.intensityImage.isColor();
209 
210  const float cx = src_obs.cameraParamsIntensity.cx();
211  const float cy = src_obs.cameraParamsIntensity.cy();
212  const float fx = src_obs.cameraParamsIntensity.fx();
213  const float fy = src_obs.cameraParamsIntensity.fy();
214 
215  // Unless we are in a special case (both depth & RGB images
216  // coincide)...
217  const bool isDirectCorresp =
219 
220  // ...precompute the inverse of the pose transformation out of
221  // the
222  // loop,
223  // store as a 4x4 homogeneous matrix to exploit SSE
224  // optimizations
225  // below:
227  if (!isDirectCorresp)
228  {
234  t_inv);
235 
236  T_inv(3, 3) = 1;
237  T_inv.insertMatrix(0, 0, R_inv.cast_float());
238  T_inv.insertMatrix(0, 3, t_inv.cast_float());
239  }
240 
241  CVectorFixedFloat<4> pt_wrt_color, pt_wrt_depth;
242  pt_wrt_depth[3] = 1;
243  mrpt::img::TColor pCol;
244 
245  // For each local point:
246  const size_t nPts = pca.size();
247  const auto& iimg = src_obs.intensityImage;
248  const uint8_t* img_data = iimg.ptrLine<uint8_t>(0);
249  const auto img_stride = iimg.getRowStride();
250  for (size_t i = 0; i < nPts; i++)
251  {
252  int img_idx_x,
253  img_idx_y; // projected pixel coordinates, in the
254  // RGB image plane
255  bool pointWithinImage = false;
256  if (isDirectCorresp)
257  {
258  pointWithinImage = true;
259  img_idx_x = src_obs.points3D_idxs_x[i];
260  img_idx_y = src_obs.points3D_idxs_y[i];
261  }
262  else
263  {
264  // Project point, which is now in "pca" in local
265  // coordinates
266  // wrt the depth camera, into the intensity camera:
267  pca.getPointXYZ(
268  i, pt_wrt_depth[0], pt_wrt_depth[1], pt_wrt_depth[2]);
269  pt_wrt_color = T_inv * pt_wrt_depth;
270 
271  // Project to image plane:
272  if (pt_wrt_color[2])
273  {
274  img_idx_x = mrpt::round(
275  cx + fx * pt_wrt_color[0] / pt_wrt_color[2]);
276  img_idx_y = mrpt::round(
277  cy + fy * pt_wrt_color[1] / pt_wrt_color[2]);
278  pointWithinImage = img_idx_x >= 0 && img_idx_x < imgW &&
279  img_idx_y >= 0 && img_idx_y < imgH;
280  }
281  }
282 
283  if (pointWithinImage)
284  {
285  if (hasColorIntensityImg)
286  {
287  const auto px_idx =
288  img_stride * img_idx_y + 3 * img_idx_x;
289  pCol.R = img_data[px_idx + 2];
290  pCol.G = img_data[px_idx + 1];
291  pCol.B = img_data[px_idx + 0];
292  }
293  else
294  {
295  const auto px_idx = img_stride * img_idx_y + img_idx_x;
296  pCol.R = pCol.G = pCol.B = img_data[px_idx];
297  }
298  }
299  else
300  {
301  pCol.R = pCol.G = pCol.B = 255;
302  }
303  // Set color:
304  pca.setPointRGBu8(i, pCol.R, pCol.G, pCol.B);
305  } // end for each point
306  } // end if src_obs has intensity image
307  }
308  // ...
309 
310  // ------------------------------------------------------------
311  // Stage 3/3: Apply 6D transformations
312  // ------------------------------------------------------------
314  {
315  mrpt::poses::CPose3D transf_to_apply; // Either ROBOTPOSE or
316  // ROBOTPOSE(+)SENSORPOSE or
317  // SENSORPOSE
319  transf_to_apply = src_obs.sensorPose;
320  if (pp.robotPoseInTheWorld)
321  transf_to_apply.composeFrom(
322  *pp.robotPoseInTheWorld, mrpt::poses::CPose3D(transf_to_apply));
323 
324  const auto HM =
325  transf_to_apply
327  .cast_float();
328  mrpt::math::CVectorFixedFloat<4> pt, pt_transf;
329  pt[3] = 1;
330 
331  const size_t nPts = pca.size();
332  for (size_t i = 0; i < nPts; i++)
333  {
334  pca.getPointXYZ(i, pt[0], pt[1], pt[2]);
335  pt_transf = HM * pt;
336  pca.setPointXYZ(i, pt_transf[0], pt_transf[1], pt_transf[2]);
337  }
338  }
339 } // end of project3DPointsFromDepthImageInto
340 
341 // Auxiliary functions which implement (un)projection of 3D point clouds:
342 template <class POINTMAP>
344  const int H, const int W, const float* kys, const float* kzs,
345  const mrpt::math::CMatrixF& rangeImage,
347  std::vector<uint16_t>& idxs_x, std::vector<uint16_t>& idxs_y,
348  const mrpt::obs::TRangeImageFilterParams& fp, bool MAKE_ORGANIZED,
349  const int DECIM)
350 {
351  TRangeImageFilter rif(fp);
352  // Preconditions: minRangeMask() has the right size
353  size_t idx = 0;
354  if (DECIM == 1)
355  {
356  for (int r = 0; r < H; r++)
357  for (int c = 0; c < W; c++)
358  {
359  const float D = rangeImage.coeff(r, c);
360  // LUT projection coefs:
361  const auto ky = *kys++, kz = *kzs++;
362  if (!rif.do_range_filter(r, c, D))
363  {
364  if (MAKE_ORGANIZED) pca.setInvalidPoint(idx++);
365  continue;
366  }
367  pca.setPointXYZ(idx, D /*x*/, ky * D /*y*/, kz * D /*z*/);
368  idxs_x[idx] = c;
369  idxs_y[idx] = r;
370  ++idx;
371  }
372  }
373  else
374  {
375  const int Hd = H / DECIM, Wd = W / DECIM;
376 
377  for (int rd = 0; rd < Hd; rd++)
378  for (int cd = 0; cd < Wd; cd++)
379  {
380  bool valid_pt = false;
381  float min_d = std::numeric_limits<float>::max();
382  for (int rb = 0; rb < DECIM; rb++)
383  for (int cb = 0; cb < DECIM; cb++)
384  {
385  const auto r = rd * DECIM + rb, c = cd * DECIM + cb;
386  const float D = rangeImage.coeff(r, c);
387  if (rif.do_range_filter(r, c, D))
388  {
389  valid_pt = true;
390  if (D < min_d) min_d = D;
391  }
392  }
393  if (!valid_pt)
394  {
395  if (MAKE_ORGANIZED) pca.setInvalidPoint(idx++);
396  continue;
397  }
398  const auto eq_r = rd * DECIM + DECIM / 2,
399  eq_c = cd * DECIM + DECIM / 2;
400  const auto ky = kys[eq_c + eq_r * W], kz = kzs[eq_c + eq_r * W];
401  pca.setPointXYZ(
402  idx, min_d /*x*/, ky * min_d /*y*/, kz * min_d /*z*/);
403  idxs_x[idx] = eq_c;
404  idxs_y[idx] = eq_r;
405  ++idx;
406  }
407  }
408  pca.resize(idx);
409 }
410 
411 // Auxiliary functions which implement (un)projection of 3D point clouds:
412 template <class POINTMAP>
414  const int H, const int W, const float* kys, const float* kzs,
415  const mrpt::math::CMatrixF& rangeImage,
417  std::vector<uint16_t>& idxs_x, std::vector<uint16_t>& idxs_y,
418  const mrpt::obs::TRangeImageFilterParams& fp, bool MAKE_ORGANIZED)
419 {
420 #if MRPT_HAS_SSE2
421  // Preconditions: minRangeMask() has the right size
422  // Use optimized version:
423  const int W_4 = W >> 2; // /=4 , since we process 4 values at a time.
424  size_t idx = 0;
425  alignas(MRPT_MAX_STATIC_ALIGN_BYTES) float xs[4], ys[4], zs[4];
426  const __m128 D_zeros = _mm_set_ps(.0f, .0f, .0f, .0f);
427  const __m128 xormask =
428  (fp.rangeCheckBetween) ? _mm_cmpneq_ps(D_zeros, D_zeros)
429  : // want points BETWEEN min and max to be valid
430  _mm_cmpeq_ps(
431  D_zeros,
432  D_zeros); // want points OUTSIDE of min and max to be valid
433  for (int r = 0; r < H; r++)
434  {
435  const float* D_ptr = &rangeImage(r, 0); // Matrices are 16-aligned
436  const float* Dgt_ptr =
437  !fp.rangeMask_min ? nullptr : &(*fp.rangeMask_min)(r, 0);
438  const float* Dlt_ptr =
439  !fp.rangeMask_max ? nullptr : &(*fp.rangeMask_max)(r, 0);
440 
441  for (int c = 0; c < W_4; c++)
442  {
443  const __m128 D = _mm_load_ps(D_ptr);
444  const __m128 nz_mask = _mm_cmpgt_ps(D, D_zeros);
445  __m128 valid_range_mask;
446  if (!fp.rangeMask_min && !fp.rangeMask_max)
447  { // No filter: just skip D=0 points
448  valid_range_mask = nz_mask;
449  }
450  else
451  {
452  if (!fp.rangeMask_min || !fp.rangeMask_max)
453  { // Only one filter
454  if (fp.rangeMask_min)
455  {
456  const __m128 Dmin = _mm_load_ps(Dgt_ptr);
457  valid_range_mask = _mm_and_ps(
458  _mm_cmpgt_ps(D, Dmin), _mm_cmpgt_ps(Dmin, D_zeros));
459  }
460  else
461  {
462  const __m128 Dmax = _mm_load_ps(Dlt_ptr);
463  valid_range_mask = _mm_and_ps(
464  _mm_cmplt_ps(D, Dmax), _mm_cmpgt_ps(Dmax, D_zeros));
465  }
466  valid_range_mask = _mm_and_ps(
467  valid_range_mask, nz_mask); // Filter out D=0 points
468  }
469  else
470  {
471  // We have both: D>Dmin and D<Dmax conditions, with XOR to
472  // optionally invert the selection:
473  const __m128 Dmin = _mm_load_ps(Dgt_ptr);
474  const __m128 Dmax = _mm_load_ps(Dlt_ptr);
475 
476  const __m128 gt_mask = _mm_cmpgt_ps(D, Dmin);
477  const __m128 lt_mask = _mm_and_ps(
478  _mm_cmplt_ps(D, Dmax), nz_mask); // skip points at zero
479  valid_range_mask =
480  _mm_and_ps(gt_mask, lt_mask); // (D>Dmin && D<Dmax)
481  valid_range_mask = _mm_xor_ps(valid_range_mask, xormask);
482  // Add the case of D_min & D_max = 0 (no filtering)
483  valid_range_mask = _mm_or_ps(
484  valid_range_mask, _mm_and_ps(
485  _mm_cmpeq_ps(Dmin, D_zeros),
486  _mm_cmpeq_ps(Dmax, D_zeros)));
487  // Finally, ensure no invalid ranges get thru:
488  valid_range_mask = _mm_and_ps(valid_range_mask, nz_mask);
489  }
490  }
491  const int valid_range_maski = _mm_movemask_epi8(
492  _mm_castps_si128(valid_range_mask)); // 0x{f|0}{f|0}{f|0}{f|0}
493  if (valid_range_maski != 0) // Any of the 4 values is valid?
494  {
495  const __m128 KY = _mm_load_ps(kys);
496  const __m128 KZ = _mm_load_ps(kzs);
497 
498  _mm_storeu_ps(xs, D);
499  _mm_storeu_ps(ys, _mm_mul_ps(KY, D));
500  _mm_storeu_ps(zs, _mm_mul_ps(KZ, D));
501 
502  for (int q = 0; q < 4; q++)
503  if ((valid_range_maski & (1 << (q * 4))) != 0)
504  {
505  pca.setPointXYZ(idx, xs[q], ys[q], zs[q]);
506  idxs_x[idx] = (c << 2) + q;
507  idxs_y[idx] = r;
508  ++idx;
509  }
510  else if (MAKE_ORGANIZED)
511  {
512  pca.setInvalidPoint(idx);
513  ++idx;
514  }
515  }
516  else if (MAKE_ORGANIZED)
517  {
518  for (int q = 0; q < 4; q++)
519  {
520  pca.setInvalidPoint(idx);
521  ++idx;
522  }
523  }
524  D_ptr += 4;
525  if (Dgt_ptr) Dgt_ptr += 4;
526  if (Dlt_ptr) Dlt_ptr += 4;
527  kys += 4;
528  kzs += 4;
529  }
530  }
531  pca.resize(idx);
532 #endif
533 }
534 } // namespace mrpt::obs::detail
mrpt::img::TCamera cameraParams
Projection parameters of the depth camera.
Mainly for internal use within CObservation3DRangeScan::project3DPointsFromDepthImageInto() ...
uint8_t decimation
(Default:1) If !=1, split the range image in blocks of DxD (D=decimation), and only generates one poi...
void resizePoints3DVectors(const size_t nPoints)
Use this method instead of resizing all three points3D_x, points3D_y & points3D_z to allow the usage ...
const mrpt::poses::CPose3D * robotPoseInTheWorld
(Default: nullptr) Read takeIntoAccountSensorPoseOnRobot
double fx() const
Get the value of the focal length x-value (in pixels).
Definition: TCamera.h:161
mrpt::math::CVectorFixedDouble< 3 > m_coords
The translation vector [x,y,z] access directly or with x(), y(), z() setter/getter methods...
Definition: CPose3D.h:96
const T * ptrLine(unsigned int row) const
Returns a pointer to the first pixel of the given line.
Definition: img/CImage.h:594
An adapter to different kinds of point cloud object.
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:3727
std::vector< uint16_t > points3D_idxs_x
If hasPoints3D=true, the (x,y) pixel coordinates for each (X,Y,Z) point in points3D_x, points3D_y, points3D_z.
mrpt::math::CMatrixF rangeImage
If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters) ...
void insertMatrix(const int row_start, const int col_start, const OTHERMATVEC &submat)
Copies the given input submatrix/vector into this matrix/vector, starting at the given top-left coord...
Definition: MatrixBase.h:210
double fy() const
Get the value of the focal length y-value (in pixels).
Definition: TCamera.h:163
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.
void range2XYZ(mrpt::opengl::PointCloudAdapter< POINTMAP > &pca, mrpt::obs::CObservation3DRangeScan &src_obs, const mrpt::obs::TRangeImageFilterParams &fp, const int H, const int W)
size_t getHeight() const override
Returns the height of the image in pixels.
Definition: CImage.cpp:878
uint8_t B
Definition: TColor.h:46
void do_project_3d_pointcloud_SSE2(const int H, const int W, const float *kys, const float *kzs, const mrpt::math::CMatrixF &rangeImage, mrpt::opengl::PointCloudAdapter< POINTMAP > &pca, std::vector< uint16_t > &idxs_x, std::vector< uint16_t > &idxs_y, const mrpt::obs::TRangeImageFilterParams &fp, bool MAKE_ORGANIZED)
uint8_t G
Definition: TColor.h:46
Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto()
unsigned char uint8_t
Definition: rptypes.h:44
const mrpt::math::CMatrixF * rangeMask_max
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:120
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:847
mrpt::poses::CPose3D relativePoseIntensityWRTDepth
Relative pose of the intensity camera wrt the depth camera (which is the coordinates origin for this ...
double cy() const
Get the value of the principal point y-coordinate (in pixels).
Definition: TCamera.h:159
An adapter to different kinds of point cloud object.
void composeFrom(const CPose3D &A, const CPose3D &B)
Makes "this = A (+) B"; this method is slightly more efficient than "this= A + B;" since it avoids th...
Definition: CPose3D.cpp:563
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
Definition: exceptions.h:137
const GLubyte * c
Definition: glext.h:6406
void project3DPointsFromDepthImageInto(mrpt::obs::CObservation3DRangeScan &src_obs, POINTMAP &dest_pointcloud, const mrpt::obs::T3DPointsProjectionParams &projectParams, const mrpt::obs::TRangeImageFilterParams &filterParams)
mrpt::img::CImage intensityImage
If hasIntensityImage=true, a color or gray-level intensity image of the same size than "rangeImage"...
bool hasRangeImage
true means the field rangeImage contains valid data
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Definition: exceptions.h:108
const mrpt::math::CMatrixF * rangeMask_min
(Default: nullptr) If provided, each data range will be tested to be greater-than (rangeMask_min) or ...
size_type rows() const
Number of rows in the matrix.
size_type cols() const
Number of columns in the matrix.
uint8_t R
Definition: TColor.h:46
void range2XYZ_LUT(mrpt::opengl::PointCloudAdapter< POINTMAP > &pca, mrpt::obs::CObservation3DRangeScan &src_obs, const mrpt::obs::T3DPointsProjectionParams &pp, const mrpt::obs::TRangeImageFilterParams &fp, const int H, const int W, const int DECIM=1)
const Scalar & coeff(int r, int c) const
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).
Definition: TCamera.h:157
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrixF.h:22
bool MAKE_ORGANIZED
(Default:false) set to true if you want an organized point cloud
GLdouble GLdouble GLdouble r
Definition: glext.h:3711
bool isColor() const
Returns true if the image is RGB, false if it is grayscale.
Definition: CImage.cpp:888
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot.
void homogeneousMatrixInverse(const MATRIXLIKE1 &M, MATRIXLIKE2 &out_inverse_M)
Efficiently compute the inverse of a 4x4 homogeneous matrix by only transposing the rotation 3x3 part...
CMatrixFixed< float, ROWS, COLS > cast_float() const
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:84
static TCached3DProjTables & get_3dproj_lut()
3D point cloud projection look-up-table
Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto()
bool hasIntensityImage
true means the field intensityImage contains valid data
void do_project_3d_pointcloud(const int H, const int W, const float *kys, const float *kzs, const mrpt::math::CMatrixF &rangeImage, mrpt::opengl::PointCloudAdapter< POINTMAP > &pca, std::vector< uint16_t > &idxs_x, std::vector< uint16_t > &idxs_y, const mrpt::obs::TRangeImageFilterParams &fp, bool MAKE_ORGANIZED, const int DECIM)
bool PROJ3D_USE_LUT
(Default:true) [Only used when range_is_depth=true] Whether to use a Look-up-table (LUT) to speed up ...
bool doDepthAndIntensityCamerasCoincide() const
Return true if relativePoseIntensityWRTDepth equals the pure rotation (0,0,0,-90deg,0,-90deg) (with a small comparison epsilon)
MATRIX44 getHomogeneousMatrixVal() const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
Definition: CPoseOrPoint.h:278
A RGB color - 8bit.
Definition: TColor.h:20
void getRotationMatrix(mrpt::math::CMatrixDouble33 &ROT) const
Get the 3x3 rotation matrix.
Definition: CPose3D.h:224
mrpt::img::TCamera cameraParamsIntensity
Projection parameters of the intensity (graylevel or RGB) camera.
bool range_is_depth
true: Kinect-like ranges: entries of rangeImage are distances along the +X axis; false: Ranges in ran...
bool takeIntoAccountSensorPoseOnRobot
(Default: false) If false, local (sensor-centric) coordinates of points are generated.
bool do_range_filter(size_t r, size_t c, const float D) const
Returns true if the point (r,c) with depth D passes all filters.
bool rangeCheckBetween
Only used if both rangeMask_min and rangeMask_max are present.
int round(const T value)
Returns the closer integer (int) to x.
Definition: round.h:23



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019