Running a Gaussian filter over image with static sigma value is easy:
scipy.ndimage.gaussian_filter(input, sigma)
But how to do this with a sigma value that is different for each pixel? For example, I might have another NumPy array of the same size that indicates what sigma to use for each pixel.
I'm not aware of an adaptive Gaussian filter implementation in OpenCV, scipy.ndimage or scikit-image. DIPlib does have such a filter (disclosure: I'm an author). You can install it with
pip install diplib.This is how you would use the adaptive Gaussian filter where only the size of the kernel changes (this function also can rotate an elongated Gaussian, it's pretty neat, I recommend you play around with that!).
Do note that image objects in the Python bindings to DIPlib are compatible with NumPy arrays.