Skip to content

Commit 15c2af7

Browse files
authored
Merge pull request #5296 from mvieth/range_image_optional_cropping
Add option to RangeImage to turn cropping off
2 parents e05d427 + 3d8d7af commit 15c2af7

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

common/include/pcl/range_image/impl/range_image.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,11 @@ RangeImage::createFromPointCloud (const PointCloudType& point_cloud,
135135
int top=height, right=-1, bottom=-1, left=width;
136136
doZBuffer (point_cloud, noise_level, min_range, top, right, bottom, left);
137137

138-
cropImage (border_size, top, right, bottom, left);
138+
if (border_size != std::numeric_limits<int>::min()) {
139+
cropImage (border_size, top, right, bottom, left);
139140

140-
recalculate3DPointPositions ();
141+
recalculate3DPointPositions ();
142+
}
141143
}
142144

143145
/////////////////////////////////////////////////////////////////////////
@@ -196,9 +198,11 @@ RangeImage::createFromPointCloudWithKnownSize (const PointCloudType& point_cloud
196198
int top=height, right=-1, bottom=-1, left=width;
197199
doZBuffer (point_cloud, noise_level, min_range, top, right, bottom, left);
198200

199-
cropImage (border_size, top, right, bottom, left);
201+
if (border_size != std::numeric_limits<int>::min()) {
202+
cropImage (border_size, top, right, bottom, left);
200203

201-
recalculate3DPointPositions ();
204+
recalculate3DPointPositions ();
205+
}
202206
}
203207

204208
/////////////////////////////////////////////////////////////////////////

common/include/pcl/range_image/range_image.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ namespace pcl
139139
* but the mean of the points. If 0.0 it is equivalent to a normal z-buffer and
140140
* will always take the minimum per cell.
141141
* \param min_range the minimum visible range (defaults to 0)
142-
* \param border_size the border size (defaults to 0)
142+
* \param border_size the border size (defaults to 0). Set to `std::numeric_limits<int>::min()` to turn cropping off.
143143
*/
144144
template <typename PointCloudType> void
145145
createFromPointCloud (const PointCloudType& point_cloud, float angular_resolution=pcl::deg2rad (0.5f),
@@ -163,7 +163,7 @@ namespace pcl
163163
* but the mean of the points. If 0.0 it is equivalent to a normal z-buffer and
164164
* will always take the minimum per cell.
165165
* \param min_range the minimum visible range (defaults to 0)
166-
* \param border_size the border size (defaults to 0)
166+
* \param border_size the border size (defaults to 0). Set to `std::numeric_limits<int>::min()` to turn cropping off.
167167
*/
168168
template <typename PointCloudType> void
169169
createFromPointCloud (const PointCloudType& point_cloud,
@@ -186,7 +186,7 @@ namespace pcl
186186
* but the mean of the points. If 0.0 it is equivalent to a normal z-buffer and
187187
* will always take the minimum per cell.
188188
* \param min_range the minimum visible range (defaults to 0)
189-
* \param border_size the border size (defaults to 0)
189+
* \param border_size the border size (defaults to 0). Set to `std::numeric_limits<int>::min()` to turn cropping off.
190190
*/
191191
template <typename PointCloudType> void
192192
createFromPointCloudWithKnownSize (const PointCloudType& point_cloud, float angular_resolution,
@@ -211,7 +211,7 @@ namespace pcl
211211
* but the mean of the points. If 0.0 it is equivalent to a normal z-buffer and
212212
* will always take the minimum per cell.
213213
* \param min_range the minimum visible range (defaults to 0)
214-
* \param border_size the border size (defaults to 0)
214+
* \param border_size the border size (defaults to 0). Set to `std::numeric_limits<int>::min()` to turn cropping off.
215215
*/
216216
template <typename PointCloudType> void
217217
createFromPointCloudWithKnownSize (const PointCloudType& point_cloud,
@@ -232,7 +232,7 @@ namespace pcl
232232
* but the mean of the points. If 0.0 it is equivalent to a normal z-buffer and
233233
* will always take the minimum per cell.
234234
* \param min_range the minimum visible range (defaults to 0)
235-
* \param border_size the border size (defaults to 0)
235+
* \param border_size the border size (defaults to 0). Set to `std::numeric_limits<int>::min()` to turn cropping off.
236236
* \note If wrong_coordinate_system is true, the sensor pose will be rotated to change from a coordinate frame
237237
* with x to the front, y to the left and z to the top to the coordinate frame we use here (x to the right, y
238238
* to the bottom and z to the front) */
@@ -256,7 +256,7 @@ namespace pcl
256256
* but the mean of the points. If 0.0 it is equivalent to a normal z-buffer and
257257
* will always take the minimum per cell.
258258
* \param min_range the minimum visible range (defaults to 0)
259-
* \param border_size the border size (defaults to 0)
259+
* \param border_size the border size (defaults to 0). Set to `std::numeric_limits<int>::min()` to turn cropping off.
260260
* \note If wrong_coordinate_system is true, the sensor pose will be rotated to change from a coordinate frame
261261
* with x to the front, y to the left and z to the top to the coordinate frame we use here (x to the right, y
262262
* to the bottom and z to the front) */

0 commit comments

Comments
 (0)