38 #include <boost/filesystem.hpp> 39 #include <opencv2/opencv.hpp> 41 #ifndef DIRECTORY_SEPARATOR 42 #if defined(WIN32) || defined(_WIN32) 43 #define DIRECTORY_SEPARATOR "\\" 45 #define DIRECTORY_SEPARATOR "/" 60 static int readMat(boost::filesystem::path file, cv::Mat &mat, std::string field =
"mat");
71 static int writeMat(boost::filesystem::path file,
const cv::Mat& mat,
72 std::string field =
"mat");
84 static int writeArrayCSV(boost::filesystem::path file, T** array,
int rows,
int cols,
85 std::string separator =
",",
int precision = 6);
98 static int writeMatCSV(boost::filesystem::path file,
const cv::Mat& mat,
99 std::string separator =
",",
int precision = 6);
106 static int readMatCSVInt(boost::filesystem::path file, cv::Mat &result);
115 static int readMatCSVInt(boost::filesystem::path file,
int rows,
int cols, cv::Mat &result);
122 static int readMatCSVFloat(boost::filesystem::path file, cv::Mat &result);
128 static int readCSVHeaderString(boost::filesystem::path file, std::vector<std::string> &header);
136 static int readCSVSummary(boost::filesystem::path file, std::vector<std::string>& row_headers,
137 std::vector<std::string>& col_headers, cv::Mat &data);
144 std::multimap<std::string, boost::filesystem::path> subdirectories);
158 std::vector<std::string> extensions,
159 std::multimap<std::string, boost::filesystem::path> &files,
160 std::string prefix =
"", std::string suffix =
"",
161 std::vector<std::string> exclude = std::vector<std::string>{});
171 std::multimap<std::string, boost::filesystem::path> &files,
172 std::string prefix =
"", std::string suffix =
"");
static int writeMat(boost::filesystem::path file, const cv::Mat &mat, std::string field="mat")
Write a matrix to the given file.
Definition: io_util.cpp:59
static void getImageExtensions(std::vector< std::string > &extensions)
Gets a vector containing common extensions for images.
Definition: io_util.cpp:265
static int readMatCSVInt(boost::filesystem::path file, cv::Mat &result)
Read CSV file into matrix.
Definition: io_util.cpp:301
static int writeArrayCSV(boost::filesystem::path file, T **array, int rows, int cols, std::string separator=",", int precision=6)
Write two dimensional array to CSV file.
Definition: io_util.cpp:75
static int readCSVHeaderString(boost::filesystem::path file, std::vector< std::string > &header)
Read header of CSV file into string array.
Definition: io_util.cpp:409
I/O utilities.
Definition: io_util.h:52
static void getTxtExtensions(std::vector< std::string > &extensions)
Gets a vector containing common extensions for text files.
Definition: io_util.cpp:281
static void readDirectory(boost::filesystem::path directory, std::vector< std::string > extensions, std::multimap< std::string, boost::filesystem::path > &files, std::string prefix="", std::string suffix="", std::vector< std::string > exclude=std::vector< std::string >{})
Creates an ordered multimap of all files in the given directory.
Definition: io_util.cpp:205
static int readMat(boost::filesystem::path file, cv::Mat &mat, std::string field="mat")
Read an OpenCV matrix.
Definition: io_util.cpp:42
static int readMatCSVFloat(boost::filesystem::path file, cv::Mat &result)
Read CSV file into matrix.
Definition: io_util.cpp:355
static void listSubdirectories(boost::filesystem::path directory, std::multimap< std::string, boost::filesystem::path > subdirectories)
Creates an ordered list of all subdirectories.
Definition: io_util.cpp:144
static void getCSVExtensions(std::vector< std::string > &extensions)
Get a vector of common CSV extensions.
Definition: io_util.cpp:291
static int writeMatCSV(boost::filesystem::path file, const cv::Mat &mat, std::string separator=",", int precision=6)
Write the content of a cv::Mat to a CSV file.
Definition: io_util.cpp:107
static int readCSVSummary(boost::filesystem::path file, std::vector< std::string > &row_headers, std::vector< std::string > &col_headers, cv::Mat &data)
Read a CSV summary file as produced by EvaluationSummary.
Definition: io_util.cpp:435