![]() # For multichannel images we don't want to apply the zoom factor to the RGB ![]() Instead you could index only the part of the input that will fall within the bounds of the output array before you apply zoom: import numpy as npĭef clipped_zoom(img, zoom_factor, **kwargs): However, in cases where you're increasing the size of the image it's wasteful to interpolate pixels that are only going to get clipped off at the edges anyway. Things are more complicated for .Ī naive method would be to zoom the entire input array, then use slice indexing and/or zero-padding to make the output the same size as your input. So to "clip" the edges you can simply call (img. ![]() ![]() If reshape is true, the output shape is adapted so that the inputĪrray is contained completely in the output. ![]()
0 Comments
Leave a Reply. |