1 | initial version |
unfortunately, nan
and ìnf
are the result of "undefined behaviour", and will just get proagated as is.
from here:
General note about OpenCV implementations: Using of NaN values
will provide undefined behavior and should be avoided if there is no special NaN-related note in function/algorithm documentation.
// let's make one :)
float inf = 1.0/0.0;
cerr << inf << endl;
float nan = 0.0*inf;
cerr << nan << endl;
to find out, if your Mat contains NaN's, compare it to itself:
Mat m = ...
Mat mask = (m != m);
int numNaNs = countNonZero(mask);
to remove them, use patchNaNs()
2 | No.2 Revision |
unfortunately, nan
and ìnf
are the result of "undefined behaviour", and will just get proagated propagated as is.
// let's make one :)
float inf = 1.0/0.0;
cerr << inf << endl;
float nan = 0.0*inf;
cerr << nan << endl;
from here:
General note about OpenCV implementations: Using of NaN values
will provide undefined behavior and should be avoided if there is no special NaN-related note in function/algorithm documentation.
// let's make one :)
float inf = 1.0/0.0;
cerr << inf << endl;
float nan = 0.0*inf;
cerr << nan << endl;
to find out, if your Mat contains NaN's, compare it to itself:
Mat m = ...
Mat mask = (m != m);
int numNaNs = countNonZero(mask);
to if you find any, you should remove them, use using patchNaNs() before the next step of your algorithm.