match_call.hpp 2.11 KB
Newer Older
1 2 3 4 5 6 7
#ifndef CVVISUAL_MATCH_CALL_HPP
#define CVVISUAL_MATCH_CALL_HPP

#include <vector>
#include <utility>
#include <type_traits>

Maksim Shabunin's avatar
Maksim Shabunin committed
8 9
#include "opencv2/core.hpp"
#include "opencv2/features2d.hpp"
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

#include "call.hpp"

namespace cvv
{
namespace impl
{

/**
 * Contains all the calldata (= location, images and their keypoints).
 */
class MatchCall : public Call
{
      public:
	/**
	 * @brief Constructs a MatchCall.
	 */
	MatchCall(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
	          cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
	          std::vector<cv::DMatch> matches, impl::CallMetaData data,
	          QString type, QString description, QString requestedView,
	          bool useTrainDescriptor);

	size_t matrixCount() const override
	{
		return 2;
	}
	const cv::Mat &matrixAt(size_t index) const override;

	/**
	 * @brief Returns the first Mat.
	 */
	const cv::Mat &img1() const
	{
		return img1_;
	}

	/**
	 * @brief Returns the second Mat.
	 */
	const cv::Mat &img2() const
	{
		return img2_;
	}

	/**
	 * @brief Returns the keypoints for the first Mat.
	 */
	const std::vector<cv::KeyPoint> &keyPoints1() const
	{
		return keypoints1_;
	}

	/**
	 * @brief Returns the keypoints for the second Mat.
	 */
	const std::vector<cv::KeyPoint> &keyPoints2() const
	{
		return keypoints2_;
	}

	/**
	 * @brief Returns the matches.
	 */
	const std::vector<cv::DMatch> &matches() const
	{
		return matches_;
	}

	bool usesTrainDescriptor() const
	{
		return usesTrainDescriptor_;
	}

      private:
	cv::Mat img1_;
	std::vector<cv::KeyPoint> keypoints1_;
	cv::Mat img2_;
	std::vector<cv::KeyPoint> keypoints2_;
	std::vector<cv::DMatch> matches_;
	bool usesTrainDescriptor_;
};

/**
 * Constructs a MatchCall and adds it to the global data-controller.
 */
void debugMatchCall(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
                    cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
                    std::vector<cv::DMatch> matches, const CallMetaData &data,
                    const char *description, const char *view,
                    bool useTrainDescriptor);
}
} // namespaces cvv::impl

#endif