cv::max() does not work in-place anymore (Bug #1643)
Description
The following code worked before the update to 2.3.1:
cv::Mat_<float> img; [...] // get rid of negative values cv::max(img, 0., img);
With 2.3.1, it fails. The matrix has all zeroes after this call!
The following code however works as expected:
bands[i] = cv::max(bands[i], 0.);
Associated revisions
fixed #1643
History
Updated by Saul T about 1 year ago
This is caused by the header file inline fuctions being incorrect in "opencv2/core/mat.hpp". The max() functions that take three arguments:
template<typename _Tp> static inline void max(const Mat_<_Tp>& a, const Mat_<_Tp>& b, Mat_<_Tp>& c)
{
cv::min((const Mat&)a, (const Mat&)b, (Mat&)c);
}
template<typename _Tp> static inline void max(const Mat_<_Tp>& a, double s, Mat_<_Tp>& c)
{
cv::min((const Mat&)a, s, (Mat&)c);
}
template<typename _Tp> static inline void max(double s, const Mat_<_Tp>& a, Mat_<_Tp>& c)
{
cv::min((const Mat&)a, s, (Mat&)c);
}
all incorrectly call min(). The functions that take two arguments however correctly call max().
Updated by Alexander Shishkov about 1 year ago
- Target version set to 2.4.0
- Assignee set to Alexander Shishkov
Updated by Alexander Shishkov about 1 year ago
Thanks for the report!
fixed in r7522
- Status changed from Open to Done