1
2
3
4
5
6
7
8
9
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
#ifndef CVVISUAL_MATCH_SELECTION_SELECTOR
#define CVVISUAL_MATCH_SELECTION_SELECTOR
#include <vector>
#include "opencv2/features2d.hpp"
#include "matchselection.hpp"
#include "../registerhelper.hpp"
namespace cvv{ namespace qtutil{
/**
* @brief this class can use diffrent MatchSelection
* you can register functions which take a std::vector<cv::DMatch> as argument.
*/
class MatchSelectionSelector:public MatchSelection,public RegisterHelper<MatchSelection,std::vector<cv::DMatch>>{
Q_OBJECT
public:
/**
* @brief the constructor
*/
MatchSelectionSelector(const std::vector<cv::DMatch>& univers,QWidget * parent=nullptr);
/**
* @brief select matches of the given selection
* @return the selected matches
*/
std::vector<cv::DMatch> select(const std::vector<cv::DMatch>& selection);
public slots:
/**
* @brief emits the signal remove with this.
*/
void removeMe()
{emit remove(this);}
signals:
/**
* @brief this signal contains a KeyPointSelectionSelector which should be removed. Normally the argumen is this.
*/
void remove(MatchSelectionSelector*);
private slots:
/**
* @brief swap the current MatchSelection if the user choose another.
*/
virtual void changeSelector();
private:
MatchSelection * selection_=nullptr;
std::vector<cv::DMatch> univers_;
QLayout *layout_;
};
template <class Selection>
bool registerMatchSelection(const QString &name)
{
return MatchSelectionSelector::registerElement(
name, [](std::vector<cv::DMatch> univers)
{
return std::unique_ptr<MatchSelection>{ new Selection{univers}};
});
}
}}
#endif