EgoVideoStabilizer  1.0.0
file_operations.h File Reference

Header functions for the file_operations.cpp. More...

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <iomanip>
#include <limits>
#include <boost/tokenizer.hpp>
#include <boost/algorithm/string.hpp>
#include "definitions/experiment_struct.h"
Include dependency graph for file_operations.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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...
 
double getSemanticCost (const EXPERIMENT &experiment_settings, const int frame_src, const int frame_dst)
 Function that returns the semantic cost of the transiction 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...
 

Detailed Description

Header functions for the file_operations.cpp.

Function Documentation

std::string filter_string ( std::string  str)

filter_string filter a string to remove white spaces and line break.

Parameters
str- string to be filtered
Returns
str - filtered string
Author
Felipe Cadar Chamone
Date
14/07/2017
Parameters
string
Returns
string
Author
Felipe Cadar Chamone
Date
14/07/2017
std::string getExperimentId ( )

Function that manages the experiments ID automatically.

Returns
std::string - The experiment id formatted by 4 digits
Author
Washington Luis de Souza Ramos
Date
19/04/2016
double getSemanticCost ( const EXPERIMENT experiment_settings,
const int  frame_src,
const int  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

Parameters
experiment_settings- variable with the experiment setting.
frame_src- first frame of the transition.
frame_dst- last frame of the transition.
Returns
double - The semantic cost of the transiction of the frame_src to the frame_dst. Returns the complementary value ( 1 - x ).
Author
Michel Melo da Silva
Date
30/04/2016

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

Parameters
experiment_settings- variable with the experiment setting.
frame_src- first frame of the transition.
frame_dst- last frame of the transition.
Returns
double - The semantic cost of the transiction of the frame_src to the frame_dst. Returns the complementary value ( 1 - x ).
Author
Michel Melo da Silva
Date
30/04/2016
std::vector< std::vector<double> > loadInstabilityCostsFromFile ( const EXPERIMENT experiment_settings)

loadInstabilityCostsFromFile Loads the instability costs from a CSV file (matrix format).

Parameters
experiment_settings
Returns
The matrix of instability costs
Author
Washington Luis de Souza Ramos
Date
12/09/2016
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.

Parameters
experiment_settings- variable with the experiment setting.
Returns
std::vector - vector of master frames loaded from file describle in the experiment settings.
Author
Michel Melo da Silva
Date
08/04/2016
std::vector< std::vector<double> > loadOpticalFlow ( const EXPERIMENT experiment_settings)

loadOpticalFlow Loads the Optical Flow calculated by the FlowNet from a CSV file.

Parameters
experiment_settings
Returns
Vector[j][i] with the optical flow from the image j to j+1 (i=0 is dx and i=1 is dy).
Author
Michel Melo da Silva
Date
09/01/2017
void readSelectedFramesCSV ( std::string  filename,
std::vector< int > &  selected_frames 
)

Function to read a CSV composed by frames selected by the selection algorithm.

Parameters
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.
Returns
void
Author
Washington Luis de Souza Ramos
Date
14/04/2016
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.

Parameters
experiment_settings- variable with the experiment setting.
masters_frames- vector of master frames to be saved in file describle in the experiment settings.
Returns
bool true - if the writer return sucess while writing the file.
bool false - if the writer return fail while writing the file.
Author
Michel Melo da Silva
Date
08/04/2016
bool str2bool ( std::string  str)

str2bool convert a string to boolean.

Parameters
str- string to convert
Returns
boolean
Author
Felipe Cadar Chamone
Date
14/07/2017
Parameters
string
Returns
boolean
Author
Felipe Cadar Chamone
Date
14/07/2017