4#include <stb_image/stb_image.h>
38inline unsigned char strtouc(
const std::string &str) {
39 return static_cast<unsigned char>(std::strtoul(str.c_str(),
nullptr, 10));
43 return static_cast<size_t>(atoi(str.c_str()));
72 char delimiter = str.find(
" ") != std::string::npos ?
' ' :
',';
76 size_t end = str.find(delimiter);
79 while (index != 2 && end != std::string::npos) {
80 result[index++] =
strtodecimal(str.substr(start, end - start));
82 end = str.find(delimiter, start);
87 while (index != 3) result[index++] = 0;
101 return str.size() != 0 && str !=
"0" && str !=
"false";
119 throw std::runtime_error(
"Could not load image " + str +
": " + stbi_failure_reason());
128 std::ifstream stream(str);
144 if (str.size() >= 6) {
145 if (str.substr(str.size() - 6) ==
".found") {
146 LOG_INFO(
"Getting Position Data from Data File (*.found)");
152 LOG_INFO(
"Getting Position Data from non-Data File (not *.found)");
154 std::ifstream file(str);
155 if (!file.is_open()) {
156 throw std::runtime_error(
"Could not open file " + str);
160 while (std::getline(file, line)) {
161 std::istringstream iss(line);
165 throw std::runtime_error(
"Invalid format for file " + str +
": " + line);
167 records.push_back(record);
An EulerAngle is a mutable Object representing Euler Angles of a 3D point.
Definition attitude-utils.hpp:165
decimal z
The z coordinate.
Definition attitude-utils.hpp:54
decimal y
The y coordinate.
Definition attitude-utils.hpp:52
decimal x
The x coordinate.
Definition attitude-utils.hpp:50
Declares data structures for serialized spatial data files, including headers, location records,...
double decimal
Definition decimal.hpp:15
#define STR_TO_DECIMAL(x)
Definition decimal.hpp:16
#define LOG_INFO(msg)
Definition logging.hpp:115
Definition calibrate.cpp:7
DataFile strtodf(const std::string &str)
Definition converters.hpp:127
constexpr decimal DegToRad(decimal deg)
Converts an angle in degrees to radians.
Definition attitude-utils.hpp:329
LocationRecords strtolr(const std::string &str)
Converts a string to a vector of location records.
Definition converters.hpp:143
std::vector< LocationRecord > LocationRecords
A collection of Location Records.
Definition style.hpp:105
Image strtoimage(const std::string &str)
Converts a string to an image.
Definition converters.hpp:115
size_t strtosize(const std::string &str)
Definition converters.hpp:42
decimal strtodecimal(const std::string &str)
Converts a string to a decimal.
Definition converters.hpp:56
unsigned char strtouc(const std::string &str)
Converts a string to an unsigned char.
Definition converters.hpp:38
bool strtobool(const std::string &str)
Converts the string to a bool.
Definition converters.hpp:100
DataFile deserializeDataFile(std::istream &stream)
Deserializes a DataFile object from an input stream.
Definition serialization.cpp:263
EulerAngles strtoea(const std::string &str)
Converts a string to euler angles.
Definition converters.hpp:71
Represents a complete serialized data file.
Definition datafile.hpp:61
std::unique_ptr< LocationRecord[]> positions
Collection of location records in the file.
Definition datafile.hpp:75
DataFileHeader header
Metadata header for the file (includes magic, version, and CRC).
Definition datafile.hpp:65
Represents an image.
Definition style.hpp:34
unsigned char * image
The image contents.
Definition style.hpp:49
int channels
The image channels.
Definition style.hpp:40
int height
The image height.
Definition style.hpp:38
int width
The image width.
Definition style.hpp:36
Represents a single spatial data point with position and timestamp.
Definition style.hpp:91
Vec3 position
3D position of the recorded data point.
Definition style.hpp:100
uint64_t timestamp
Timestamp associated with the position, in microseconds or appropriate units.
Definition style.hpp:95