Casting a matrix expression with factor 1.0 doesn't work (Bug #2952)
Description
When executing the following code, m2 has the type CV_8UC1 and m3 throws an assertion error on calling type(). If the factor is 2.0 instead, the problem does not occur.
cv::Mat m1(4,4,CV_32SC1, cv::Scalar::all(0));
cv::Mat m2 = cv::Mat_<double>(m1 * 1.0);
cv::Mat_<double> m3(m1 * 1.0);
History
Updated by Maria Dimashova almost 12 years ago
- Affected version changed from 2.4.4 to 2.4.0 - 2.4.4
- Assignee set to Vadim Pisarevsky
- Category set to core
Updated by Maria Dimashova almost 12 years ago
Affected version 2.4.4.
Updated by Daniil Osokin about 11 years ago
This is actually not a bug. Result of m1 * 1.0 from this example has CV_32SC1 type, so it's incorrect to initialize Mat_<double> with int data. But it is look unexpected: different result types with tifferent factors. The problem starts in void MatOp_AddEx::assign(const MatExpr& e, Mat& m, int _type) const at line 1202 in 'matop.cpp'.
- HW Platform set to Any
- Operating System set to Any
- Affected version changed from 2.4.0 - 2.4.4 to 2.4.8 (latest release)
- Target version set to Next Hackathon
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4547