Fixed an issue with the wrong vector type being used in the locsToMask function (changed Vec3b to Vec3d) and started working on substitution white for pixels read as nan.
fiddling with the images