Ratio check function with findHomography
i need to acquire a perspective matrix from two images taken by the same camera after its movement in a 3D space...I'm taking inspiration from this OpenCV's example about the use of findHomography. I would like to substitute the "filter for the good_matches there suggested with the "ratio check function":
class RatioCheck
{
public:
RatioCheck(){};
void filter(vector<vector<DMatch>>& nmatches, double RatioT);
};
void RatioCheck::filter(std::vector<vector<DMatch> > &nmatches, double RatioT=0.8)
{
vector<vector<DMatch>> knmatches;
for(int i=0; i<nmatches.size(); i++)
{
if((nmatches[i].size()==1)||...
(abs(nmatches[i][0].distance/nmatches[i][1].distance) <RatioT))
{
knmatches.push_back(nmatches[i]);
}
}
nmatches=knmatches;
}
In principle i have to give to the function a vector<vector<DMatch> >
..but actually i have a vector<DMatch>
... does anybody know how?
-1. Relevant part of the question off-site. Provide a minimal example.
updated..sorry
+1 Thanks. (seems that I cannot undo my downvote, so I upvoted your comment)