You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1️⃣ Comment for collecting "Option 1" votes (please use GitHub emoji)
Reacted by Steven Puttemans, Jejos, Pavel Rojtberg, Alexander Alekhin, Anmol Uppal, aa12356jm, Jason Juang, Peter Rekdal Khan-Sunde, Amro, Raghuram Krishnaswami and 6 more
@StevenPuttemansBoth options require the user to check the validity of input data; it would be nice if you updated your OP to say so.
But actually, the second option only requires validation in some cases since working with empty images has legitimate uses; therefore the second option is strictly better.
Also, look at it from an algebraic point of view. The equivalent of option 1 would be if mathematics threw an exception if you tried to perform set union with an empty set. In the matrix world, an empty matrix is the equivalent of 0, and it's a perfectly legitimate value.
Activity
alalek commentedon Mar 1, 2017
1️⃣ Comment for collecting "Option 1" votes (please use GitHub emoji)
alalek commentedon Mar 1, 2017
2️⃣ Comment for collecting "Option 2" votes (please use GitHub emoji)
darbedar commentedon Aug 13, 2017
Why not use the empty image and assert a warning?
StevenPuttemans commentedon Aug 14, 2017
Thats actually what option 1 suggests :P
mpolicki commentedon Nov 3, 2021
@StevenPuttemans Both options require the user to check the validity of input data; it would be nice if you updated your OP to say so.
But actually, the second option only requires validation in some cases since working with empty images has legitimate uses; therefore the second option is strictly better.
Also, look at it from an algebraic point of view. The equivalent of option 1 would be if mathematics threw an exception if you tried to perform set union with an empty set. In the matrix world, an empty matrix is the equivalent of 0, and it's a perfectly legitimate value.
vrabaud commentedon Nov 18, 2021
BTW, why limit this to imgproc ? Why isn't it possible right to fill an empty matrix with random numbers ?
opencv/modules/core/src/rand.cpp
Line 394 in 4b6047e
And it is possible to randShuffle a cv::Mat(0,0,CV_8U) but not a cv::Mat() ?
opencv/modules/core/src/rand.cpp
Line 684 in 4b6047e