Python: Gaussian filtering an N-channel image along only spatial dimensions?
I figured it out.
cv2.GaussianBlur() does exactly that: it blurs each channel independently, and the image can have an arbitrary number of channels.
I have an HxWxN image arr that I want to Gaussian blur.
scipy.ndimage.gaussian_filter seems to treat the image as a generic array and also blur along the final channel dimension. The desired behavior is Gaussian blurring arr[:, :, i] independently for all is and then concatenating the resultant slices back into an HxWxN result array.
Is there a better library or function that I can use to directly achieve that, or do I really need to just put scipy.ndimage.gaussian_filter in a for-loop over i?
A bonus question is what if I have M images organized as an MxHxWxN array? How do I blur over just the H and W dimensions?