cv::cuda::findMinMaxLoc incorrect output for single row matrix (Bug #4343)
Description
I have the following matrix which is a single row:
[1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 3, 2, 5, 6, 4, 9, 12, 15, 17, 16, 33, 45, 67, 71, 92, 142, 191, 239, 329, 499, 609, 845, 1159, 1482, 2022, 2743, 3705, 4948, 6529, 8778, 11628, 14905, 19175, 24501, 30470, 37005, 43582, 48997, 51311, 50936, 45204, 36615, 27152, 18640, 12639, 8307, 4937, 2284, 951, 419, 232, 178, 114, 102, 82, 58, 49, 36, 32, 30, 26, 12, 19, 12, 10, 7, 4, 9, 4, 2, 6, 2, 0, 2, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0]
The output of cv::cuda::findMinMaxLoc is
Value: [-2147483647]
Location: [-1]
This is being performed on the correct stream such that the input values are filled prior to execution.
The offending code is as follows:
cv::cuda::HostMem location;
cv::cuda::HostMem values;
cv::cuda::HostMem histogram;
inputHistogram->download(histogram, stream);
cv::cuda::findMinMaxLoc(
*inputHistogram,
values,
location,
inputMask == nullptr ? cv::noArray(): *inputMask,
stream);
stream.waitForCompletion();
std::stringstream ss;
ss << values.createMatHeader().row(0) << " "
<< location.createMatHeader().row(0) << " "
<< histogram.createMatHeader().row(0) << std::endl;
log(Status, ss.str());
The documentation for this function is incomplete, and should be updated to state that it doesn't work on single row matrices if that is the case.
My system:
Ubuntu 15.04
OpenCV 3.0 master (97bdc92d1b54377c1f7cf9d440b28bcae21cc5b4)
CUDA 7.0
Nvidia driver: 346.47
Associated revisions
fix #4343 : cv::cuda::findMinMaxLoc incorrect output for single row matrix
History
Updated by Vladislav Vinogradov almost 10 years ago
- Status changed from New to Open
- Difficulty deleted (
Easy)
Updated by Vladislav Vinogradov almost 10 years ago
- Pull request set to https://github.com/Itseez/opencv/pull/4024
Updated by Vladislav Vinogradov almost 10 years ago
The pull request with fix was merged.
- Status changed from Open to Done