# Revision history [back]

### 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 example and I would like to substitute the "filter for the good_matches there suggested with the "ratio check function" suggested here. In principle i have to give to the function a vector<vector<dmatch> > ..but actually i have a vector<dmatch>...does anybody know how?

### 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 example and I would like to substitute the "filter for the good_matches there suggested with the "ratio check function" suggested function":

 here.
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].distance/nmatches[i].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?

### 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 examplefindHomography and . 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].distance/nmatches[i].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? 4 fixed formatting

### 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].distance/nmatches[i].distance) <RatioT))
{
{
knmatches.push_back(nmatches[i]);
}
}
nmatches=knmatches;
}


In principle i have to give to the function a vector<vector<dmatch> > vector<vector<DMatch> > ..but actually i have a vector<dmatch>...does vector<DMatch>... does anybody know how?