21 const float bad_point = std::numeric_limits<float>::quiet_NaN();
38 std::string lcstr(dataType);
41 lcstr.begin(), lcstr.end(), lcstr.begin(), [](
unsigned char c) { return static_cast<char>(std::tolower(c)); });
45 return sizeof(std::uint8_t);
47 else if (lcstr ==
"uint16")
49 return sizeof(std::uint16_t);
51 else if (lcstr ==
"uint32")
53 return sizeof(std::uint32_t);
55 else if (lcstr ==
"uint64")
57 return sizeof(std::uint64_t);
67 std::cout << __FUNCTION__ <<
": Invalid Image size" << std::endl;
92 const double r2 = xp * xp + yp2;
93 const double r4 = r2 * r2;
97 const auto x =
static_cast<float>(xp * k);
98 const auto y =
static_cast<float>(yp * k);
103 s0 = std::sqrt(x * x + y * y + z * z) * 1000;
105 else if (
PLANAR == imgType)
111 std::cout <<
"Unknown image type for the point cloud transformation" << std::endl;
115 point.
x =
static_cast<float>(x / s0);
116 point.y =
static_cast<float>(y / s0);
117 point.z =
static_cast<float>(z / s0);
126 const ImageType& imgType,
127 std::vector<PointXYZ>& pointCloud)
134 size_t cloudSize = map.size();
135 pointCloud.resize(cloudSize);
143 auto itMap = map.begin();
145 auto itPC = pointCloud.begin();
146 for (uint32_t
i = 0;
i < cloudSize; ++
i, ++itPC, ++itMap, ++itUndistorted)
152 if (*itMap == 0 || *itMap == uint16_t(0xFFFF))
161 float distance =
static_cast<float>((*itMap)) * pixelSizeZ;
162 point.x = itUndistorted->x * distance;
163 point.y = itUndistorted->y * distance;
164 point.z = itUndistorted->z * distance - f2rc;
178 for (
auto& it : pointCloud)
180 const double x = it.x;
181 const double y = it.y;
182 const double z = it.z;
224 auto seconds{std::chrono::seconds{::_mkgmtime(&tm)}};
226 auto seconds{std::chrono::seconds{::timegm(&tm)}};
228 const uint64_t timestamp =
229 static_cast<uint64_t
>(std::chrono::duration_cast<std::chrono::milliseconds>(seconds).count())