Program Listing for File match-helpers.h

Return to documentation for file (aslam_cv2/aslam_cv_matcher/include/aslam/matcher/match-helpers.h)

#ifndef ASLAM_MATCHER_MATCH_HELPERS_H_
#define ASLAM_MATCHER_MATCH_HELPERS_H_

#include <aslam/cameras/camera.h>
#include <aslam/common/pose-types.h>

#include "aslam/matcher/match.h"

namespace aslam {

// Convert any kind of matches with score to any kind of match.
template<typename MatchWithScore, typename Match>
void convertMatchesWithScoreToMatches(
    const Aligned<std::vector, MatchWithScore>& matches_with_score_A_B,
    Aligned<std::vector, Match>* matches_A_B);

// Convert aslam::MatchesWithScore to aslam::Matches.
inline void convertMatchesWithScoreToMatches(
    const MatchesWithScore& matches_with_score_A_B, Matches* matches_A_B);

// Convert any (derived) MatchesWithScore to aslam::Matches.
template<typename MatchesWithScore>
void convertMatchesWithScoreToMatches(
    const MatchesWithScore& matches_with_score_A_B, Matches* matches_A_B);

template<typename MatchingProblem>
void convertMatchesWithScoreToMatches(
    const typename MatchingProblem::MatchesWithScore& matches_with_score_A_B,
    typename MatchingProblem::Matches* matches_A_B);

template<typename MatchWithScore>
void convertMatchesWithScoreToOpenCvMatches(
    const Aligned<std::vector, MatchWithScore>& matches_with_score_A_B,
    OpenCvMatches* matches_A_B);

template<typename TypedMatches>
void convertFrameToFrameMatchesToMatches(
    const TypedMatches& matches_typed_A_B, Matches* raw_matches_A_B);

void pickNRandomRigMatches(
    size_t n_per_camera, const FrameToFrameMatchesList& rig_matches,
    FrameToFrameMatchesList* selected_rig_matches);

size_t extractMatchesFromTrackIdChannel(const Eigen::VectorXi& track_ids_kp1,
                                        const Eigen::VectorXi& track_ids_k,
                                        FrameToFrameMatches* matches_kp1_kp);
size_t extractMatchesFromTrackIdChannel(const VisualFrame& frame_kp1,
                                        const VisualFrame& frame_k,
                                        FrameToFrameMatches* matches_kp1_kp);
size_t extractMatchesFromTrackIdChannels(
    const VisualNFrame& nframe_kp1, const VisualNFrame& nframe_k,
    FrameToFrameMatchesList* rig_matches_kp1_kp);

double getMatchPixelDisparityMedian(
      const VisualNFrame& nframe_kp1, const VisualNFrame& nframe_k,
      const FrameToFrameMatchesList& matches_kp1_kp);

double getUnrotatedMatchPixelDisparityMedian(
    const VisualNFrame& nframe_kp1, const VisualNFrame& nframe_k,
    const FrameToFrameMatchesList& matches_kp1_k,
    const aslam::Quaternion& q_kp1_k);

void getBearingVectorsFromMatches(
    const VisualFrame& frame_kp1, const VisualFrame& frame_k,
    const FrameToFrameMatches& matches_kp1_k,
    Aligned<std::vector, Eigen::Vector3d>* bearing_vectors_kp1,
    Aligned<std::vector, Eigen::Vector3d>* bearing_vectors_k);

void predictKeypointsByRotation(const VisualFrame& frame_k,
                                const aslam::Quaternion& q_Ckp1_Ck,
                                Eigen::Matrix2Xd* predicted_keypoints_kp1,
                                std::vector<unsigned char>* prediction_success);
void predictKeypointsByRotation(const aslam::Camera& camera,
                                const Eigen::Matrix2Xd keypoints_k,
                                const aslam::Quaternion& q_Ckp1_Ck,
                                Eigen::Matrix2Xd* predicted_keypoints_kp1,
                                std::vector<unsigned char>* prediction_success);

}  // namespace aslam

#include "./match-helpers-inl.h"

#endif  // ASLAM_MATCHER_MATCH_HELPERS_H_