66 name =
"XYZRGBNormal";
102 UFATAL(
"Unhandled type %d!", (
int)format);
126 const cv::Mat & oldScanFormat,
131 if(!oldScanFormat.empty())
133 if(oldScanFormat.channels() == 2)
135 return LaserScan(oldScanFormat, maxPoints, maxRange,
kXY, localTransform);
137 else if(oldScanFormat.channels() == 3)
139 return LaserScan(oldScanFormat, maxPoints, maxRange,
kXYZ, localTransform);
141 else if(oldScanFormat.channels() == 4)
143 return LaserScan(oldScanFormat, maxPoints, maxRange,
kXYZRGB, localTransform);
145 else if(oldScanFormat.channels() == 5)
149 else if(oldScanFormat.channels() == 6)
153 else if(oldScanFormat.channels() == 7)
162 const cv::Mat & oldScanFormat,
170 if(!oldScanFormat.empty())
172 if(oldScanFormat.channels() == 2)
174 return LaserScan(oldScanFormat,
kXY, minRange, maxRange, angleMin, angleMax, angleInc, localTransform);
176 else if(oldScanFormat.channels() == 3)
178 return LaserScan(oldScanFormat,
kXYZ, minRange, maxRange, angleMin, angleMax, angleInc, localTransform);
180 else if(oldScanFormat.channels() == 4)
182 return LaserScan(oldScanFormat,
kXYZRGB, minRange, maxRange, angleMin, angleMax, angleInc, localTransform);
184 else if(oldScanFormat.channels() == 5)
186 return LaserScan(oldScanFormat,
kXYNormal, minRange, maxRange, angleMin, angleMax, angleInc, localTransform);
188 else if(oldScanFormat.channels() == 6)
190 return LaserScan(oldScanFormat,
kXYZNormal, minRange, maxRange, angleMin, angleMax, angleInc, localTransform);
192 else if(oldScanFormat.channels() == 7)
194 return LaserScan(oldScanFormat,
kXYZRGBNormal, minRange, maxRange, angleMin, angleMax, angleInc, localTransform);
233 const cv::Mat &
data,
239 init(data, format, 0, maxRange, 0, 0, 0, maxPoints, localTransform);
269 const cv::Mat &
data,
275 float angleIncrement,
278 init(data, format, minRange, maxRange, angleMin, angleMax, angleIncrement, 0, localTransform);
282 const cv::Mat &
data,
288 float angleIncrement,
292 UASSERT(data.empty() || data.rows == 1);
293 UASSERT(data.empty() || data.type() == CV_8UC1 || data.type() == CV_32FC2 || data.type() == CV_32FC3 || data.type() == CV_32FC(4) || data.type() == CV_32FC(5) || data.type() == CV_32FC(6) || data.type() == CV_32FC(7));
297 if(angleIncrement != 0.0
f)
302 UASSERT((angleIncrement>0 && angleMax>angleMin) || (angleIncrement<0 && angleMax<angleMin));
325 UWARN(
"The number of points (%d) in the scan is over the maximum " 326 "points (%d) defined by angle settings (min=%f max=%f inc=%f). " 327 "The scan info may be wrong!",
332 UDEBUG(
"The number of points (%d) in the scan is over the maximum " 333 "points (%d) defined by max points setting.",
372 UASSERT(channelOffset < (
unsigned int)
data_.channels());
373 return data_.ptr<
float>(0, pointIndex)[channelOffset];
402 dest = this->
clone();
GLM_FUNC_DECL bool all(vecType< bool, P > const &v)
const cv::Mat & data() const
Some conversion functions.
static bool isScanHasNormals(const Format &format)
float & field(unsigned int pointIndex, unsigned int channelOffset)
#define UASSERT(condition)
void init(const cv::Mat &data, Format format, float minRange, float maxRange, float angleMin, float angleMax, float angleIncrement, int maxPoints, const Transform &localTransform=Transform::getIdentity())
#define UASSERT_MSG(condition, msg_str)
static bool isScanHasRGB(const Format &format)
LaserScan & operator+=(const LaserScan &)
LaserScan operator+(const LaserScan &)
bool isCompressed() const
ULogger class and convenient macros.
static bool isScan2d(const Format &format)
Transform localTransform_
float angleIncrement() const
std::string formatName() const
static bool isScanHasIntensity(const Format &format)
std::string UTILITE_EXP uFormat(const char *fmt,...)
static LaserScan backwardCompatibility(const cv::Mat &oldScanFormat, int maxPoints=0, int maxRange=0, const Transform &localTransform=Transform::getIdentity())
GLM_FUNC_DECL genType ceil(genType const &x)
Transform localTransform() const