EgoVideoStabilizer
1.0.0
|
Main file that contains the main.cpp. More...
#include <stdio.h>
#include <iomanip>
#include <time.h>
#include <armadillo>
#include <boost/filesystem.hpp>
#include <cv.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/stitching/stitcher.hpp>
#include "definitions/experiments.h"
#include "definitions/define.h"
#include "executables/execute_commands.h"
#include "headers/homography.h"
#include "headers/sequence_processing.h"
#include "headers/master_frames.h"
#include "headers/line_and_point_operations.h"
#include "headers/image_reconstruction.h"
#include "headers/message_handler.h"
Functions | |
std::string | getItFormatted (int frame_number) |
getItFormatted - Formats the number with padding. More... | |
void | writeToOutput (cv::VideoWriter &save_video, cv::Mat &image, uint frame_number) |
writeToOutput - Writes the given image to the output (save_video and/or screen) More... | |
void | getStableFrameTemporally (cv::Mat &input_frame, cv::Mat &homography_matrix, const cv::Rect &drop_area, const cv::Rect &crop_area, int frame_number, int d, int D, cv::vector< int > &selected_frames, const std::vector< cv::KeyPoint > &keypoints_master_pre, const std::vector< cv::KeyPoint > &keypoints_master_pos, const cv::Mat &descriptors_master_pre, const cv::Mat &descriptors_master_pos, int attempt, MessageHandler &msg_handler, cv::Mat &stable_frame) |
getStableFrame - Returns a frame stabilized given the parameters. More... | |
void | getStableFrameSpatially (cv::Mat &input_frame, cv::Mat &homography_matrix, const cv::Rect &drop_area, const cv::Rect &crop_area, int frame_number, float s, float S, cv::vector< int > &selected_frames, const std::vector< cv::KeyPoint > &keypoints_master_pre, const std::vector< cv::KeyPoint > &keypoints_master_pos, const cv::Mat &descriptors_master_pre, const cv::Mat &descriptors_master_pos, int attempt, MessageHandler &msg_handler, cv::Mat &stable_frame) |
getStableFrameTemporally - Returns a frame stabilized given the parameters. More... | |
const std::string | currentDateTime () |
int | main (int argc, char *argv[]) |
main.cpp More... | |
Variables | |
int | log_number_length |
int | num_of_reconstructed_frames = 0 |
int | num_of_dropped_frames = 0 |
int | num_of_good_frames = 0 |
int | num_of_fails_in_homography = 0 |
int | saved_frames = 0 |
EXPERIMENT | experiment_settings |
Main file that contains the main.cpp.
const std::string currentDateTime | ( | ) |
std::string getItFormatted | ( | int | frame_number | ) |
getItFormatted - Formats the number with padding.
frame_number |
void getStableFrameSpatially | ( | cv::Mat & | input_frame, |
cv::Mat & | homography_matrix, | ||
const cv::Rect & | drop_area, | ||
const cv::Rect & | crop_area, | ||
int | frame_number, | ||
float | s, | ||
float | S, | ||
cv::vector< int > & | selected_frames, | ||
const std::vector< cv::KeyPoint > & | keypoints_master_pre, | ||
const std::vector< cv::KeyPoint > & | keypoints_master_pos, | ||
const cv::Mat & | descriptors_master_pre, | ||
const cv::Mat & | descriptors_master_pos, | ||
int | attempt, | ||
MessageHandler & | msg_handler, | ||
cv::Mat & | stable_frame | ||
) |
getStableFrameTemporally - Returns a frame stabilized given the parameters.
getStableFrameSpatially - Returns a frame stabilized given the parameters.
input_frame | |
homography_matrix | |
drop_area | |
crop_area | |
frame_number | |
s | - Spatial distance to the previous master (using the instability costs) |
S | - Spatial distance between the masters (using the instability costs) |
selected_frames | |
image_master_pre | |
image_master_pos | |
trial | - The number of the current attempt |
msg_handler | - The message handler |
stable_frame |
CASE 1: Homography makes it good, frame is kept.
CASE 2: Homography makes it regular, frame needs to be reconstructed
CASE 2.1: Homography makes it awful, a new frame needs to be selected
CASE 3: Homography makes it awful, a new frame needs to be selected
void getStableFrameTemporally | ( | cv::Mat & | input_frame, |
cv::Mat & | homography_matrix, | ||
const cv::Rect & | drop_area, | ||
const cv::Rect & | crop_area, | ||
int | frame_number, | ||
int | d, | ||
int | D, | ||
cv::vector< int > & | selected_frames, | ||
const std::vector< cv::KeyPoint > & | keypoints_master_pre, | ||
const std::vector< cv::KeyPoint > & | keypoints_master_pos, | ||
const cv::Mat & | descriptors_master_pre, | ||
const cv::Mat & | descriptors_master_pos, | ||
int | attempt, | ||
MessageHandler & | msg_handler, | ||
cv::Mat & | stable_frame | ||
) |
getStableFrame - Returns a frame stabilized given the parameters.
getStableFrameTemporally - Returns a frame stabilized given the parameters.
input_frame | |
homography_matrix | |
drop_area | |
crop_area | |
frame_number | |
d | |
D | |
selected_frames | |
image_master_pre | |
image_master_pos | |
trial | - The number of the current attempt |
stable_frame |
input_frame | |
homography_matrix | |
drop_area | |
crop_area | |
frame_number | |
d | - Temporal distance to the previous master |
D | - Temporal distance between the masters |
selected_frames | |
image_master_pre | |
image_master_pos | |
trial | - The number of the current attempt |
msg_handler | - The message handler |
stable_frame |
CASE 1: Homography makes it good, frame is kept.
CASE 2: Homography makes it regular, frame needs to be reconstructed
CASE 2.1: Homography makes it awful, a new frame needs to be selected
CASE 3: Homography makes it awful, a new frame needs to be selected
int main | ( | int | argc, |
char * | argv[] | ||
) |
Usage:
< Program_name > < Settings_file > [ Range_min = 0 ] [ Range_max = num_frames ]
Example 1: Run VideoStabilization in the Experiment_1 processing the whole video.
-> VideoStabilization Experiment_1.xml
Example 2: Run VideoStabilization in the Experiment_1 processing from the 150 frame until the last one.
-> VideoStabilization Experiment_1.xml 150
Example 2: Run VideoStabilization in the Experiment_1 processing from the 150 frame until the frame 490.
-> VideoStabilization Experiment_1.xml 150 490
The program can exit with following codes:
-1 - Wrong number of input parameters.
-2 - Experiment id does not exist.
-3 - Can not open the accelerated video.
-4 - Can not create file to save the output video.
-5 - Can not open the video original video.
-6 - Can not open the CSV file with the selected frame numbers of the accelerated video.
-7 - Can not create directory to save the output data.
-8 - Can not create log text file.
-9 - Range limits is not well defined.
-10 - Can not open the CSV file with the semantic costs of the original video.
-11 - transition from frame_src to frame_dst larger than number of transitions describle int the file the semantic costs
argc | - number of parameters in argv. |
argv | - < Settings_file > [ Range_min = 0 ] [ Range_max = num_frames ] |
WRITING THE RESULT TO THE OUTPUT ///
WRITING THE RESULT TO THE OUTPUT ///
THIS IS NOT A MASTER FRAME ///
THIS IS A MASTER FRAME ///
WRITING THE RESULT TO THE OUTPUT ///
WRITING THE RESULT TO THE OUTPUT ///
WRITING THE RESULT TO THE OUTPUT ///
void writeToOutput | ( | cv::VideoWriter & | save_video, |
cv::Mat & | image, | ||
uint | frame_number | ||
) |
writeToOutput - Writes the given image to the output (save_video and/or screen)
save_video | |
image | |
frame_number |
EXPERIMENT experiment_settings |
int log_number_length |
int num_of_dropped_frames = 0 |
int num_of_fails_in_homography = 0 |
int num_of_good_frames = 0 |
int num_of_reconstructed_frames = 0 |
int saved_frames = 0 |