Browse Source

Added XFeatures2DInvoke.MatchGMS

pull/262/head
Canming Huang 6 years ago
parent
commit
8556adb201
  1. 8
      Emgu.CV.Contrib/XFeatures2D/BoostDesc.cs
  2. 66
      Emgu.CV.Contrib/XFeatures2D/XFeatures2DInvoke.cs
  3. 9
      Emgu.CV.Extern/xfeatures2d/xfeatures2d_c.cpp
  4. 6
      Emgu.CV.Extern/xfeatures2d/xfeatures2d_c.h

8
Emgu.CV.Contrib/XFeatures2D/BoostDesc.cs

@ -86,16 +86,8 @@ namespace Emgu.CV.XFeatures2D
}
}
/// <summary>
/// This class wraps the functional calls to the OpenCV XFeatures2D modules
/// </summary>
public static partial class XFeatures2DInvoke
{
static XFeatures2DInvoke()
{
CvInvoke.CheckLibraryLoaded();
}
[DllImport(CvInvoke.ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
internal static extern IntPtr cveBoostDescCreate(
BoostDesc.DescriptorType desc,

66
Emgu.CV.Contrib/XFeatures2D/XFeatures2DInvoke.cs

@ -0,0 +1,66 @@
//----------------------------------------------------------------------------
// Copyright (C) 2004-2019 by EMGU Corporation. All rights reserved.
//----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using System.Drawing;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.Util;
using Emgu.Util;
using Emgu.CV.Features2D;
namespace Emgu.CV.XFeatures2D
{
/// <summary>
/// This class wraps the functional calls to the OpenCV XFeatures2D modules
/// </summary>
public static partial class XFeatures2DInvoke
{
static XFeatures2DInvoke()
{
CvInvoke.CheckLibraryLoaded();
}
/// <summary>
/// GMS (Grid-based Motion Statistics) feature matching strategy
/// </summary>
/// <param name="size1">Input size of image1.</param>
/// <param name="size2">Input size of image2.</param>
/// <param name="keypoints1">Input keypoints of image1.</param>
/// <param name="keypoints2">Input keypoints of image2.</param>
/// <param name="matches1to2">Input 1-nearest neighbor matches.</param>
/// <param name="matchesGMS">Matches returned by the GMS matching strategy.</param>
/// <param name="withRotation">Take rotation transformation into account.</param>
/// <param name="withScale">Take scale transformation into account.</param>
/// <param name="thresholdFactor">The higher, the less matches.</param>
public static void MatchGMS(
Size size1, Size size2,
VectorOfKeyPoint keypoints1, VectorOfKeyPoint keypoints2,
VectorOfDMatch matches1to2, VectorOfDMatch matchesGMS,
bool withRotation = false,
bool withScale = false,
double thresholdFactor = 6.0)
{
cveMatchGMS(ref size1, ref size2, keypoints1, keypoints2, matches1to2, matchesGMS, withRotation, withScale, thresholdFactor);
}
[DllImport(CvInvoke.ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
internal static extern void cveMatchGMS(
ref Size size1, ref Size size2,
IntPtr keypoints1, IntPtr keypoints2,
IntPtr matches1to2, IntPtr matchesGMS,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool withRotation,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool withScale,
double thresholdFactor);
}
}

9
Emgu.CV.Extern/xfeatures2d/xfeatures2d_c.cpp

@ -277,4 +277,13 @@ void cveHarrisLaplaceFeatureDetectorRelease(cv::Ptr<cv::xfeatures2d::HarrisLapla
{
delete *sharedPtr;
*sharedPtr = 0;
}
void cveMatchGMS(
CvSize* size1, CvSize* size2,
std::vector< cv::KeyPoint >* keypoints1, std::vector< cv::KeyPoint >* keypoints2,
std::vector< cv::DMatch >* matches1to2, std::vector< cv::DMatch >* matchesGMS,
bool withRotation, bool withScale, double thresholdFactor)
{
cv::xfeatures2d::matchGMS(*size1, *size2, *keypoints1, *keypoints2, *matches1to2, *matchesGMS, withRotation, withScale, thresholdFactor);
}

6
Emgu.CV.Extern/xfeatures2d/xfeatures2d_c.h

@ -104,4 +104,10 @@ CVAPI(cv::xfeatures2d::HarrisLaplaceFeatureDetector*) cveHarrisLaplaceFeatureDet
int num_layers,
cv::Ptr<cv::xfeatures2d::HarrisLaplaceFeatureDetector>** sharedPtr);
CVAPI(void) cveHarrisLaplaceFeatureDetectorRelease(cv::Ptr<cv::xfeatures2d::HarrisLaplaceFeatureDetector>** sharedPtr);
CVAPI(void) cveMatchGMS(
CvSize* size1, CvSize* size2,
std::vector< cv::KeyPoint >* keypoints1, std::vector< cv::KeyPoint >* keypoints2,
std::vector< cv::DMatch >* matches1to2, std::vector< cv::DMatch >* matchesGMS,
bool withRotation, bool withScale, double thresholdFactor);
#endif
Loading…
Cancel
Save