EgoVideoStabilizer  1.0.0
sequence_processing.cpp File Reference

Functions related with sequence processing, such as find intermediate homography, get transition weight, select new frame. More...

Include dependency graph for sequence_processing.cpp:

Functions

bool matrixRoot (cv::Mat &matrix, int root, cv::Mat &matrix_result)
 Function that calculates the n-ith root of a matrix. More...
 
void matrixPow (cv::Mat &matrix, int pow, cv::Mat &matrix_result)
 Function that calculates the n-ith pow of a matrix. More...
 
bool findIntermediateHomographyMatrix (const int d, const int D, const int N, const cv::Mat &frame_i, const cv::Mat &frame_master_pre, const cv::Mat &frame_master_pos, cv::Mat &homography_matrix_result)
 Function that calculates the homography matrix that leave the frame_i to the intermediate plan between the plans of frame_master_pre and frame_master_pre with relation of the distance between them. More...
 
bool findIntermediateHomographyMatrix (const int d, const int D, const int N, const cv::Mat &frame_i, 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, cv::Mat &homography_matrix_result)
 Function that calculates the homography matrix that leave the frame_i to the intermediate plan between the frames related to the previous and posterior master, with respect to the distance between them. More...
 
bool findIntermediateHomographyMatrix (const float s, const float S, const cv::Mat &frame_i, 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, cv::Mat &homography_matrix_result)
 Function that calculates the homography matrix that leave the frame_i to the intermediate plan between the frames related to the previous and posterior master, with respect to the distance between them. More...
 
double gaussianValue (double index)
 Function that calculates Gaussian value in the position index. More...
 
float frameWeight (const int ransac_inliers_previous, const int ransac_inliers_posterior, const double area_ratio, const double semantic_weight)
 Function that calculates the frame weigth used to chose a new frame to compose the video. More...
 
double semantic_weight (const int index_previous, const int index_current, const int index_posterior, const EXPERIMENT &experiment_settings)
 Function that get the semantic information of the transition from the frame_src to the frame_dst calculted by MATLAB and saved in a CSV file. More...
 
int selectNewFrame (const int d, const int D, const int N, const int index, const int index_previous, const int index_posterior, 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, const cv::Rect &crop_area, const EXPERIMENT &experiment_settings, cv::Mat &new_frame)
 Function that selects a new frame in the original video using the values of semantic information of the transition from the frame_src to the frame_dst calculted by MATLAB and saved in a CSV file, the area ratio of the iamge after apply the homography transformation and the RANSCAC inliers from the previous and posterior frames that compose the reduced video. More...
 
int selectNewFrame (const float s, const float S, const int index, const int index_previous, const int index_posterior, 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, const cv::Rect &crop_area, const EXPERIMENT &experiment_settings, cv::Mat &new_frame)
 Function that selects a new frame in the original video using the values of semantic information of the transition from the frame_src to the frame_dst calculted by MATLAB and saved in a CSV file, the area ratio of the iamge after apply the homography transformation and the RANSCAC inliers from the previous and posterior frames that compose the reduced video. More...
 

Detailed Description

Functions related with sequence processing, such as find intermediate homography, get transition weight, select new frame.

Calculate intermediate homography matrix. Calculate matrix operations root and pow. Calculate frame weight. Get transition weight. Select new frame from original video.

Function Documentation

bool findIntermediateHomographyMatrix ( const int  d,
const int  D,
const int  N,
const cv::Mat &  frame_i,
const cv::Mat &  frame_master_pre,
const cv::Mat &  frame_master_pos,
cv::Mat &  homography_matrix_result 
)

Function that calculates the homography matrix that leave the frame_i to the intermediate plan between the plans of frame_master_pre and frame_master_pre with relation of the distance between them.

Parameters
d- distance between the current frame and the previous master frame.
D- distance between previous master frame and the posterior master frame.
N- size of the segments.
frame_i- current frame.
frame_master_pre- image of the previous master frame.
frame_master_pos- image of the posterior master frame.
homography_matrix_result- object to save the result homography matrix.
Returns
bool true - if there is enough points in both images and good matches between them to find a homography matrix.
bool false - if there is not enough points in both images or good matches between them to find a homography matrix.
Author
Michel Melo da Silva
Date
04/04/2016
bool findIntermediateHomographyMatrix ( const int  d,
const int  D,
const int  N,
const cv::Mat &  frame_i,
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,
cv::Mat &  homography_matrix_result 
)

Function that calculates the homography matrix that leave the frame_i to the intermediate plan between the frames related to the previous and posterior master, with respect to the distance between them.

Parameters
d- distance between the current frame and the previous master frame.
D- distance between previous master frame and the posterior master frame.
N- size of the segments.
frame_i- current frame.
keypoints_master_pre- keypoints of the previous master.
keypoints_master_pos- keypoints of the posterior master.
descriptors_master_pre- descriptors of the previous master.
descriptors_master_pos- descriptors of the posterior master.
homography_matrix_result- object to save the result homography matrix.
Returns
bool true - if there is enough points in both images and good matches between them to find a homography matrix.
bool false - if there is not enough points in both images or good matches between them to find a homography matrix.
Author
Washington Luis de Souza Ramos
Date
30/08/2016
bool findIntermediateHomographyMatrix ( const float  s,
const float  S,
const cv::Mat &  frame_i,
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,
cv::Mat &  homography_matrix_result 
)

Function that calculates the homography matrix that leave the frame_i to the intermediate plan between the frames related to the previous and posterior master, with respect to the distance between them.

Parameters
s- frame shift value between the previous master frame and the current frame.
S- frame shift between previous master frame and the posterior master frame.
frame_i- current frame.
keypoints_master_pre- keypoints of the previous master.
keypoints_master_pos- keypoints of the posterior master.
descriptors_master_pre- descriptors of the previous master.
descriptors_master_pos- descriptors of the posterior master.
homography_matrix_result- object to save the result homography matrix.
Returns
bool true - if there is enough points in both images and good matches between them to find a homography matrix.
bool false - if there is not enough points in both images or good matches between them to find a homography matrix.
Author
Washington Luis de Souza Ramos
Date
08/09/2016
float frameWeight ( const int  ransac_inliers_previous,
const int  ransac_inliers_posterior,
const double  area_ratio,
const double  semantic_weight 
)

Function that calculates the frame weigth used to chose a new frame to compose the video.

Parameters
ransac_inliers_previous- RANSAC inliers between the frame and the previous frame used.
ransac_inliers_posterior- RANSAC inliers between the frame and the posterior frame used.
area_ratio- percentage of area into the crop area that the frame occupy after apply the intermediate homography matrix.
semantic_weight- semantic information contained in the transition from previous index, passing by index, up to posterior index.
Returns
double - value of the frame weight.
Author
Michel Melo da Silva
Date
20/04/2016
double gaussianValue ( double  index)

Function that calculates Gaussian value in the position index.

Parameters
index- index in the Gaussian function.
Returns
double - value of the Gaussian function int the position index.
Author
Michel Melo da Silva
Date
20/04/2016
void matrixPow ( cv::Mat &  matrix,
int  pow,
cv::Mat &  matrix_result 
)

Function that calculates the n-ith pow of a matrix.

Uses the Armadillo lib.

See also
http://arma.sourceforge.net/
Parameters
matrix- matrix to calculate the pow-th pow.
pow- pow index.
matrix_result- object to save the result of the matrix pow.
Returns
void
Author
Washington Luis de Souza Ramos
Date
06/04/2016
bool matrixRoot ( cv::Mat &  matrix,
int  root,
cv::Mat &  matrix_result 
)

Function that calculates the n-ith root of a matrix.

Uses the Armadillo lib.

See also
http://arma.sourceforge.net/
Parameters
matrix- matrix to calculate the root-th root.
root- root index.
matrix_result- object to save the result of the matrix root.
Returns
bool true - if the root can be found.
bool false - if the root can not be found.
Author
Michel Melo da Silva
Date
05/05/2016
int selectNewFrame ( const int  d,
const int  D,
const int  N,
const int  index,
const int  index_previous,
const int  index_posterior,
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,
const cv::Rect &  crop_area,
const EXPERIMENT experiment_settings,
cv::Mat &  new_frame 
)

Function that selects a new frame in the original video using the values of semantic information of the transition from the frame_src to the frame_dst calculted by MATLAB and saved in a CSV file, the area ratio of the iamge after apply the homography transformation and the RANSCAC inliers from the previous and posterior frames that compose the reduced video.

Parameters
d- distance between the current frame and the previous master frame.
D- distance between previous master frame and the posterior master frame.
N- size of the segments.
index- index of the frame that will be replaced.
index_previous- index of the last frame in the reduced video.
index_posterior- index of the next frame in the reduced video.
image_master_previous- image with the master previous
image_master_posterior- image with the master posterior
crop_area- crop area of the video.
experiment_settings- experiment settings struct.
new_frame- image that will receive the new selected frame.
Returns
int - returns the index of the new selected frame.
Author
Michel Melo da Silva
Date
30/04/2016
int selectNewFrame ( const float  s,
const float  S,
const int  index,
const int  index_previous,
const int  index_posterior,
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,
const cv::Rect &  crop_area,
const EXPERIMENT experiment_settings,
cv::Mat &  new_frame 
)

Function that selects a new frame in the original video using the values of semantic information of the transition from the frame_src to the frame_dst calculted by MATLAB and saved in a CSV file, the area ratio of the iamge after apply the homography transformation and the RANSCAC inliers from the previous and posterior frames that compose the reduced video.

Parameters
s- frame shift value between the previous master frame and the current frame.
S- frame shift between previous master frame and the posterior master frame.
index- index of the frame that will be replaced.
index_previous- index of the last frame in the reduced video.
index_posterior- index of the next frame in the reduced video.
image_master_previous- image with the master previous
image_master_posterior- image with the master posterior
crop_area- crop area of the video.
experiment_settings- experiment settings struct.
new_frame- image that will receive the new selected frame.
Returns
int - returns the index of the new selected frame.
Author
Washington Luis de Souza Ramos
Date
08/09/2016
double semantic_weight ( const int  index_previous,
const int  index_current,
const int  index_posterior,
const EXPERIMENT experiment_settings 
)

Function that get the semantic information of the transition from the frame_src to the frame_dst calculted by MATLAB and saved in a CSV file.

Parameters
index_previous- index of the first frame of the first transition.
index_current- index of the last frame of the first transition and first frame of the second transition.
index_posterior- index of the second frame of the second transition.
experiment_settings- struct with the experiment settings used to open the CSV file.
Returns
double - value of the semantic information about the transition.
Author
Michel Melo da Silva
Date
30/04/2016