Skip to content
Advertisement

Expanding/Zooming in a numpy array

I have the following array:

JavaScript

I want to expand it to this array:

JavaScript

So I’m using the following command:

JavaScript

based on this question and answer here Resampling a numpy array representing an image.

However, what I’m getting is this:

JavaScript

I want the expansion to be exactly by 3, or whatever the zoom factor is, but currently it’s different for each element of the array.

Is there a direct way to do this? Or shall I do it manually with some coding?

Advertisement

Answer

Maybe a little late, but for the sake of completness: Numpy Kron does the job perfectly

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement