SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
CVFeatureManager Class Reference

Wrapper class around OpenCV feature detector & describer. More...

#include <CVFeatureManager.h>

Public Member Functions

 CVFeatureManager ()
 
 ~CVFeatureManager ()
 
void detect (CVInputArray image, CVVKeyPoint &keypoints, CVInputArray mask=cv::noArray())
 
void describe (CVInputArray image, CVVKeyPoint &keypoints, CVOutputArray descriptors)
 
void detectAndDescribe (CVInputArray image, CVVKeyPoint &keypoints, CVOutputArray descriptors, CVInputArray mask=cv::noArray())
 
void createDetectorDescriptor (CVDetectDescribeType detectDescribeType)
 Creates a detector and decriptor to the passed type. More...
 
void setDetectorDescriptor (CVDetectDescribeType detectDescribeType, cv::Ptr< CVFeature2D > detector, cv::Ptr< CVFeature2D > descriptor)
 Sets the detector and decriptor to the passed ones. More...
 
CVDetectDescribeType type ()
 

Private Attributes

CVDetectDescribeType _type
 Type of detector-descriptor pair. More...
 
cv::Ptr< CVFeature2D_detector
 CV smart pointer to the OpenCV feature detector. More...
 
cv::Ptr< CVFeature2D_descriptor
 CV smart pointer to the OpenCV descriptor extractor. More...
 

Detailed Description

Wrapper class around OpenCV feature detector & describer.

Definition at line 39 of file CVFeatureManager.h.

Constructor & Destructor Documentation

◆ CVFeatureManager()

CVFeatureManager::CVFeatureManager ( )

Definition at line 26 of file CVFeatureManager.cpp.

27 {
29 }
@ DDT_RAUL_RAUL
void createDetectorDescriptor(CVDetectDescribeType detectDescribeType)
Creates a detector and decriptor to the passed type.

◆ ~CVFeatureManager()

CVFeatureManager::~CVFeatureManager ( )

Definition at line 31 of file CVFeatureManager.cpp.

32 {
33 }

Member Function Documentation

◆ createDetectorDescriptor()

void CVFeatureManager::createDetectorDescriptor ( CVDetectDescribeType  detectDescribeType)

Creates a detector and decriptor to the passed type.

Definition at line 36 of file CVFeatureManager.cpp.

37 {
38  switch (type)
39  {
40 #ifndef __EMSCRIPTEN__
41  case DDT_FAST_BRIEF:
42  _detector = cv::FastFeatureDetector::create(30,
43  true,
44  cv::FastFeatureDetector::TYPE_9_16);
45  _descriptor = cv::xfeatures2d::BriefDescriptorExtractor::create(32, true);
46  break;
47 #endif
48  case DDT_ORB_ORB:
49  _detector = cv::ORB::create(200,
50  1.44f,
51  3,
52  31,
53  0,
54  2,
55  cv::ORB::HARRIS_SCORE,
56  31,
57  30);
59  break;
60  case DDT_RAUL_RAUL:
61  _detector = new CVRaulMurOrb(1500,
62  1.44f,
63  4,
64  30,
65  20);
67  break;
68 #ifndef __EMSCRIPTEN__
69  case DDT_SURF_SURF:
70  _detector = cv::xfeatures2d::SURF::create(100,
71  2,
72  2,
73  false,
74  false);
76  break;
77  case DDT_SIFT_SIFT:
78 # if CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 5
79  _detector = cv::SIFT::create(300,
80  2,
81  0.04,
82  10,
83  1.6);
84 # else
85  _detector = cv::xfeatures2d::SIFT::create(300,
86  2,
87  0.04,
88  10,
89  1.6);
90 # endif
92  break;
93 #endif
94  default:
95  Utils::exitMsg("SLProject",
96  "Unknown detector-descriptor type.",
97  __LINE__,
98  __FILE__);
99  }
100 
101  _type = type;
102 }
@ DDT_ORB_ORB
@ DDT_SURF_SURF
@ DDT_FAST_BRIEF
@ DDT_SIFT_SIFT
CVDetectDescribeType _type
Type of detector-descriptor pair.
CVDetectDescribeType type()
cv::Ptr< CVFeature2D > _descriptor
CV smart pointer to the OpenCV descriptor extractor.
cv::Ptr< CVFeature2D > _detector
CV smart pointer to the OpenCV feature detector.
Orb detector and descriptor with distribution.
Definition: CVRaulMurOrb.h:21
void exitMsg(const char *tag, const char *msg, const int line, const char *file)
Terminates the application with a message. No leak checking.
Definition: Utils.cpp:1135

◆ describe()

void CVFeatureManager::describe ( CVInputArray  image,
CVVKeyPoint keypoints,
CVOutputArray  descriptors 
)

◆ detect()

void CVFeatureManager::detect ( CVInputArray  image,
CVVKeyPoint keypoints,
CVInputArray  mask = cv::noArray() 
)

◆ detectAndDescribe()

void CVFeatureManager::detectAndDescribe ( CVInputArray  image,
CVVKeyPoint keypoints,
CVOutputArray  descriptors,
CVInputArray  mask = cv::noArray() 
)

Definition at line 114 of file CVFeatureManager.cpp.

118 {
119  assert(_detector && "CVFeatureManager::detectAndDescribe: No detector!");
120  assert(_descriptor && "CVFeatureManager::detectAndDescribe: No descriptor!");
121 
122  if (_detector == _descriptor)
123  _detector->detectAndCompute(image, mask, keypoints, descriptors);
124  else
125  {
126  _detector->detect(image, keypoints, mask);
127  _descriptor->compute(image, keypoints, descriptors);
128  }
129 }

◆ setDetectorDescriptor()

void CVFeatureManager::setDetectorDescriptor ( CVDetectDescribeType  detectDescribeType,
cv::Ptr< CVFeature2D detector,
cv::Ptr< CVFeature2D descriptor 
)

Sets the detector and decriptor to the passed ones.

Definition at line 105 of file CVFeatureManager.cpp.

108 {
109  _type = type;
110  _detector = detector;
111  _descriptor = descriptor;
112 }

◆ type()

CVDetectDescribeType CVFeatureManager::type ( )
inline

Definition at line 64 of file CVFeatureManager.h.

64 { return _type; }

Member Data Documentation

◆ _descriptor

cv::Ptr<CVFeature2D> CVFeatureManager::_descriptor
private

CV smart pointer to the OpenCV descriptor extractor.

Definition at line 69 of file CVFeatureManager.h.

◆ _detector

cv::Ptr<CVFeature2D> CVFeatureManager::_detector
private

CV smart pointer to the OpenCV feature detector.

Definition at line 68 of file CVFeatureManager.h.

◆ _type

CVDetectDescribeType CVFeatureManager::_type
private

Type of detector-descriptor pair.

Definition at line 67 of file CVFeatureManager.h.


The documentation for this class was generated from the following files: