I have an image that is stored in a narrow array ~ 180x130 pixels.
I want to scale it so much that the image is NxN but to keep it that aspect ratio is kept, it means black space around the small dimension.
Is there a function to do this?
You can try a short example:
a = Np.ones ((4,2)) np.pad (a, ((0,0), (1,1)), 'continuous', constant_values = (0,0)) array ([[0 , 1., 1., 0.], [0., 1., 1., 0.], [0., 1., 1., 0], [0., 1., 1, 0 ]]
In your case, I think you should have another argument ((0,0), (2525))
your picture array On the Pad with zero in both of the 25 columns. (Of course if you represent the static values for "blank space" for your image format, you need a pad.)
No comments:
Post a Comment