Create a mask for NaN cells
I have a cv::Mat (type CV_32FC1) that contains some entries that are NaN. Basically I want to center all NaN in a matrix to a known value that dependent on which cell it is. So if both matrix and replacements are of equal dimensions, I'd like a function like:
cv::patchNaNs(matrix, replacements);
This method would replace any NaN in cell i,j from matrix with the corresponding value in cell i,j from replacements.
So I'm thinking I could do this with masks. How can I go about creating a mask that identifies those NaN entries? I tried threshold but none of the comparisons seem to be helpful for this purpose. Is there some simple thing that I'm overlooking?