Contradiction between specification of cv::pow and its implementation (Bug #3012)
Description
The specification declares that in the function cv::pow
"for a non-integer power exponent, the absolute values of input array elements are used".
Also the specification contains the following statement: "For some values of power , such as integer values, 0.5 and -0.5, specialized faster algorithms are used"
At the moment if the power value is +/- 0.5, the usual function std::sqrt
is applied in the element-wise manner, so for negative matrix elements the result is NaN.
This is the contradiction between the specification of the function cv::pow
and its implementation.
See the code of the function cv::pow
and the static functions Sqrt_32f
, Sqrt_64f
, InvSqrt_32f
, InvSqrt_64f
in the file source:modules/core/src/mathfuncs.cpp
(This may be easily fixed in the non-optimized branch of the functions, but the optimized code of the functions requires additional effort to avoid contradiction between optimized and non-optimized versions of the functions.)
Associated revisions
Merge pull request #3012 from vpisarev:clean_objdetect
History
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4566