Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Crop uniform values from the edges of an array
ResourceFunction["ArrayCropPad"][array] crops uniform values from the edges of the specified array. | |
ResourceFunction["ArrayCropPad"][array,m] gives array with exactly m zeros of padding on each side. | |
ResourceFunction["ArrayCropPad"][array,m,form] uses the specified form of padding. |
Create a two-dimensional array and crop zeros at edges:
In[1]:= |
|
Out[1]= |
|
In[2]:= |
|
Out[2]= |
|
Plot the original and the cropped arrays:
In[3]:= |
|
Out[3]= |
|
Add some "white space" around the cropped array:
In[4]:= |
|
Out[4]= |
|
Add the specified border value:
In[5]:= |
|
Out[5]= |
|
In[6]:= |
|
Out[6]= |
|
Without ArrayCropPad, this leaves lots of "white space":
In[7]:= |
|
Out[7]= |
|
ArrayCropPad crops in on the structure of interest, leaving specified padding:
In[8]:= |
|
Out[8]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License