Opencv: Keine windowedMatchingMask () -Funktion in opencv3

Erstellt am 27. Juli 2015  ·  3Kommentare  ·  Quelle: opencv/opencv

Übertragen von 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

Keine windowedMatchingMask () -Funktion 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 <[email protected]>
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.

Geschichte

Maksim Shabunin am 27.04.2015 09:12
-   Target version changed from 3.0-beta to 3.0
3.4 auto-transferred bug features2d normal

Hilfreichster Kommentar

Es scheint, dass es in OpenCV3 keinen Ersatz für windowedMatchingMask . Eine Problemumgehung besteht darin, den folgenden OpenCV 2.4-Quellcode in Ihren Code einzufügen:

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;
}

Alle 3 Kommentare

Stolperte auch darüber.
Ich hoffe das ist nicht beabsichtigt?

Portieren Sie etwas 2.4-Code und wundern Sie sich auch darüber. Gibt es eine Funktion, die es ersetzt?

Es scheint, dass es in OpenCV3 keinen Ersatz für windowedMatchingMask . Eine Problemumgehung besteht darin, den folgenden OpenCV 2.4-Quellcode in Ihren Code einzufügen:

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;
}
War diese Seite hilfreich?
0 / 5 - 0 Bewertungen

Verwandte Themen

sturkmen72 picture sturkmen72  ·  3Kommentare

dpo picture dpo  ·  3Kommentare

charlesxwang picture charlesxwang  ·  3Kommentare

koleckar picture koleckar  ·  3Kommentare

wmfuture picture wmfuture  ·  3Kommentare