EgoVideoStabilizer
1.0.0
|
Functions related with sequence processing, such as find intermediate homography, get transition weight, select new frame. More...
#include "definitions/experiment_struct.h"
#include "headers/sequence_processing.h"
#include "headers/homography.h"
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... | |
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.
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.
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. |
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.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.
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. |
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.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.
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. |
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.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.
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. |
double
- value of the frame weight.double gaussianValue | ( | double | index | ) |
Function that calculates Gaussian value in the position index.
index | - index in the Gaussian function. |
double
- value of the Gaussian function int the position index.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.
matrix | - matrix to calculate the pow-th pow. |
pow | - pow index. |
matrix_result | - object to save the result of the matrix pow. |
void
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.
matrix | - matrix to calculate the root-th root. |
root | - root index. |
matrix_result | - object to save the result of the matrix root. |
bool
true - if the root can be found. bool
false - if the root can not be found.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.
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. |
int
- returns the index of the new selected frame.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.
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. |
int
- returns the index of the new selected frame.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.
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. |
double
- value of the semantic information about the transition.