I'm facing the issue where if an image contains any NaNs, profoundImBlur(/Diff/Grad) will produce an image that is completely filled with NaNs; not quite the desired effect, of course.
I've tried converting the NaN pixels into zeros for instance, but the issue is that after the blurring process, these pixels are, of course, no longer "==0" and so it's difficult to convert them back to NaNs.
Is there no way to avoid this in these functions? If not, do you have any suggestions for getting around such a problem?
As an easy workaround you could just save the indices (or the TRUE/FALSE array) of the pixels you did set to zero to reconvert them after the blur (as the image dimensions aren't changed during the blur), i.e. something like ignorepix=!is.finite(image) image[ignorepix]=0 newim=profoundImBlur(image) newim[ignorepix]=NaN By testing for is.finite you also exclude Inf, -Inf and NA which all have the same issue. There might be better ways though...