Reputation: 1143
I have a doubt with OpenCV. I am doing a division with this library between two vectors ( Mat objects with a 65356x1 size). Both vectors include 0s and the division does this operation for each array element. The problem is when it divides by 0s, operation (0/0 for example), its result is not NaN, is 0!. I think It is wrong... Are there some way to get the correct result (with NaNs) or am I doing something wrong?
The code is very simple:
Mat G = im_g/tableReshaped; //(where img_g and tableReshaped are 65356x1 matrices).
Upvotes: 2
Views: 1214
Reputation: 6420
This is an expected behavior of cv::devide
function. It returns 0 for division by zero:
dst(y, x) = src2(y, x) != 0 ? src1(y, x) / src2(y, x) : 0;
If you want to get NaNs you can write your own loop for division.
Upvotes: 2