mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
Forbid incorrect patchSize values in gpu::ORB
This commit is contained in:
parent
528ddb5647
commit
19462c871d
@ -401,6 +401,8 @@ cv::gpu::ORB_GPU::ORB_GPU(int nFeatures, float scaleFactor, int nLevels, int edg
|
|||||||
scoreType_(scoreType), patchSize_(patchSize),
|
scoreType_(scoreType), patchSize_(patchSize),
|
||||||
fastDetector_(DEFAULT_FAST_THRESHOLD)
|
fastDetector_(DEFAULT_FAST_THRESHOLD)
|
||||||
{
|
{
|
||||||
|
CV_Assert(patchSize_ >= 2);
|
||||||
|
|
||||||
// fill the extractors and descriptors for the corresponding scales
|
// fill the extractors and descriptors for the corresponding scales
|
||||||
float factor = 1.0f / scaleFactor_;
|
float factor = 1.0f / scaleFactor_;
|
||||||
float n_desired_features_per_scale = nFeatures_ * (1.0f - factor) / (1.0f - std::pow(factor, nLevels_));
|
float n_desired_features_per_scale = nFeatures_ * (1.0f - factor) / (1.0f - std::pow(factor, nLevels_));
|
||||||
@ -417,7 +419,7 @@ cv::gpu::ORB_GPU::ORB_GPU(int nFeatures, float scaleFactor, int nLevels, int edg
|
|||||||
|
|
||||||
// pre-compute the end of a row in a circular patch
|
// pre-compute the end of a row in a circular patch
|
||||||
int half_patch_size = patchSize_ / 2;
|
int half_patch_size = patchSize_ / 2;
|
||||||
vector<int> u_max(half_patch_size + 1);
|
vector<int> u_max(half_patch_size + 2);
|
||||||
for (int v = 0; v <= half_patch_size * std::sqrt(2.f) / 2 + 1; ++v)
|
for (int v = 0; v <= half_patch_size * std::sqrt(2.f) / 2 + 1; ++v)
|
||||||
u_max[v] = cvRound(std::sqrt(static_cast<float>(half_patch_size * half_patch_size - v * v)));
|
u_max[v] = cvRound(std::sqrt(static_cast<float>(half_patch_size * half_patch_size - v * v)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user