fixed Bug #2581
GoodFeaturesToTrackDetector_GPU fails when no corners found
This commit is contained in:
parent
5047b3fba2
commit
362655b02a
@ -85,6 +85,12 @@ void cv::gpu::GoodFeaturesToTrackDetector_GPU::operator ()(const GpuMat& image,
|
|||||||
|
|
||||||
int total = findCorners_gpu(eig_, static_cast<float>(maxVal * qualityLevel), mask, tmpCorners_.ptr<float2>(), tmpCorners_.cols);
|
int total = findCorners_gpu(eig_, static_cast<float>(maxVal * qualityLevel), mask, tmpCorners_.ptr<float2>(), tmpCorners_.cols);
|
||||||
|
|
||||||
|
if (total == 0)
|
||||||
|
{
|
||||||
|
corners.release();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sortCorners_gpu(eig_, tmpCorners_.ptr<float2>(), total);
|
sortCorners_gpu(eig_, tmpCorners_.ptr<float2>(), total);
|
||||||
|
|
||||||
if (minDistance < 1)
|
if (minDistance < 1)
|
||||||
|
@ -203,6 +203,21 @@ TEST_P(GoodFeaturesToTrack, Accuracy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(GoodFeaturesToTrack, EmptyCorners)
|
||||||
|
{
|
||||||
|
int maxCorners = 1000;
|
||||||
|
double qualityLevel = 0.01;
|
||||||
|
|
||||||
|
cv::gpu::GoodFeaturesToTrackDetector_GPU detector(maxCorners, qualityLevel, minDistance);
|
||||||
|
|
||||||
|
cv::gpu::GpuMat src(100, 100, CV_8UC1, cv::Scalar::all(0));
|
||||||
|
cv::gpu::GpuMat corners(1, maxCorners, CV_32FC2);
|
||||||
|
|
||||||
|
detector(src, corners);
|
||||||
|
|
||||||
|
ASSERT_TRUE( corners.empty() );
|
||||||
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(GPU_Video, GoodFeaturesToTrack, testing::Combine(
|
INSTANTIATE_TEST_CASE_P(GPU_Video, GoodFeaturesToTrack, testing::Combine(
|
||||||
ALL_DEVICES,
|
ALL_DEVICES,
|
||||||
testing::Values(MinDistance(0.0), MinDistance(3.0))));
|
testing::Values(MinDistance(0.0), MinDistance(3.0))));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user