mirror of
https://github.com/opencv/opencv.git
synced 2025-06-10 11:03:03 +08:00
- fix a possible crash when only asking for features and not descriptors
This commit is contained in:
parent
355ad2993a
commit
909e484e74
@ -523,8 +523,6 @@ void ORB::operator()(const cv::Mat &image, const cv::Mat &mask, std::vector<cv::
|
|||||||
if ((!do_keypoints) && (!do_descriptors))
|
if ((!do_keypoints) && (!do_descriptors))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (do_keypoints)
|
|
||||||
keypoints_in_out.clear();
|
|
||||||
if (do_descriptors)
|
if (do_descriptors)
|
||||||
descriptors.release();
|
descriptors.release();
|
||||||
|
|
||||||
@ -560,6 +558,7 @@ void ORB::operator()(const cv::Mat &image, const cv::Mat &mask, std::vector<cv::
|
|||||||
all_keypoints[keypoint->octave].push_back(*keypoint);
|
all_keypoints[keypoint->octave].push_back(*keypoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keypoints_in_out.clear();
|
||||||
for (unsigned int level = 0; level < params_.n_levels_; ++level)
|
for (unsigned int level = 0; level < params_.n_levels_; ++level)
|
||||||
{
|
{
|
||||||
// Compute the resized image
|
// Compute the resized image
|
||||||
@ -583,11 +582,6 @@ void ORB::operator()(const cv::Mat &image, const cv::Mat &mask, std::vector<cv::
|
|||||||
computeDescriptors(working_mat, integral_image, level, keypoints, desc);
|
computeDescriptors(working_mat, integral_image, level, keypoints, desc);
|
||||||
|
|
||||||
// Copy to the output data
|
// Copy to the output data
|
||||||
if (!desc.empty())
|
|
||||||
{
|
|
||||||
if (do_keypoints)
|
|
||||||
{
|
|
||||||
// Rescale the coordinates
|
|
||||||
if (level != params_.first_level_)
|
if (level != params_.first_level_)
|
||||||
{
|
{
|
||||||
float scale = std::pow(params_.scale_factor_, float(level - params_.first_level_));
|
float scale = std::pow(params_.scale_factor_, float(level - params_.first_level_));
|
||||||
@ -597,7 +591,6 @@ void ORB::operator()(const cv::Mat &image, const cv::Mat &mask, std::vector<cv::
|
|||||||
}
|
}
|
||||||
// And add the keypoints to the output
|
// And add the keypoints to the output
|
||||||
keypoints_in_out.insert(keypoints_in_out.end(), keypoints.begin(), keypoints.end());
|
keypoints_in_out.insert(keypoints_in_out.end(), keypoints.begin(), keypoints.end());
|
||||||
}
|
|
||||||
|
|
||||||
if (do_descriptors)
|
if (do_descriptors)
|
||||||
{
|
{
|
||||||
@ -608,7 +601,6 @@ void ORB::operator()(const cv::Mat &image, const cv::Mat &mask, std::vector<cv::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/** Compute the ORB keypoints on an image
|
/** Compute the ORB keypoints on an image
|
||||||
* @param image_pyramid the image pyramid to compute the features and descriptors on
|
* @param image_pyramid the image pyramid to compute the features and descriptors on
|
||||||
|
Loading…
Reference in New Issue
Block a user