-
Notifications
You must be signed in to change notification settings - Fork 319
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
Updated Map Matching With TEBLID and CLAHE #797
Changes from all commits
f81f78b
b547324
15096a0
c87ad53
7c2a29a
1995c80
a5ea253
74a8a13
7911ee9
4574ea8
ec0bec4
5d49bb7
c8cf520
1cedb9d
64c9b70
f8f142d
d66da2c
9c84220
807fed3
1d98bd7
76eec3d
fb8270e
04584a8
b194b86
b59c3ac
9f97542
86987f9
85dbf82
b10fd2b
3bb9088
15717de
a723095
52905d7
f014725
ea0fc5e
69cb35e
a154593
d42aa07
ec8533a
1a796d8
a84ac11
47004ca
c973991
ad69913
2a7aef3
29adb0e
f34d0d3
ccfc15b
741d9f1
73b7730
f2985ec
394f156
179f31e
773b21a
7fea5db
06cfafa
29ef6ec
1fcaa8c
1e05d86
ad8fd0d
0014e89
7e9aeac
bf1e0fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/** | ||
* @copyright 2021 Xoan Iago Suarez Canosa. All rights reserved. | ||
* Constact: [email protected] | ||
* Software developed in the PhD: Low-level vision for resource-limited devices | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what license? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and does this really need to be included instead of linked to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
* Repo link: https://github.com/iago-suarez/efficient-descriptors | ||
* License: Apache 2 | ||
* TODO(rsoussan): Remove this and BAD.cpp and switch to opencv TEBLID if opencv | ||
* version upgraded. | ||
*/ | ||
|
||
#ifndef INTEREST_POINT_BAD_H_ | ||
#define INTEREST_POINT_BAD_H_ | ||
|
||
#include <opencv2/opencv.hpp> | ||
|
||
#include <vector> | ||
#include <string> | ||
|
||
namespace upm { | ||
|
||
/** | ||
* Implementation of the Box Average Difference (BAD) descriptor. The method uses features | ||
* computed from the difference of the average gray values of two boxes in the patch. | ||
* | ||
* Each pair of boxes is represented with a BoxPairParams struct. After obtaining the feature | ||
* from them, the i'th feature is thresholded with thresholds_[i], producing the binary | ||
* weak-descriptor. | ||
*/ | ||
class BAD : public cv::Feature2D { | ||
public: | ||
/** | ||
* @brief Descriptor number of bits, each bit is a weak-descriptor. | ||
* The user can choose between 512 or 256 bits. | ||
*/ | ||
enum BadSize { | ||
SIZE_512_BITS = 100, SIZE_256_BITS = 101, | ||
}; | ||
|
||
/** | ||
* @param scale_factor Adjust the sampling window around detected keypoints: | ||
- <b> 1.00f </b> should be the scale for ORB keypoints | ||
- <b> 6.75f </b> should be the scale for SIFT detected keypoints | ||
- <b> 6.25f </b> is default and fits for KAZE, SURF detected keypoints | ||
- <b> 5.00f </b> should be the scale for AKAZE, MSD, AGAST, FAST, BRISK keypoints | ||
* @param n_bits Determine the number of bits in the descriptor. Should be either | ||
BAD::SIZE_512_BITS or BAD::SIZE_256_BITS. | ||
*/ | ||
explicit BAD(float scale_factor = 1.0f, BadSize n_bits = SIZE_512_BITS); | ||
|
||
/** | ||
* @brief Creates the BAD descriptor. | ||
* @param scale_factor Adjust the sampling window around detected keypoints: | ||
- <b> 1.00f </b> should be the scale for ORB keypoints | ||
- <b> 6.75f </b> should be the scale for SIFT detected keypoints | ||
- <b> 6.25f </b> is default and fits for KAZE, SURF detected keypoints | ||
- <b> 5.00f </b> should be the scale for AKAZE, MSD, AGAST, FAST, BRISK keypoints | ||
* @param n_bits | ||
* @return | ||
*/ | ||
static cv::Ptr<BAD> create(float scale_factor = 1.0f, BadSize n_bits = SIZE_512_BITS) { | ||
return cv::makePtr<upm::BAD>(scale_factor, n_bits); | ||
} | ||
|
||
/** @brief Computes the descriptors for a set of keypoints detected in an image (first variant) or image set | ||
(second variant). | ||
|
||
@param image Image. | ||
@param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be | ||
computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint | ||
with several dominant orientations (for each orientation). | ||
@param descriptors Computed descriptors. In the second variant of the method descriptors[i] are | ||
descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the | ||
descriptor for keypoint j-th keypoint. | ||
*/ | ||
void compute(cv::InputArray image, | ||
CV_OUT CV_IN_OUT std::vector<cv::KeyPoint> &keypoints, | ||
cv::OutputArray descriptors) override; | ||
|
||
int descriptorSize() const override { return box_params_.size() / 8; } | ||
int descriptorType() const override { return CV_8UC1; } | ||
int defaultNorm() const override { return cv::NORM_HAMMING; } | ||
bool empty() const override { return false; } | ||
|
||
cv::String getDefaultName() const override { return std::string("BAD") + std::to_string(box_params_.size()); } | ||
|
||
// Struct representing a pair of boxes in the patch | ||
struct BoxPairParams { | ||
int x1, x2, y1, y2, boxRadius; | ||
}; | ||
|
||
protected: | ||
// Computes the BADdescriptor | ||
void computeBAD(const cv::Mat &integral_img, | ||
const std::vector<cv::KeyPoint> &keypoints, | ||
cv::Mat &descriptors); | ||
|
||
std::vector<float> thresholds_; | ||
std::vector<BoxPairParams> box_params_; | ||
float scale_factor_ = 1; | ||
cv::Size patch_size_ = {32, 32}; | ||
}; | ||
|
||
} // namespace upm | ||
#endif // INTEREST_POINT_BAD_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are BRISK and TEBLID the only choices? What about SURF? What about TEBLID256 vs. TEBLID512? (It's ok if this file isn't merged in its final form because we can tune it after the ISAAC16 code freeze. But it might help to list the available feature types at the top of the file even if we don't define parameters for all the types yet. Also, not sure about this, but it might make sense to define a default value for each parameter that applies across all feature types while enabling a feature-type-specific value to override that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added teblid512 and teblid256, we don't really support SURF for loc since we never merged the vocab branch so I'll leave that out