-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
division with MatExpr #15760
Copy link
Copy link
Closed
Labels
Milestone
Description
System information (version)
- OpenCV => 4.1.2-dev
- Operating System / Platform => win7 32bit
- Compiler => mingw64 8.1
assuming X a valid Mat and Y an empty/invalid one, the expression X / Y does not throw an exception, but calculates 1 / X instead.
because here (e.b.data is invalid in our case):
opencv/modules/core/src/matrix_expressions.cpp
Lines 1340 to 1343 in 471b400
| else if( e.flags == '/' && e.b.data ) | |
| cv::divide(e.a, e.b, dst, e.alpha); | |
| else if( e.flags == '/' && !e.b.data ) | |
| cv::divide(e.alpha, e.a, dst ); |
why does it have e.a and e.alpha in reverse ?
shouldn't it have thrown Sizes of input arguments do not match , like it does in the Y / X case ?
Steps to reproduce
Mat x(3,3,CV_32FC3,Scalar(3,2,1));
Mat y; // invalid
Mat r = x / y;
cout << r << endl;
[0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1;
0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1;
0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1]
Reactions are currently unavailable