EgoVideoStabilizer
1.0.0
|
Functions to manipulate files. More...
#include "headers/file_operations.h"
Functions | |
std::vector< int > | loadMasterFramesFromFile (const EXPERIMENT &experiment_settings) |
Function to load the master frames from a file defined in the field read_masterframes_filename in the experiment_settings. More... | |
bool | saveMasterFramesToFile (const EXPERIMENT &experiment_settings, const std::vector< int > masters_frames) |
Function to save the calculated master frames into a file defined in the field save_masterframes_filename in the experiment_settings. More... | |
void | readSelectedFramesCSV (std::string filename, std::vector< int > &selected_frames) |
Function to read a CSV composed by frames selected by the selection algorithm. More... | |
std::string | getExperimentId () |
Function that manages the experiments ID automatically. More... | |
std::istream & | goToLine (std::istream &file, const unsigned int line) |
Function that set the file pointer to the desired line, if it is smaller than the file number of lines. More... | |
double | getSemanticCost (const EXPERIMENT &experiment_settings, const int frame_src, const int frame_dst) |
Function that returns the semantic cost of the transition from the frame_src to the frame_dst. More... | |
std::vector< std::vector< double > > | loadInstabilityCostsFromFile (const EXPERIMENT &experiment_settings) |
loadInstabilityCostsFromFile Loads the instability costs from a CSV file (matrix format). More... | |
std::vector< std::vector< double > > | loadOpticalFlow (const EXPERIMENT &experiment_settings) |
loadOpticalFlow Loads the Optical Flow calculated by the FlowNet from a CSV file. More... | |
bool | str2bool (std::string str) |
str2bool convert a string to boolean. More... | |
std::string | filter_string (std::string str) |
filter_string filter a string to remove white spaces and line break. More... | |
Functions to manipulate files.
Functions to read from TXT and CSV files, write data on files.
std::string filter_string | ( | std::string | str | ) |
filter_string filter a string to remove white spaces and line break.
string |
std::string getExperimentId | ( | ) |
Function that manages the experiments ID automatically.
std::string
- The experiment id formatted by 4 digitsdouble getSemanticCost | ( | const EXPERIMENT & | experiment_settings, |
const int | frame_src, | ||
const int | frame_dst | ||
) |
Function that returns the semantic cost of the transition from the frame_src to the frame_dst.
Function that returns the semantic cost of the transiction from the frame_src to the frame_dst.
The file where the semantic cost will be find is defined in the experiment_settings
experiment_settings | - variable with the experiment setting. |
frame_src | - first frame of the transition. |
frame_dst | - last frame of the transition. |
double
- The semantic cost of the transiction of the frame_src to the frame_dst. Returns the complementary value ( 1 - x ).std::istream& goToLine | ( | std::istream & | file, |
const unsigned int | line | ||
) |
Function that set the file pointer to the desired line, if it is smaller than the file number of lines.
file | - std::ifstream object where the file is read. |
line | - line where the header read will be set. |
std::istream
- Reference to the file in the selected line.std::vector< std::vector<double> > loadInstabilityCostsFromFile | ( | const EXPERIMENT & | experiment_settings | ) |
loadInstabilityCostsFromFile Loads the instability costs from a CSV file (matrix format).
experiment_settings |
std::vector<int> loadMasterFramesFromFile | ( | const EXPERIMENT & | experiment_settings | ) |
Function to load the master frames from a file defined in the field read_masterframes_filename in the experiment_settings.
experiment_settings | - variable with the experiment setting. |
std::vector
- vector of master frames loaded from file describle in the experiment settings.std::vector< std::vector<double> > loadOpticalFlow | ( | const EXPERIMENT & | experiment_settings | ) |
loadOpticalFlow Loads the Optical Flow calculated by the FlowNet from a CSV file.
experiment_settings |
void readSelectedFramesCSV | ( | std::string | filename, |
std::vector< int > & | selected_frames | ||
) |
Function to read a CSV composed by frames selected by the selection algorithm.
filename | - std::string with the filename of the CSV file that contains the selected frames of the reduced video. |
selected_frames | - vector to save the selected frames. |
void
bool saveMasterFramesToFile | ( | const EXPERIMENT & | experiment_settings, |
const std::vector< int > | masters_frames | ||
) |
Function to save the calculated master frames into a file defined in the field save_masterframes_filename in the experiment_settings.
experiment_settings | - variable with the experiment setting. |
masters_frames | - vector of master frames to be saved in file describle in the experiment settings. |
bool
true - if the writer return sucess while writing the file. bool
false - if the writer return fail while writing the file.bool str2bool | ( | std::string | str | ) |
str2bool convert a string to boolean.
string |