I have just come across this question about generating a 2D Gaussian kernel from certain parameters. I do not understand what the *np.mgrid
line is doing.
I want to create many of these kernels and use them to reconstruct an image. This would involve taking the kernels and adding them to an originally empty numpy
array. Using the method in the accepted answer in the above question generating the kernels is very fast, but the np.mgrid
part is very slow. Is there a way to add the kernels to an array without creating a new array every time (which is what I think np.mgrid
is doing).