Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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][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?

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][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?

click to hide/show revision 4
fixed formatting

updated 2013-08-21 08:33:00 -0600

SR gravatar image

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> > vector<vector<DMatch> > ..but actually i have a vector<dmatch>...does vector<DMatch>... does anybody know how?