|
25 | 25 | #include "opencv2/imgcodecs.hpp"
|
26 | 26 | #include "opencv2/highgui.hpp"
|
27 | 27 | #include <opencv2/calib3d.hpp>
|
| 28 | +#ifdef WITHCUDA |
| 29 | +#include <opencv2/cudafeatures2d.hpp> |
| 30 | +#endif |
28 | 31 |
|
29 | 32 | namespace SolAR {
|
30 | 33 | namespace MODULES {
|
@@ -60,33 +63,42 @@ class SOLAROPENCV_EXPORT_API SolARDescriptorMatcherGeometricOpencv : public base
|
60 | 63 | /// @brief SolARDescriptorMatcherGeometricOpencv destructor
|
61 | 64 | ~SolARDescriptorMatcherGeometricOpencv() override;
|
62 | 65 |
|
63 |
| - /// @brief Match two sets of descriptors from two frames based on epipolar constraint. |
64 |
| - /// @param[in] descriptors1 The first set of descriptors. |
65 |
| - /// @param[in] descriptors2 The second set of descriptors. |
66 |
| - /// @param[in] undistortedKeypoints1 The first set of undistorted keypoints. |
67 |
| - /// @param[in] undistortedKeypoints2 The second set of undistorted keypoints. |
68 |
| - /// @param[in] pose1 The first pose. |
69 |
| - /// @param[in] pose2 The second pose. |
70 |
| - /// @param[in] camParams The intrinsic parameters of the camera. |
71 |
| - /// @param[out] matches A vector of matches representing pairs of indices relatively to the first and second set of descriptors. |
72 |
| - /// @param[in] mask The indices of descriptors in the first frame are used for matching to the second frame. If it is empty then all will be used. |
| 66 | + /// @brief Match two sets of descriptors from two frames based on epipolar constraint. |
| 67 | + /// @param[in] descriptors1 The first set of descriptors. |
| 68 | + /// @param[in] descriptors2 The second set of descriptors. |
| 69 | + /// @param[in] undistortedKeypoints1 The first set of undistorted keypoints. |
| 70 | + /// @param[in] undistortedKeypoints2 The second set of undistorted keypoints. |
| 71 | + /// @param[in] pose1 The first pose. |
| 72 | + /// @param[in] pose2 The second pose. |
| 73 | + /// @param[in] camParams1 The intrinsic parameters of the camera 1. |
| 74 | + /// @param[in] camParams2 The intrinsic parameters of the camera 2. |
| 75 | + /// @param[out] matches A vector of matches representing pairs of indices relatively to the first and second set of descriptors. |
| 76 | + /// @param[in] mask1 The indices of descriptors in the first frame are used for matching to the second frame. If it is empty then all will be used. |
| 77 | + /// @param[in] mask2 The indices of descriptors in the second frame are used for matching to the first frame. If it is empty then all will be used. |
73 | 78 | /// @return FrameworkReturnCode::_SUCCESS if matching succeed, else FrameworkReturnCode::_ERROR_
|
74 | 79 | FrameworkReturnCode match(const SRef<SolAR::datastructure::DescriptorBuffer> descriptors1,
|
75 | 80 | const SRef<SolAR::datastructure::DescriptorBuffer> descriptors2,
|
76 | 81 | const std::vector<SolAR::datastructure::Keypoint> &undistortedKeypoints1,
|
77 | 82 | const std::vector<SolAR::datastructure::Keypoint> &undistortedKeypoints2,
|
78 | 83 | const SolAR::datastructure::Transform3Df& pose1,
|
79 | 84 | const SolAR::datastructure::Transform3Df& pose2,
|
80 |
| - const SolAR::datastructure::CameraParameters& camParams, |
| 85 | + const SolAR::datastructure::CameraParameters & camParams1, |
| 86 | + const SolAR::datastructure::CameraParameters & camParams2, |
81 | 87 | std::vector<SolAR::datastructure::DescriptorMatch> & matches,
|
82 |
| - const std::vector<uint32_t>& mask = {}) override; |
| 88 | + const std::vector<uint32_t>& mask1 = {}, |
| 89 | + const std::vector<uint32_t>& mask2 = {}) override; |
83 | 90 |
|
| 91 | + org::bcom::xpcf::XPCFErrorCode onConfigured() override final; |
84 | 92 | void unloadComponent() override;
|
85 | 93 |
|
86 | 94 | private:
|
87 | 95 | float m_distanceRatio = 0.75f;
|
88 | 96 | float m_paddingRatio = 0.003f;
|
89 | 97 | float m_matchingDistanceMax = 500.f;
|
| 98 | + /// Matcher used only in case of cuda |
| 99 | +#ifdef WITHCUDA |
| 100 | + cv::Ptr<cv::cuda::DescriptorMatcher> m_matcher; |
| 101 | +#endif |
90 | 102 | };
|
91 | 103 |
|
92 | 104 | }
|
|
0 commit comments