Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No windowedMatchingMask() function in opencv3 #4867

Open
opencv-pushbot opened this issue Jul 27, 2015 · 3 comments
Open

No windowedMatchingMask() function in opencv3 #4867

opencv-pushbot opened this issue Jul 27, 2015 · 3 comments

Comments

@opencv-pushbot
Copy link
Contributor

Transferred from http://code.opencv.org/issues/4022

|| Ozan Caglayan on 2014-11-24 14:27
|| Priority: Normal
|| Affected: branch 'master' (3.0-dev)
|| Category: features2d
|| Tracker: Bug
|| Difficulty: 
|| PR: 
|| Platform: Any / Any

No windowedMatchingMask() function in opencv3

Hi,

I was trying to port an existing OpenCV code to the 3.0-beta but figured out that the function windowedMatchingMask() which was defined in modules/features2d/src/matchers.cpp in OpenCV 2.x no longer exists in OpenCV 3.

I think it was actually moved into the contrib repository's xfeatures2d module with the following commit:

commit d4a77fc42858fc3711e156115c76318d93b7ccb0
Author: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>
Date:   Mon Aug 11 23:25:30 2014 +0400

    added xfeatures2d (made of opencv/nonfree and a part of opencv/features2d)


But apparently the above commit didn't bring that function into opencv_contrib and commented out the single call to windowedMatchingMask():
modules/xfeatures2d/samples/video_homography.cpp:            //Mat mask = windowedMatchingMask(test_kpts, train_kpts, 25, 25);

So maybe the function was dropped completely but I couldn't find any clue about this on Google.

History

Maksim Shabunin on 2015-04-27 09:12
-   Target version changed from 3.0-beta to 3.0
@black-puppydog
Copy link

Stumbled over this, too.
I hope this is not intentional?

@EverettBerry
Copy link

Porting some 2.4 code and wondering about this too. Is there a function that replaces it?

@marker68
Copy link

marker68 commented Jul 21, 2016

It seems like there is no replacement in OpenCV3 for windowedMatchingMask. A workaround this issues is to add the following OpenCV 2.4 source code in your code:

cv::Mat windowedMatchingMask( const vector<cv::KeyPoint>& keypoints1, const vector<cv::KeyPoint>& keypoints2,
                          float maxDeltaX, float maxDeltaY )
{
  if( keypoints1.empty() || keypoints2.empty() )
    return cv::Mat();

  int n1 = (int)keypoints1.size(), n2 = (int)keypoints2.size();
  cv::Mat mask( n1, n2, CV_8UC1 );
  for( int i = 0; i < n1; i++ )
    {
      for( int j = 0; j < n2; j++ )
        {
          cv::Point2f diff = keypoints2[j].pt - keypoints1[i].pt;
          mask.at<uchar>(i, j) = std::abs(diff.x) < maxDeltaX && std::abs(diff.y) < maxDeltaY;
        }
    }
  return mask;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants