|
EgoVideoStabilizer
1.0.0
|
Header functions for the homography.cpp. More...
#include <stdio.h>#include <iostream>#include <opencv2/core/core.hpp>#include <opencv2/features2d/features2d.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/nonfree/nonfree.hpp>#include <opencv2/calib3d/calib3d.hpp>#include <opencv2/imgproc/imgproc.hpp>#include "definitions/define.h"

Go to the source code of this file.
Enumerations | |
| enum | HomogCoverage { NO_AREA, DROP_AREA, CROP_AREA } |
| The HomogCoverage enum. More... | |
Functions | |
| bool | findHomographyMatrix (const cv::Mat &image_src, const cv::Mat &image_dst, cv::Mat &homography_matrix, cv::Mat &ransac_mask) |
| Function that find the homography matrix that leave the imageSrc to the plan of the imageDst. More... | |
| bool | findHomographyMatrix (const cv::Mat &image_src, const cv::Mat &image_dst, cv::Mat &homography_matrix) |
| Function that find the homography matrix that leave the imageSrc to the plan of the imageDst. More... | |
| bool | findHomographyMatrix (const std::vector< cv::KeyPoint > &keypoints_image_src, const std::vector< cv::KeyPoint > &keypoints_image_dst, const cv::Mat &descriptors_image_src, const cv::Mat &descriptors_image_dst, cv::Mat &homography_matrix, cv::Mat &ransac_mask) |
| Function that finds the homography matrix given the keypoints and descriptors. More... | |
| bool | findHomographyMatrix (const std::vector< cv::KeyPoint > &keypoints_image_src, const std::vector< cv::KeyPoint > &keypoints_image_dst, const cv::Mat &descriptors_image_src, const cv::Mat &descriptors_image_dst, cv::Mat &homography_matrix) |
| Function that find the homography matrix that leaves the imageSrc to the plan of the imageDst. More... | |
| bool | applyHomographyMatrix (const cv::Mat &image_src, const cv::Mat &homography_matrix, cv::Mat &image_result) |
| Function that apply homography matrix in a given image. More... | |
| bool | checkHomographyConsistency (const std::vector< cv::Point2f > img_corners, const cv::Mat &homography_matrix) |
| Function that checks if after made the homography transformation the corner consistency is maintained. More... | |
| bool | checkHomographyConsistency (const std::vector< cv::Point2f > new_img_corners) |
| Function that checks if after made the homography transformation the corner consistency is maintained. More... | |
| double | getAreaRatio (const cv::Mat &image_src, const cv::Mat &homography_matrix, const cv::Rect &frame_limits) |
| Function that calculates the loss(%) of the homography transformation in a ROI. More... | |
| HomogCoverage | getHomogCoverage (const cv::Mat &image_src, const cv::Mat &homography_matrix, const cv::Rect &drop_area, const cv::Rect &crop_area) |
| Function that calculates the loss(%) of the homography transformation in a ROI. More... | |
| void | getKeypointsAndDescriptors (const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints, cv::Mat &descriptors) |
| Function that gets the keypoints and describe an image in order to avoid unnecessary computations for tasks like finding the homography matrix. More... | |
Header functions for the homography.cpp.
| enum HomogCoverage |
| bool applyHomographyMatrix | ( | const cv::Mat & | image_src, |
| const cv::Mat & | homography_matrix, | ||
| cv::Mat & | image_result | ||
| ) |
Function that apply homography matrix in a given image.
| image_src | - image where the homography matrix will be applied. |
| homography_matrix | - homography matrix. |
| image_result | - object to save the image after the application of the homography matrix. |
bool true - if the corner consistency is maintained after application of the homography matrix. bool false - if the consistency is not maintained after application of the homography matrix. In this case the imageResult is a simple copy of the imageSrc.| bool checkHomographyConsistency | ( | const std::vector< cv::Point2f > | img_corners, |
| const cv::Mat & | homography_matrix | ||
| ) |
Function that checks if after made the homography transformation the corner consistency is maintained.
| img_corners | - image corners in the following order: img_corners[0] = 0 , 0 img_corners[1] = cols , 0 img_corners[2] = 0 , rows img_corners[3] = cols , rows |
| homography_matrix | - homography matrix that will be checked the consistency. |
bool true - if the consistency is maintained. bool false - if the consistency is not maintained.| bool checkHomographyConsistency | ( | const std::vector< cv::Point2f > | new_img_corners | ) |
Function that checks if after made the homography transformation the corner consistency is maintained.
| new_img_corners | - image corners in the following order: img_corners[0] = 0 , 0 img_corners[1] = cols , 0 img_corners[2] = 0 , rows img_corners[3] = cols , rows |
bool true - if the consistency is maintained. bool false - if the consistency is not maintained.| bool findHomographyMatrix | ( | const cv::Mat & | image_src, |
| const cv::Mat & | image_dst, | ||
| cv::Mat & | homography_matrix, | ||
| cv::Mat & | ransac_mask | ||
| ) |
Function that find the homography matrix that leave the imageSrc to the plan of the imageDst.
Returns the Ransak mask after finding the homography matrix.
| image_src | - image to where the homography will be calculated. |
| image_dst | - image of the destination of the homography. |
| homography_matrix | - object to homography matrix calculated. |
| ransac_mask | - RANSAC mask of the homography matrix. 1 means inliers and 0 means outliers. |
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.Function that find the homography matrix that leave the imageSrc to the plan of the imageDst.
Returns the Ransak mask after finding the homography matrix.
| image_src | - image to where the homography will be calculated. |
| image_dst | - image of the destination of the homography. |
| homography_matrix | - object to homography matrix calculated. |
| ransac_mask | - RANSAC mask of the homography matrix. 1 means inliers and 0 means outliers. |
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 findHomographyMatrix | ( | const cv::Mat & | image_src, |
| const cv::Mat & | image_dst, | ||
| cv::Mat & | homography_matrix | ||
| ) |
Function that find the homography matrix that leave the imageSrc to the plan of the imageDst.
| image_src | - image to where the homography will be calculated. |
| image_dst | - image of the destination of the homography. |
| homography_matrix | - object to save the homography matrix calculated. |
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.Function that find the homography matrix that leave the imageSrc to the plan of the imageDst.
| image_src | - image to where the homography will be calculated. |
| image_dst | - image of the destination of the homography. |
| homography_matrix | - object to save the homography matrix calculated. |
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 findHomographyMatrix | ( | const std::vector< cv::KeyPoint > & | keypoints_image_src, |
| const std::vector< cv::KeyPoint > & | keypoints_image_dst, | ||
| const cv::Mat & | descriptors_image_src, | ||
| const cv::Mat & | descriptors_image_dst, | ||
| cv::Mat & | homography_matrix, | ||
| cv::Mat & | ransac_mask | ||
| ) |
Function that finds the homography matrix given the keypoints and descriptors.
Returns the Ransak mask after finding the homography matrix.
| keypoints_image_src | - keypoints of the source image. |
| keypoints_image_dst | - keypoints of the target image. |
| descriptors_image_src | - descriptors of the source image. |
| descriptors_image_dst | - descriptors of the target image. |
| homography_matrix | - object to homography matrix calculated. |
| ransac_mask | - RANSAC mask of the homography matrix. 1 means inliers and 0 means outliers. |
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 findHomographyMatrix | ( | const std::vector< cv::KeyPoint > & | keypoints_image_src, |
| const std::vector< cv::KeyPoint > & | keypoints_image_dst, | ||
| const cv::Mat & | descriptors_image_src, | ||
| const cv::Mat & | descriptors_image_dst, | ||
| cv::Mat & | homography_matrix | ||
| ) |
Function that find the homography matrix that leaves the imageSrc to the plan of the imageDst.
| keypoints_image_src | - keypoints of the source image. |
| keypoints_image_dst | - keypoints of the target image. |
| descriptors_image_src | - descriptors of the source image. |
| descriptors_image_dst | - descriptors of the target image. |
| homography_matrix | - object to save the homography matrix calculated. |
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.| double getAreaRatio | ( | const cv::Mat & | image_src, |
| const cv::Mat & | homography_matrix, | ||
| const cv::Rect & | frame_limits | ||
| ) |
Function that calculates the loss(%) of the homography transformation in a ROI.
It returns the ratio between the non-image area and the frame_limits area.
| image_src | - The source image. |
| homography_matrix | - The homography matrix. |
| frame_limits | - The region of interest (ROI). |
double - The ratio between non-image area and the whole frame area.| HomogCoverage getHomogCoverage | ( | const cv::Mat & | image_src, |
| const cv::Mat & | homography_matrix, | ||
| const cv::Rect & | drop_area, | ||
| const cv::Rect & | crop_area | ||
| ) |
Function that calculates the loss(%) of the homography transformation in a ROI.
It returns the coverage of a transformation which is NONE, DROP_AREA or CROP_AREA.
| image_src | - The source image. |
| homography_matrix | - The homography matrix. |
| drop_area | - The region of interest (ROI) for the drop area. |
| crop_area | - The region of interest (ROI) for the crop area. |
| void getKeypointsAndDescriptors | ( | const cv::Mat & | image, |
| std::vector< cv::KeyPoint > & | keypoints, | ||
| cv::Mat & | descriptors | ||
| ) |
Function that gets the keypoints and describe an image in order to avoid unnecessary computations for tasks like finding the homography matrix.
| image | - image to where the keypoints and descriptors are to be extracted from. |
| keypoints | - the keypoints found in the image. |
| descriptors | - the descriptors of the image. |